Changeset 11622
- Timestamp:
- 2006-04-07T13:19:24+12:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionTree.java
r11620 r11622 43 43 implements MouseListener 44 44 { 45 public CollectionTree( String name,CollectionTreeModel collection_tree_model, boolean mixed_selection)46 { 47 super( name,collection_tree_model, mixed_selection);45 public CollectionTree(CollectionTreeModel collection_tree_model, boolean mixed_selection) 46 { 47 super(collection_tree_model, mixed_selection); 48 48 addMouseListener(this); 49 49 … … 59 59 60 60 61 public boolean isDraggable() 62 { 63 return true; 64 } 65 66 67 public boolean isDroppable() 68 { 69 return true; 70 } 71 72 61 73 public void mouseClicked(MouseEvent event) 62 74 { … … 73 85 74 86 public void mouseReleased(MouseEvent event) { } 87 88 89 public String toString() 90 { 91 return "Collection"; 92 } 75 93 76 94 -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java
r11620 r11622 49 49 50 50 51 public WorkspaceTree( String name)52 { 53 super( name,WorkspaceTreeModel.getWorkspaceTreeModel(), true);51 public WorkspaceTree() 52 { 53 super(WorkspaceTreeModel.getWorkspaceTreeModel(), true); 54 54 addMouseListener(this); 55 55 … … 71 71 // Now update the tree 72 72 refresh(FOLDER_SHORTCUTS_CHANGED); 73 } 74 75 76 public boolean isDraggable() 77 { 78 return true; 79 } 80 81 82 public boolean isDroppable() 83 { 84 return false; 73 85 } 74 86 … … 170 182 // Update tree 171 183 refresh(FOLDER_SHORTCUTS_CHANGED); 184 } 185 186 187 public String toString() 188 { 189 return "Workspace"; 172 190 } 173 191 -
trunk/gli/src/org/greenstone/gatherer/gui/EnrichPane.java
r11620 r11622 66 66 /** The currently reported selection. */ 67 67 private CollectionTreeNode[] file_nodes = null; 68 /** Used to dynamically filter the collection tree. Synchronized with the same filter in the Gather view.*/68 /** Used to dynamically filter the collection tree. */ 69 69 private Filter collection_filter = null; 70 70 /** The label at the top of the collection tree, which shows the collection name. */ … … 127 127 128 128 DragGroup group = new DragGroup(); 129 collection_tree = new CollectionTree( "Enrich",Gatherer.c_man.getCollectionTreeModel(), false);129 collection_tree = new CollectionTree(Gatherer.c_man.getCollectionTreeModel(), false); 130 130 group.add(collection_tree); 131 131 collection_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); -
trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java
r11620 r11622 219 219 Dictionary.registerText(workspace_label, "Collection.Workspace"); 220 220 221 workspace_tree = new WorkspaceTree( Utility.WORKSPACE_TREE);221 workspace_tree = new WorkspaceTree(); 222 222 group.add(workspace_tree); 223 223 workspace_scroll = new JScrollPane(workspace_tree); … … 234 234 Dictionary.registerText(collection_label, "Collection.No_Collection"); 235 235 236 collection_tree = new CollectionTree( Utility.COLLECTION_TREE,Gatherer.c_man.getCollectionTreeModel(), true);236 collection_tree = new CollectionTree(Gatherer.c_man.getCollectionTreeModel(), true); 237 237 collection_tree.setEnabled(Gatherer.c_man.getCollectionTreeModel() != null); 238 238 group.add(collection_tree); -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r11620 r11622 50 50 /** The region borderer by the upper cue line. */ 51 51 private Rectangle upper_cue_line; 52 /** The identifying name of this Tree. */53 private String name;54 52 /** The last tree path the drag was hovered over. */ 55 53 private TreePath previous_path = null; … … 66 64 67 65 68 public DragTree( String name,TreeModel model, boolean mixed_selection)66 public DragTree(TreeModel model, boolean mixed_selection) 69 67 { 70 68 super(); … … 78 76 } 79 77 80 init( name,mixed_selection);78 init(mixed_selection); 81 79 if (model != null) { 82 80 setModel(model); … … 84 82 } 85 83 86 public void init( String name,boolean mixed_selection) {84 public void init(boolean mixed_selection) { 87 85 if (NO_DRAG_CURSOR == null) { 88 86 NO_DRAG_CURSOR = DragSource.DefaultMoveNoDrop; … … 90 88 91 89 // Init 92 this.name = name;93 90 this.filter = new Filter(this, null); 94 91 … … 213 210 * the drag event. 214 211 */ 215 public void dragGestureRecognized(DragGestureEvent event) { 216 // Can never drag from Enrich tree 217 if(name.equals("Enrich")) { 212 public void dragGestureRecognized(DragGestureEvent event) 213 { 214 // Check that the tree is draggable 215 if (!isDraggable()) { 218 216 return; 219 217 } 218 220 219 // Disable editing, unless you want to have the edit box pop-up part way through dragging. 221 220 this.setEditable(false); … … 365 364 ///start = System.currentTimeMillis(); 366 365 ///ystem.err.println("Drop target drop: " + this); 366 if (!isDroppable()) { 367 return; 368 } 369 367 370 event.acceptDrop(drag_action); 368 if(!name.equals(Utility.WORKSPACE_TREE)) { 369 // Determine what node we dropped over. 370 Point pt = event.getLocation(); 371 TreePath target_path = this.getPathForLocation(pt.x, pt.y); 372 FileNode target = null; 373 if(target_path != null) { 374 if(isValidDrop(target_path)) { 375 target = (FileNode) target_path.getLastPathComponent(); 376 } else if (isValidDropOntoFile(target_path)) { 377 target = (FileNode) target_path.getParentPath().getLastPathComponent(); 371 372 // Determine what node we dropped over. 373 Point pt = event.getLocation(); 374 TreePath target_path = this.getPathForLocation(pt.x, pt.y); 375 FileNode target = null; 376 if(target_path != null) { 377 if(isValidDrop(target_path)) { 378 target = (FileNode) target_path.getLastPathComponent(); 379 } else if (isValidDropOntoFile(target_path)) { 380 target = (FileNode) target_path.getParentPath().getLastPathComponent(); 381 } 382 } 383 else { 384 TreeModel m = getModel(); 385 // check that we have a model and is a FileSystemModel (ie check that a collection is loaded 386 if (m != null && m instanceof FileSystemModel) { 387 target = (FileNode) m.getRoot(); 388 } 389 } 390 target_path = null; 391 pt = null; 392 if(target != null) { 393 ///ystem.err.println("Valid drop."); 394 TreePath[] selection = group.getSelection(); 395 if(target != null && selection != null) { 396 FileNode[] source_nodes = new FileNode[selection.length]; 397 for(int i = 0; i < source_nodes.length; i++) { 398 source_nodes[i] = (FileNode) selection[i].getLastPathComponent(); 378 399 } 379 } 380 else { 381 TreeModel m = getModel(); 382 // check that we have a model and is a FileSystemModel (ie check that a collection is loaded 383 if (m != null && m instanceof FileSystemModel) { 384 target = (FileNode) m.getRoot(); 385 } 386 } 387 target_path = null; 388 pt = null; 389 if(target != null) { 390 ///ystem.err.println("Valid drop."); 391 TreePath[] selection = group.getSelection(); 392 if(target != null && selection != null) { 393 FileNode[] source_nodes = new FileNode[selection.length]; 394 for(int i = 0; i < source_nodes.length; i++) { 395 source_nodes[i] = (FileNode) selection[i].getLastPathComponent(); 396 } 397 Gatherer.f_man.action(group.getSource(), source_nodes, this, target); 398 source_nodes = null; 399 } 400 group.setSelection(null); 401 group.setSource(null); 402 selection = null; 403 target = null; 404 } 405 } 400 Gatherer.f_man.action(group.getSource(), source_nodes, this, target); 401 source_nodes = null; 402 } 403 group.setSelection(null); 404 group.setSource(null); 405 selection = null; 406 target = null; 407 } 408 406 409 // Clear up the group.image_ghost 407 410 paintImmediately(ra_ghost.getBounds()); … … 469 472 return (FileSystemModel) getModel(); 470 473 } 474 475 476 protected abstract boolean isDraggable(); 477 478 479 protected abstract boolean isDroppable(); 480 471 481 472 482 /** This method is used to inform this component when it loses focus, … … 624 634 ((DefaultTreeCellRenderer)cellRenderer).setTextSelectionColor(color); 625 635 repaint(); 626 }627 628 public String toString() {629 return name;630 636 } 631 637 -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r11481 r11622 65 65 static final public String CFG_CLASSIFY_SORT = "-sort"; 66 66 static final public String CFG_FORMAT = "format"; 67 static final public String COLLECTION_TREE = "Collection";68 67 /** Definition of an important directory name, in this case the file the collection configuration is expect to be in. */ 69 68 static final public String CONFIG_FILE = "etc" + File.separator + "collect.cfg"; … … 84 83 /** The current version of the GLI. */ 85 84 static final public String PROGRAM_VERSION = "v2.70"; 86 static final public String WORKSPACE_TREE = "Workspace";87 85 88 86
Note:
See TracChangeset
for help on using the changeset viewer.