This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 211836
Collapse All | Expand All

(-)a/core.windows/src/org/netbeans/core/windows/view/EditorView.java (+5 lines)
Lines 410-415 Link Here
410
        public boolean supportsKind(TopComponentDraggable transfer) {
410
        public boolean supportsKind(TopComponentDraggable transfer) {
411
            return true;
411
            return true;
412
        }
412
        }
413
414
        @Override
415
        public int getKind() {
416
            return Constants.MODE_KIND_EDITOR;
417
        }
413
        
418
        
414
    } // End of EditorAreaComponent class.
419
    } // End of EditorAreaComponent class.
415
    
420
    
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java (-2 / +2 lines)
Lines 165-173 Link Here
165
        dragWindow = null;
165
        dragWindow = null;
166
    }
166
    }
167
167
168
    public void setDropFeedback(boolean dropEnabled) {
168
    public void setDropFeedback(boolean dropEnabled, boolean mixedTCDragDrop) {
169
        if( null != dragWindow ) {
169
        if( null != dragWindow ) {
170
            dragWindow.setDropFeedback( dropEnabled );
170
            dragWindow.setDropFeedback( dropEnabled, mixedTCDragDrop );
171
        }
171
        }
172
    }
172
    }
173
173
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java (-30 / +11 lines)
Lines 78-84 Link Here
78
    private BufferedImage contentImage;
78
    private BufferedImage contentImage;
79
    private BufferedImage imageBuffer;
79
    private BufferedImage imageBuffer;
80
    private float contentAlpha = 0.15f;
80
    private float contentAlpha = 0.15f;
81
    private Color contentBackground = Color.white;
81
    private Color contentBackground = new Color(255, 90, 0);
82
    
82
    
83
    private Timer currentEffect;
83
    private Timer currentEffect;
84
    
84
    
Lines 93-99 Link Here
93
        contentImage = createContentImage( content, contentSize );
93
        contentImage = createContentImage( content, contentSize );
94
        if( useFadeEffects ) {
94
        if( useFadeEffects ) {
95
            imageBuffer = createImageBuffer( contentImage );
95
            imageBuffer = createImageBuffer( contentImage );
96
            currentEffect = createInitialEffect();
96
            currentEffect = createEffect();
97
            currentEffect.start();
97
            currentEffect.start();
98
        } else {
98
        } else {
99
            contentAlpha = 1.0f;
99
            contentAlpha = 1.0f;
Lines 170-185 Link Here
170
    }
170
    }
171
171
172
    private boolean dropEnabled = true;
172
    private boolean dropEnabled = true;
