Changeset 5884


Ignore:
Timestamp:
2003-11-19T10:49:27+13:00 (20 years ago)
Author:
jmt12
Message:

FileNodes now know whether they are in the currently open collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileNode.java

    r5860 r5884  
    22
    33import java.io.*;
    4 import java.util.*;
     4import java.util.ArrayList;
     5import java.util.Enumeration;
    56import javax.swing.*;
    67import javax.swing.filechooser.*;
     
    89import org.greenstone.gatherer.Dictionary;
    910import org.greenstone.gatherer.Gatherer;
     11import org.greenstone.gatherer.collection.Collection;
    1012import org.greenstone.gatherer.file.FileFilter;
    1113import org.greenstone.gatherer.file.FileSystemModel;
     
    2325    private ArrayList children;
    2426    private boolean children_readonly = true;
     27    private boolean current_collection = false;
    2528    private boolean readonly = true;
    2629    private File file;
     
    215218        error.printStackTrace();
    216219    }
     220    }
     221
     222    /** Is this file node within the currently open collection? */
     223    public boolean isInCurrentCollection() {
     224    if(current_collection) {
     225        return true;
     226    }
     227    else {
     228        FileNode parent = (FileNode) getParent();
     229        if(parent != null) {
     230        return parent.isInCurrentCollection();
     231        }
     232    }
     233    return false;
    217234    }
    218235
     
    254271                collection_root.setParent(this);
    255272                collection_root.setModel(model);
     273                // One last piece of magic so we can determine the current collection
     274                Collection collection = Gatherer.c_man.getCollection();
     275                if(collection != null) {
     276                collection_root.setCurrentCollection(cols[i].getName().equals(collection.getName()));
     277                }
    256278                children.add(collection_root);
    257279                collection_root = null;
     
    330352    }
    331353
     354    public void setCurrentCollection(boolean current_collection) {
     355    this.current_collection = current_collection;
     356    }
     357
    332358    /* private void setChildrenReadOnly(boolean children_readonly) {
    333359    this.children_readonly = children_readonly;
Note: See TracChangeset for help on using the changeset viewer.