Changeset 6174
- Timestamp:
- 2003-12-08T17:07:12+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r6148 r6174 25 25 26 26 private ArrayList children; 27 private ArrayList raw_children; 27 28 private boolean children_readonly = true; 28 29 private boolean current_collection = false; … … 35 36 36 37 public FileNode(File file) { 37 /// ystem.err.println("New FileNode(" + file.getAbsolutePath() + ")");38 ///atherer.println("New FileNode(" + file.getAbsolutePath() + ")"); 38 39 this.file = file; 39 40 } … … 98 99 } 99 100 return result; 101 } 102 103 /** Retrieve the filenode at the given index, regardless of filters set. 104 * @param index int 105 */ 106 public FileNode get(int index) { 107 if(0 <= index && index < size() && file != null) { 108 return (FileNode) raw_children.get(index); 109 } 110 return null; 100 111 } 101 112 … … 293 304 if(files != null && files.length > 0) { 294 305 ArrayTools tools = new ArrayTools(); 306 // Sort the remaining files. 307 tools.sort(files, true); 308 // Now add them to children. 309 raw_children = new ArrayList(); 310 for(int i = 0; i < files.length; i++) { 311 FileNode child = new FileNode(files[i], model, children_readonly); 312 child.setParent(this); 313 raw_children.add(child); 314 } 295 315 // Apply the filters set in the model. 296 316 //if(model != null) { … … 314 334 } 315 335 catch (IOException exception) { 316 Gatherer.printStackTrace(exception);336 ///atherer.printStackTrace(exception); 317 337 } 318 338 } 319 339 } 320 340 */ 321 // Sort the remaining files.322 tools.sort(files, true);323 341 // Now add them to children. 324 342 for(int i = 0; i < files.length; i++) { 325 343 FileNode child = new FileNode(files[i], model, children_readonly); 326 child.setParent(this); 327 children.add(child); 344 int index = -1; 345 if((index = raw_children.indexOf(child)) != -1) { 346 children.add(raw_children.get(index)); 347 } 348 else { 349 child.setParent(this); 350 children.add(child); 351 } 328 352 } 329 353 } … … 387 411 error.printStackTrace(); 388 412 } 413 } 414 415 /** Retrieve the total number of child files for the file this node represents, irrespective of filters set 416 * @return int 417 */ 418 public int size() { 419 if(raw_children != null) { 420 return raw_children.size(); 421 } 422 return 0; 389 423 } 390 424 … … 407 441 ///atherer.println("Unmap: " + this); 408 442 children = null; 443 raw_children = null; 409 444 } 410 445 else {
Note:
See TracChangeset
for help on using the changeset viewer.