Changeset 10691
- Timestamp:
- 2005-10-05T15:54:53+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r9755 r10691 300 300 g2.drawImage(group.image_ghost, AffineTransform.getTranslateInstance(ra_ghost.getX(), ra_ghost.getY()), null); 301 301 } 302 // Now we highlight the target node if it is a valid drop target. Of course we don't bother if we are still over a node which has already been identified as to whether its a drop target .302 // Now we highlight the target node if it is a valid drop target. Of course we don't bother if we are still over a node which has already been identified as to whether its a drop target 303 303 TreePath target_path = this.getPathForLocation(pt.x, pt.y); 304 305 if (target_path == null) { 306 // the user has moved the mouse into background area - need to remove any existing cue lines 307 if(upper_cue_line != null && lower_cue_line != null) { 308 paintImmediately(upper_cue_line.getBounds()); 309 paintImmediately(lower_cue_line.getBounds()); 310 previous_path = null; 311 } 312 // don't need to display anything 313 return; 314 } 315 304 316 if(previous_path == null || target_path != null && !target_path.equals(previous_path)) { 305 317 // Immediately clear the old cue lines. … … 309 321 } 310 322 if(isValidDrop(target_path)) { 311 ///ystem.err.println("Valid. Painting cues.");312 323 // Get the drop target's bounding rectangle 313 324 Rectangle raPath = getPathBounds(target_path); 314 325 // Cue line bounds (2 pixels beneath the drop target) 315 upper_cue_line = new Rectangle(0, 316 lower_cue_line = new Rectangle(0, 326 upper_cue_line = new Rectangle(0, raPath.y + (int)raPath.getHeight(), getWidth(), 2); 327 lower_cue_line = new Rectangle(0, raPath.y, getWidth(), 2); 317 328 g2.setColor(((DefaultTreeCellRenderer)cellRenderer).getBackgroundSelectionColor()); // The cue line color 318 329 g2.fill(upper_cue_line); // Draw the cue line … … 644 655 private boolean isValidDrop(TreePath target_path) { 645 656 boolean valid = false; 646 if(target_path != null) { 657 if(target_path == null) { 658 previous_path = null; 659 } 660 else { 647 661 FileNode target_node = (FileNode) target_path.getLastPathComponent(); 648 662 // We can only continue testing if the node is a folder. … … 673 687 previous_path = target_path; 674 688 } 675 else {676 if(target_path == null) {677 previous_path = null;678 }679 }680 689 return valid; 681 690 }
Note:
See TracChangeset
for help on using the changeset viewer.