Changeset 8784
- Timestamp:
- 2004-12-13T12:56:13+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r8783 r8784 21 21 protected MutableTreeNode parent = null; 22 22 23 protected boolean current_collection = false;24 25 23 26 24 public FileNode(File file) … … 228 226 229 227 230 /** Is this file node within the currently open collection? */ 231 public boolean isInCurrentCollection() { 232 if (current_collection) { 233 return true; 234 } 235 else { 236 FileNode parent = (FileNode) getParent(); 237 if (parent != null) { 238 return parent.isInCurrentCollection(); 239 } 240 } 228 /** Overridden if necessary by subclasses. */ 229 public boolean isInLoadedCollection() 230 { 241 231 return false; 242 232 } … … 268 258 child_nodes_unfiltered = new ArrayList(); 269 259 for (int i = 0; i < files.length; i++) { 270 child_nodes_unfiltered.add(this.addChildNode(files[i])); 260 FileNode child_node = this.addChildNode(files[i]); 261 child_nodes_unfiltered.add(child_node); 271 262 } 272 263 … … 280 271 for (int i = 0; i < files.length; i++) { 281 272 FileNode child_node = this.addChildNode(files[i]); 282 int index = -1; 283 if ((index = child_nodes_unfiltered.indexOf(child_node)) != -1) { 284 child_nodes.add(child_nodes_unfiltered.get(index)); 285 } 286 else { 287 child_nodes.add(child_node); 273 for (int j = 0; j < child_nodes_unfiltered.size(); j++) { 274 if (((FileNode) child_nodes_unfiltered.get(j)).equals(child_node)) { 275 child_nodes.add(child_nodes_unfiltered.get(j)); 276 } 288 277 } 289 278 } … … 301 290 } 302 291 303 304 public void setCurrentCollection(boolean current_collection) {305 this.current_collection = current_collection;306 }307 292 308 293 public void setModel(FileSystemModel model) { -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java
r8783 r8784 45 45 { 46 46 private boolean is_gs3_site_node = false; 47 private boolean is_in_loaded_collection = false; 47 48 private String title = null; 48 49 … … 67 68 child_node.setParent(this); 68 69 return child_node; 70 } 71 72 73 /** Is this file node within the currently loaded collection? */ 74 public boolean isInLoadedCollection() 75 { 76 if (is_in_loaded_collection) { 77 return true; 78 } 79 else { 80 FileNode parent = (FileNode) getParent(); 81 if (parent != null) { 82 return parent.isInLoadedCollection(); 83 } 84 } 85 return false; 69 86 } 70 87 … … 138 155 Collection collection = Gatherer.c_man.getCollection(); 139 156 if (collection != null) { 140 collection_root. setCurrentCollection(cols[i].getName().equals(collection.getName()));157 collection_root.is_in_loaded_collection = cols[i].getName().equals(collection.getName()); 141 158 } 142 159 child_nodes.add(collection_root); -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r8783 r8784 631 631 for(int i = 0; i < paths.length; i++) { 632 632 FileNode child = (FileNode) paths[i].getLastPathComponent(); 633 if (child.isInCurrentCollection()) {633 if (child.isInLoadedCollection()) { 634 634 return false; 635 635 }
Note:
See TracChangeset
for help on using the changeset viewer.