Changeset 8784


Ignore:
Timestamp:
2004-12-13T12:56:13+13:00 (19 years ago)
Author:
mdewsnip
Message:

A few more changes to the improved file tree code.

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  
    2121    protected MutableTreeNode parent = null;
    2222
    23     protected boolean current_collection = false;
    24 
    2523
    2624    public FileNode(File file)
     
    228226
    229227
    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    {
    241231    return false;
    242232    }
     
    268258        child_nodes_unfiltered = new ArrayList();
    269259        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);
    271262        }
    272263
     
    280271        for (int i = 0; i < files.length; i++) {
    281272            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            }
    288277            }
    289278        }
     
    301290    }
    302291
    303 
    304     public void setCurrentCollection(boolean current_collection) {
    305     this.current_collection = current_collection;
    306     }
    307292
    308293    public void setModel(FileSystemModel model) {
  • trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java

    r8783 r8784  
    4545{
    4646    private boolean is_gs3_site_node = false;
     47    private boolean is_in_loaded_collection = false;
    4748    private String title = null;
    4849
     
    6768    child_node.setParent(this);
    6869    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;
    6986    }
    7087
     
    138155            Collection collection = Gatherer.c_man.getCollection();
    139156            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());
    141158            }
    142159            child_nodes.add(collection_root);
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java

    r8783 r8784  
    631631    for(int i = 0; i < paths.length; i++) {
    632632        FileNode child = (FileNode) paths[i].getLastPathComponent();
    633         if(child.isInCurrentCollection()) {
     633        if (child.isInLoadedCollection()) {
    634634        return false;
    635635        }
Note: See TracChangeset for help on using the changeset viewer.