173
    public void setDropFeedback( boolean dropEnabled ) {
173
    private boolean mixedDragDrop = false;
174
    public void setDropFeedback( boolean dropEnabled, boolean mixedDragDrop ) {
174
        boolean prevState = this.dropEnabled;
175
        boolean prevState = this.dropEnabled;
175
        this.dropEnabled = dropEnabled;
176
        this.dropEnabled = dropEnabled;
176
        if( prevState != this.dropEnabled ) {
177
        boolean prevState2 = this.mixedDragDrop;
178
        this.mixedDragDrop = mixedDragDrop;
179
        if( prevState != this.dropEnabled || prevState2 != this.mixedDragDrop ) {
177
            if( null != currentEffect ) {
180
            if( null != currentEffect ) {
178
                currentEffect.stop();
181
                currentEffect.stop();
179
            }
182
            }
180
            if( useFadeEffects ) {
183
            if( useFadeEffects ) {
181
                contentBackground = Color.black;
184
                contentBackground = dropEnabled ? 
182
                currentEffect = dropEnabled ? createDropEnabledEffect() : createNoDropEffect();
185
                        (mixedDragDrop ? new Color(90, 255, 0) : new Color(255, 90, 0)) : Color.black;
186
                currentEffect = createEffect();
183
                currentEffect.start();
187
                currentEffect.start();
184
                repaint();
188
                repaint();
185
            } else {
189
            } else {
Lines 189-221 Link Here
189
        }
193
        }
190
    }
194
    }
191
    
195
    
192
    private Timer createInitialEffect() {
193
        final Timer timer = new Timer(100, null);
194
        timer.addActionListener(new ActionListener() {
195
            public void actionPerformed(ActionEvent e) {
196
                if( contentAlpha < 1.0f ) {
197
                    contentAlpha += ALPHA_INCREMENT;
198
                } else {
199
                    timer.stop();
200
                }
201
                if( contentAlpha > 1.0f )
202
                    contentAlpha = 1.0f;
203
                repaintImageBuffer();
204
                repaint();
205
            }
206
        });
207
        timer.setInitialDelay(0);
208
        return timer;
209
    }
210
    
211
    private Timer createDropEnabledEffect() {
212
        return createInitialEffect();
213
    }
214
    
215
    private static final float NO_DROP_ALPHA = 0.5f;
196
    private static final float NO_DROP_ALPHA = 0.5f;
216
    private static final float ALPHA_INCREMENT = 0.085f;
197
    private static final float ALPHA_INCREMENT = 0.085f;
217
    
198
    
218
    private Timer createNoDropEffect() {
199
    private Timer createEffect() {
219
        final Timer timer = new Timer(100, null);
200
        final Timer timer = new Timer(100, null);
220
        timer.addActionListener(new ActionListener() {
201
        timer.addActionListener(new ActionListener() {
221
            public void actionPerformed(ActionEvent e) {
202
            public void actionPerformed(ActionEvent e) {
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/DropTargetGlassPane.java (-1 / +9 lines)
Lines 274-286 Link Here
274
    }
274
    }
275
275
276
    private TexturePaint texturePaint;
276
    private TexturePaint texturePaint;
277
    private int modeKind = -1;
277
    private TexturePaint getIndicationPaint() {
278
    private TexturePaint getIndicationPaint() {
278
        if( null == texturePaint ) {
279
        if (droppable != null && droppable.getKind() != modeKind) {
279
            BufferedImage image = new BufferedImage(2,2,BufferedImage.TYPE_INT_ARGB);
280
            BufferedImage image = new BufferedImage(2,2,BufferedImage.TYPE_INT_ARGB);
280
            Graphics2D g2 = image.createGraphics();
281
            Graphics2D g2 = image.createGraphics();
281
            Color c = UIManager.getColor("Panel.dropTargetGlassPane");
282
            Color c = UIManager.getColor("Panel.dropTargetGlassPane");
282
            if (c == null) {
283
            if (c == null) {
283
                c = new Color(255, 90, 0);
284
                c = new Color(255, 90, 0);
285
                if ((droppable.getKind() == Constants.MODE_KIND_EDITOR
286
                        && windowDragAndDrop.getStartingTransfer().getKind() != Constants.MODE_KIND_EDITOR) ||
287
                        (droppable.getKind() != Constants.MODE_KIND_EDITOR
288
                        && windowDragAndDrop.getStartingTransfer().getKind() == Constants.MODE_KIND_EDITOR)) {
289
                    c = new Color(90, 255, 0);
290
                }
284
            }
291
            }
285
            g2.setColor(c);
292
            g2.setColor(c);
286
            g2.fillRect(0,0,1,1);
293
            g2.fillRect(0,0,1,1);
Lines 290-295 Link Here
290
            g2.fillRect(1,0,1,1);
297
            g2.fillRect(1,0,1,1);
291
            g2.fillRect(0,1,1,1);
298
            g2.fillRect(0,1,1,1);
292
            texturePaint = new TexturePaint(image, new Rectangle(0,0,2,2));
299
            texturePaint = new TexturePaint(image, new Rectangle(0,0,2,2));
300
            modeKind = droppable.getKind();
293
        }
301
        }
294
        return texturePaint;
302
        return texturePaint;
295
    }
303
    }
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java (-4 / +6 lines)
Lines 678-685 Link Here
678
     * It plays its role. Sets the cursor from 'no-drop' state
678
     * It plays its role. Sets the cursor from 'no-drop' state
679
     * to its 'drop' state sibling.
679
     * to its 'drop' state sibling.
680
     * @param freeArea true when mouse pointer in free screen area
680
     * @param freeArea true when mouse pointer in free screen area
681
     * @param mixedDragDrop true when document and non-document top components are about to be mixed
681
     * @see #dragEnter */
682
     * @see #dragEnter */
682
    void setSuccessCursor (boolean freeArea) {
683
    void setSuccessCursor (boolean freeArea, boolean mixedDragDrop) {
683
        int dropAction = hackUserDropAction;
684
        int dropAction = hackUserDropAction;
684
        DragSourceContext ctx = dragContextWRef.get();
685
        DragSourceContext ctx = dragContextWRef.get();
685
        
686
        
Lines 688-694 Link Here
688
        }
689
        }
689
        
690
        
690
        if( null != visualizer )
691
        if( null != visualizer )
691
            visualizer.setDropFeedback( true );
692
            visualizer.setDropFeedback( true, mixedDragDrop );
692
693
693
        dropFailed = false;
694
        dropFailed = false;
694
695
Lines 720-727 Link Here
720
    /** Hacks problems with <code>dragExit</code> wrong method calls.
721
    /** Hacks problems with <code>dragExit</code> wrong method calls.
721
     * It plays its role. Sets the cursor from 'drop' state
722
     * It plays its role. Sets the cursor from 'drop' state
722
     * to its 'no-drop' state sibling.
723
     * to its 'no-drop' state sibling.
724
     * @param mixedDragDrop true when document and non-document top components are about to be mixed
723
     * @see #dragExit */
725
     * @see #dragExit */
724
    void setUnsuccessCursor() {
726
    void setUnsuccessCursor(boolean mixedDragDrop) {
725
        DragSourceContext ctx = dragContextWRef.get();
727
        DragSourceContext ctx = dragContextWRef.get();
726
        
728
        
727
        if(ctx == null) {
729
        if(ctx == null) {
Lines 729-735 Link Here
729
        }
731
        }
730
        
732
        
731
        if( null != visualizer )
733
        if( null != visualizer )
732
            visualizer.setDropFeedback( false );
734
            visualizer.setDropFeedback( false, mixedDragDrop );
733
        
735
        
734
        String name = ctx.getCursor().getName();
736
        String name = ctx.getCursor().getName();
735
        
737
        
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDroppable.java (+6 lines)
Lines 90-93 Link Here
90
    /** Checks whether this droppable supports kind of winsys transfer.
90
    /** Checks whether this droppable supports kind of winsys transfer.
91
     * Either <code>Constants.MODE_KIND_EDITOR</code> or <code>Constants.MODE_KIND_VIEW or both. */
91
     * Either <code>Constants.MODE_KIND_EDITOR</code> or <code>Constants.MODE_KIND_VIEW or both. */
92
    public boolean supportsKind(TopComponentDraggable transfer);
92
    public boolean supportsKind(TopComponentDraggable transfer);
93
    
94
    /**
95
     * @return Mode kind of the originating mode when just a single TopComponent
96
     * is being dragged or the kind of the mode that is being dragged.
97
     */
98
    public int getKind();
93
}
99
}
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java (-8 / +42 lines)
Lines 695-700 Link Here
695
        return false;
695
        return false;
696
    }
696
    }
697
    
697
    
698
    /** Indicates whether document and non-document top components are about to be mixed
699
     *  when transfer drops into droppable.
700
     */
701
    static boolean isMixedTCDragDrop(TopComponentDraggable transfer, TopComponentDroppable droppable) {
702
        if (transfer != null && droppable != null) {
703
            if ((droppable.getKind() == Constants.MODE_KIND_EDITOR
704
                    && transfer.getKind() != Constants.MODE_KIND_EDITOR)
705
                    || (droppable.getKind() != Constants.MODE_KIND_EDITOR
706
                    && transfer.getKind() == Constants.MODE_KIND_EDITOR)) {
707
                return true;
708
            }
709
        }
710
        return false;
711
    }
712
    
698
    /** Indicates whether the cursor is around the editor area of the main window.
713
    /** Indicates whether the cursor is around the editor area of the main window.
699
     * In that case is needed also to provide a drop. */
714
     * In that case is needed also to provide a drop. */
700
    static boolean isNearEditorEdge(Point location, ViewAccessor viewAccessor, int kind) {
715
    static boolean isNearEditorEdge(Point location, ViewAccessor viewAccessor, int kind) {
Lines 1018-1024 Link Here
1018
                    && windowDnDManager.startingTransfer.isUndockingEnabled();
1033
                    && windowDnDManager.startingTransfer.isUndockingEnabled();
1019
            boolean isAroundCenterPanel
1034
            boolean isAroundCenterPanel
1020
                    = isAroundCenterPanel(location);
1035
                    = isAroundCenterPanel(location);
1021
1036
            boolean isMixedTCDragDrop = isMixedTCDragDrop(windowDnDManager.startingTransfer, windowDnDManager.findDroppableFromScreen(windowDnDManager.getFloatingFrames(), location, windowDnDManager.startingTransfer));
1037
            
1022
            if(isInMainDroppable || isInFrameDroppable || isAroundCenterPanel) {
1038
            if(isInMainDroppable || isInFrameDroppable || isAroundCenterPanel) {
1023
                TopComponentDroppable droppable 
1039
                TopComponentDroppable droppable 
1024
                        = windowDnDManager.findDroppableFromScreen(windowDnDManager.getFloatingFrames(), location, windowDnDManager.startingTransfer);
1040
                        = windowDnDManager.findDroppableFromScreen(windowDnDManager.getFloatingFrames(), location, windowDnDManager.startingTransfer);
Lines 1027-1035 Link Here
1027
                if (droppable instanceof FreeAreaDroppable) {
1043
                if (droppable instanceof FreeAreaDroppable) {
1028
                    if(WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED
1044
                    if(WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED
1029
                        && droppable.canDrop(windowDnDManager.startingTransfer, location)) {
1045
                        && droppable.canDrop(windowDnDManager.startingTransfer, location)) {
1030
                        topComponentDragSupport.setSuccessCursor(true);
1046
                        topComponentDragSupport.setSuccessCursor(true, isMixedTCDragDrop);
1031
                    } else {
1047
                    } else {
1032
                        topComponentDragSupport.setUnsuccessCursor();
1048
                        topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
1033
                    }                    
1049
                    }                    
1034
                    // for the status bar it's null somehow, workarounding by checking for null.. should go away..
1050
                    // for the status bar it's null somehow, workarounding by checking for null.. should go away..
1035
                } else if (droppable != null) {
1051
                } else if (droppable != null) {
Lines 1043-1064 Link Here
1043
                    Point p = new Point(location);
1059
                    Point p = new Point(location);
1044
                    SwingUtilities.convertPointFromScreen(p, droppable.getDropComponent());
1060
                    SwingUtilities.convertPointFromScreen(p, droppable.getDropComponent());
1045
                    if(droppable.canDrop(windowDnDManager.startingTransfer, p)) {
1061
                    if(droppable.canDrop(windowDnDManager.startingTransfer, p)) {
1046
                        topComponentDragSupport.setSuccessCursor(false);
1062
                        topComponentDragSupport.setSuccessCursor(false, isMixedTCDragDrop);
1047
                    } else {
1063
                    } else {
1048
                        topComponentDragSupport.setUnsuccessCursor();
1064
                        topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
1049
                    }
1065
                    }
1050
                    dragOverDropTarget(location, droppable);
1066
                    dragOverDropTarget(location, droppable);
1051
                }
1067
                }
1052
            } else if(!isInMainWindow(location) 
1068
            } else if(!isInMainWindow(location) 
1053
                        && windowDnDManager.isInFloatingFrame(location)) {
1069
                        && windowDnDManager.isInFloatingFrame(location)) {
1054
                // Simulates success drop in free area.
1070
                // Simulates success drop in free area.
1055
                topComponentDragSupport.setSuccessCursor(false);
1071
                topComponentDragSupport.setSuccessCursor(false, isMixedTCDragDrop);
1056
            } else if(isInFreeArea(location, fakeWindow)
1072
            } else if(isInFreeArea(location, fakeWindow)
1057
                        && getFreeAreaDroppable(location).canDrop(windowDnDManager.startingTransfer, location)
1073
                        && getFreeAreaDroppable(location).canDrop(windowDnDManager.startingTransfer, location)
1058
                        && windowDnDManager.startingTransfer.isUndockingEnabled()) {
1074
                        && windowDnDManager.startingTransfer.isUndockingEnabled()) {
1059
                topComponentDragSupport.setSuccessCursor(true);
1075
                topComponentDragSupport.setSuccessCursor(true, isMixedTCDragDrop);
1060
            } else {
1076
            } else {
1061
                topComponentDragSupport.setUnsuccessCursor();
1077
                topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
1062
            }
1078
            }
1063
            
1079
            
1064
            if(!isInMainDroppable && !isInFrameDroppable && !isAroundCenterPanel) {
1080
            if(!isInMainDroppable && !isInFrameDroppable && !isAroundCenterPanel) {
Lines 1193-1198 Link Here
1193
            return transfer.getKind() == Constants.MODE_KIND_VIEW || transfer.getKind() == Constants.MODE_KIND_SLIDING;
1209
            return transfer.getKind() == Constants.MODE_KIND_VIEW || transfer.getKind() == Constants.MODE_KIND_SLIDING;
1194
        }
1210
        }
1195
1211
1212
        @Override
1213
        public int getKind() {
1214
            return Constants.MODE_KIND_VIEW;
1215
        }
1196
1216
1197
    } // End of class CenterPanelDroppable.
1217
    } // End of class CenterPanelDroppable.
1198
    
1218
    
Lines 1276-1281 Link Here
1276
            return transfer.getKind() == Constants.MODE_KIND_EDITOR;
1296
            return transfer.getKind() == Constants.MODE_KIND_EDITOR;
1277
        }
1297
        }
1278
1298
1299
        @Override
1300
        public int getKind() {
1301
            return Constants.MODE_KIND_EDITOR;
1302
        }
1279
1303
1280
    } // End of class EditorAreaDroppable.
1304
    } // End of class EditorAreaDroppable.
1281
1305
Lines 1337-1342 Link Here
1337
            return true;
1361
            return true;
1338
        }
1362
        }
1339
1363
1364
        @Override
1365
        public int getKind() {
1366
            return Constants.MODE_KIND_VIEW;
1367
        }
1368
1340
    } // End of class FreeAreaDroppable.
1369
    } // End of class FreeAreaDroppable.
1341
    
1370
    
1342
    /**
1371
    /**
Lines 1533-1538 Link Here
1533
            }
1562
            }
1534
            return rect;
1563
            return rect;
1535
        }
1564
        }
1565
1566
        @Override
1567
        public int getKind() {
1568
            return Constants.MODE_KIND_SLIDING;
1569
        }
1536
    }
1570
    }
1537
1571
1538
}
1572
}

Return to bug 211836