Changeset 8846


Ignore:
Timestamp:
2004-12-17T15:07:36+13:00 (19 years ago)
Author:
mdewsnip
Message:

Tidied up the workspace and collection trees a bit more, in preparation for having special icons for some collection files.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/Collection.java

    r8783 r8846  
    129129    /** Determine the number of documents and folders in this collection. */
    130130    public int getCount() {
    131     return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), true, true);
     131    return getCount((TreeNode)Gatherer.c_man.getCollectionTreeModel().getRoot(), true, true);
    132132    }
    133133   
    134134    /** Calculates the number of documents in this collection. */
    135135    public int getDocumentCount() {
    136     return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), false, true);
     136    return getCount((TreeNode)Gatherer.c_man.getCollectionTreeModel().getRoot(), false, true);
    137137    }
    138138   
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r8813 r8846  
    704704
    705705
    706     /** Retrieve the record set (tree model) associated with the current collection. */
    707     public TreeModel getRecordSet() {
     706    /** Retrieve the tree model associated with the current collection. */
     707    public CollectionTreeModel getCollectionTreeModel()
     708    {
    708709    if (collection_model == null && collection != null) {
    709710        // Use the import directory to generate a new CollectionTreeModel
  • trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTree.java

    r8783 r8846  
    4747    public WorkspaceTree(String name)
    4848    {
    49     super(name, WorkspaceTreeModel.getWorkspaceTreeModel(), null, true);
     49    super(name, WorkspaceTreeModel.getWorkspaceTreeModel(), true);
    5050    }
    5151
  • trunk/gli/src/org/greenstone/gatherer/gui/EnrichPane.java

    r8813 r8846  
    5050import org.greenstone.gatherer.Dictionary;
    5151import org.greenstone.gatherer.Gatherer;
    52 import org.greenstone.gatherer.collection.CollectionManager;
     52import org.greenstone.gatherer.collection.CollectionTree;
    5353import org.greenstone.gatherer.collection.CollectionTreeNode;
    5454import org.greenstone.gatherer.gui.tree.DragTree;
     
    123123    private JTextField table_label;
    124124    /** A reference to the collection tree. */
    125     private DragTree collection_tree;
     125    private CollectionTree collection_tree;
    126126    /** Provide synchronization between the collection trees in this view and the collection pane view. */
    127127    private TreeSynchronizer collection_tree_sync = null;
     
    235235    /** Used to create, connect and layout the components to be shown on this control panel.
    236236     * @see org.greenstone.gatherer.Gatherer
    237      * @see org.greenstone.gatherer.collection.CollectionManager
    238237     * @see org.greenstone.gatherer.file.FileOpenActionListener
    239238     * @see org.greenstone.gatherer.gui.Filter
     
    253252
    254253    DragGroup group = new DragGroup();
    255     TreeModel collection_model = Gatherer.c_man.getRecordSet();
    256     if (collection_model != null) {
    257         collection_tree = new DragTree("Enrich", collection_model, null, false);
    258     }
    259     else {
    260         collection_tree = new DragTree("Enrich", null, false);
    261     }
     254    collection_tree = new CollectionTree("Enrich", Gatherer.c_man.getCollectionTreeModel(), false);
    262255    group.add(collection_tree);
    263256    collection_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
     
    456449        // Update collection tree
    457450        if (refresh_reason == Gatherer.COLLECTION_OPENED) {
    458         collection_tree.setModel(Gatherer.c_man.getRecordSet());
     451        collection_tree.setModel(Gatherer.c_man.getCollectionTreeModel());
    459452        }
    460453
  • trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java

    r8813 r8846  
    4848import org.greenstone.gatherer.Dictionary;
    4949import org.greenstone.gatherer.Gatherer;
     50import org.greenstone.gatherer.collection.CollectionTree;
    5051import org.greenstone.gatherer.collection.CollectionTreeNode;
    51 import org.greenstone.gatherer.collection.CollectionManager;
    5252import org.greenstone.gatherer.file.FileNode;
    5353import org.greenstone.gatherer.file.FileOpenActionListener;
     
    7373    private DragGroup group               =  null;
    7474    /** The tree showing the files within the collection. */
    75     private DragTree collection_tree         = null;
     75    private CollectionTree collection_tree = null;
    7676    /** The threaded queue that handles the actually movement of files, so that the gui remains responsive. */
    7777    private FileQueue file_queue          =  null;
     
    8080    /** The filter currently applied to the workspace tree. */
    8181    private Filter workspace_filter = null;
    82     /** The collection model which is used to build, and hold the data of, the collection tree. */
    83     private TreeModel collection    = null;
    8482    /** The button used to cancel all pending file queue jobs. */
    8583    private JButton stop_action        =  null;
     
    259257    Dictionary.registerText(collection_label, "Collection.No_Collection");
    260258
    261     collection = Gatherer.c_man.getRecordSet();
    262     if (collection != null) {
    263         collection_tree = new DragTree(Utility.COLLECTION_TREE, collection, null, true);
    264         collection_tree.setEnabled(true);
    265     }
    266     else {
    267         collection_tree = new DragTree(Utility.COLLECTION_TREE, null, true);
    268         collection_tree.setEnabled(false);
    269     }
     259    collection_tree = new CollectionTree(Utility.COLLECTION_TREE, Gatherer.c_man.getCollectionTreeModel(), true);
     260    collection_tree.setEnabled(Gatherer.c_man.getCollectionTreeModel() != null);
    270261    group.add(collection_tree);
    271262    collection_tree.addFocusListener(this);
     
    425416        // Update collection tree
    426417        if (refresh_reason == Gatherer.COLLECTION_OPENED) {
    427         collection_tree.setModel(Gatherer.c_man.getRecordSet());
     418        collection_tree.setModel(Gatherer.c_man.getCollectionTreeModel());
    428419        }
    429420
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java

    r8813 r8846  
    2222import org.greenstone.gatherer.util.Utility;
    2323
    24 public class DragTree
     24public abstract class DragTree
    2525    extends JTree
    2626    implements Autoscroll, DragGestureListener, DragSourceListener, DropTargetListener, DragComponent, TreeSelectionListener {
     
    6363
    6464
    65     public DragTree(String name, String background_name, boolean mixed_selection) {
    66     super();
    67     init(name, background_name, mixed_selection);
    68     }
    69 
    70     public DragTree(String name, TreeModel model, String background_name, boolean mixed_selection) {
     65    public DragTree(String name, TreeModel model, boolean mixed_selection)
     66    {
    7167    super(model);
    72     init(name, background_name, mixed_selection);
     68    init(name, mixed_selection);
     69
    7370    // Connection
    7471    setModel(model);
    7572    }
    7673
    77     public void init(String name, String background_name, boolean mixed_selection) {
     74    public void init(String name, boolean mixed_selection) {
    7875    if(NO_DRAG_CURSOR == null) {
    7976        NO_DRAG_CURSOR = DragSource.DefaultMoveNoDrop;
     
    8582    // Init
    8683    this.name = name;
    87     if(background_name != null) {
    88         this.disabled_background = new ImageIcon("background.gif");
    89         this.normal_background = new ImageIcon(background_name);
    90     }
    9184
    9285    // Creation
Note: See TracChangeset for help on using the changeset viewer.