Changeset 5571 for trunk/gli/src/org/greenstone/gatherer/gui/tree
- Timestamp:
- 2003-10-03T17:09:38+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r4801 r5571 113 113 // Is row at top of screen? 114 114 if(pt.y + bounds.y <= AUTOSCROLL_MARGIN) { 115 115 // Yes, scroll up one row 116 116 if(row <= 0) { 117 117 row = 0; … … 122 122 } 123 123 else { 124 124 // No, scroll down one row 125 125 if(row < getRowCount() - 1) { 126 126 row = row + 1; … … 131 131 132 132 /** In order for the appearance to be consistant, given we may be in the situation where the pointer has left our focus but the ghost remains, this method allows other members of the GGroup to tell this component to clear its ghost. 133 133 */ 134 134 public void clearGhost() { 135 135 // Erase the last ghost image and cue line … … 138 138 139 139 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag event ends (somewhere else), which will in turn remove actions. 140 141 140 * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event. 141 */ 142 142 public void dragDropEnd(DragSourceDropEvent event) { 143 143 if(event.getDropSuccess()) { 144 144 // Do whatever I do when the drop is successful. 145 145 } 146 146 } 147 147 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component. 148 149 150 148 * @param event A <strong>DragSourceDragEvent</strong> containing all the information 149 * about the drag event. 150 */ 151 151 public void dragEnter(DragSourceDragEvent event) { 152 152 // Handled elsewhere. 153 153 } 154 154 /** Any implementation of DropTargetListener must include this method so we can be notified when the drag focus enters this component, which in this case is to grab focus from within our group. 155 156 155 * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event. 156 */ 157 157 public void dragEnter(DropTargetDragEvent event) { 158 158 group.grabFocus(this); 159 159 } 160 160 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component. 161 162 161 * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event. 162 */ 163 163 public void dragExit(DragSourceEvent event) { 164 164 clearGhost(); … … 166 166 167 167 /** Any implementation of DropTargetListener must include this method 168 169 170 171 168 * so we can be notified when the drag focus leaves this component. 169 * @param event A DropTargetEvent containing all the information 170 * about the drag event. 171 */ 172 172 public void dragExit(DropTargetEvent event) { 173 173 clearGhost(); … … 175 175 176 176 /** Any implementation of DragGestureListener must include this method 177 178 179 180 181 177 * so we can be notified when a drag action has been noticed, thus a 178 * drag action has begun. 179 * @param event A DragGestureEvent containing all the information about 180 * the drag event. 181 */ 182 182 public void dragGestureRecognized(DragGestureEvent event) { 183 183 // Can never drag from MetaEdit tree … … 253 253 254 254 /** Implementation side-effect. 255 256 255 * @param event A DragSourceDragEvent containing all the information about the drag event. 256 */ 257 257 public void dragOver(DragSourceDragEvent event) { 258 258 } 259 259 260 260 /** Any implementation of DropTargetListener must include this method 261 262 263 264 261 * so we can be notified when the drag moves in this component. 262 * @param event A DropTargetDragEvent containing all the information 263 * about the drag event. 264 */ 265 265 public void dragOver(DropTargetDragEvent event) { 266 266 // Draw the mouse ghost … … 324 324 target = (FileNode) target_path.getLastPathComponent(); 325 325 } 326 //else {327 // // Warn that this is an invalid drop.328 // MessageTask invalid_target_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.InvalidTarget"));329 // invalid_target_task.start();330 // invalid_target_task = null;331 //}332 326 } 333 327 else { … … 357 351 } 358 352 } 359 //else {360 // Warn that this is an invalid drop.361 // ///ystem.err.println("About to show a modal dialog box from JOptionPane.");362 // MessageTask read_only_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.ReadOnlyTarget"));363 // read_only_task.start();364 // read_only_task = null;365 // ///ystem.err.println("Returning from a modal dialog box.");366 //}367 353 // Clear up the group.image_ghost 368 354 paintImmediately(ra_ghost.getBounds()); … … 370 356 } 371 357 372 //private class MessageTask373 // extends Thread {374 // private String message;375 // private String title;376 //377 // MessageTask(String title, String message) {378 // this.message = message;379 // this.title = title;380 // }381 //382 // public void run() {383 // JOptionPane.showMessageDialog(Gatherer.g_man, message, title, JOptionPane.ERROR_MESSAGE);384 // }385 //}386 358 387 359 /** Any implementation of DragSourceListener must include this method 388 389 390 391 360 * so we can be notified when the action to be taken upon drop changes. 361 * @param event A DragSourceDragEvent containing all the information 362 * about the drag event. 363 */ 392 364 public void dropActionChanged(DragSourceDragEvent event) { 393 365 } 394 366 395 367 /** Any implementation of DropTargetListener must include this method 396 397 398 399 368 * so we can be notified when the action to be taken upon drop changes. 369 * @param event A DropTargetDragEvent containing all the information 370 * about the drag event. 371 */ 400 372 public void dropActionChanged(DropTargetDragEvent event) { 401 373 } 402 374 403 375 /** Used to notify this component that it has gained focus. It should 404 405 376 * make some effort to inform the user of this. 377 */ 406 378 public void gainFocus() { 407 379 ///ystem.err.println("Gained focus: " + this); … … 411 383 412 384 /** Autoscroll Interface... 413 414 415 416 417 418 419 420 421 422 423 385 * The following code was borrowed from the book: 386 * Java Swing 387 * By Robert Eckstein, Marc Loy & Dave Wood 388 * Paperback - 1221 pages 1 Ed edition (September 1998) 389 * O'Reilly & Associates; ISBN: 156592455X 390 * 391 * The relevant chapter of which can be found at: 392 * http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf 393 * Calculate the insets for the *JTREE*, not the viewport 394 * the tree is in. This makes it a bit messy. 395 */ 424 396 public Insets getAutoscrollInsets() 425 397 { … … 441 413 442 414 /** This method is used to inform this component when it loses focus, 443 444 415 * and should indicate this somehow. 416 */ 445 417 public void loseFocus() { 446 418 ///ystem.err.println("Lost focus: " + this); … … 501 473 502 474 /** Override the normal setEnabled so the Tree exhibits a little more 503 504 505 475 * change, which in this instance is the background colour changing. 476 * @param state Whether this GTree should be in an enabled state. 477 */ 506 478 public void setEnabled(boolean state) { 507 479 super.setEnabled(state); … … 571 543 } 572 544 } 573 545 // 3c. If not found then return as this node can't exists somehow. 574 546 if(!found) { 575 547 return;
Note:
See TracChangeset
for help on using the changeset viewer.