Ignore:
Timestamp:
2004-10-18T11:50:18+13:00 (20 years ago)
Author:
mdewsnip
Message:

Changed the collectionChanged() functions to refresh(), and added an extra parameter for more control over refreshing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/EnrichPane.java

    r8313 r8353  
    5050import org.greenstone.gatherer.Dictionary;
    5151import org.greenstone.gatherer.Gatherer;
     52import org.greenstone.gatherer.collection.CollectionManager;
    5253import org.greenstone.gatherer.file.FileNode;
    5354import org.greenstone.gatherer.gui.tree.DragTree;
     
    230231
    231232
    232     /** Called whenever a significant change has occured in the state of the currently loaded collection.
    233      * @param ready <i>true</i> if there is a collection currently ready to be editing, <i>false</i> otherwise.
    234      * @see org.greenstone.gatherer.collection.CollectionManager
    235      * @see org.greenstone.gatherer.util.TreeSynchronizer
    236      */
    237     public void collectionChanged(boolean ready)
    238     {
    239     if (ready) {
    240         // System.err.println("In collectionChanged(true).");
    241         TreeModel collection_model = Gatherer.c_man.getRecordSet();
    242         Dictionary.registerText(collection_label, "Collection.Collection");
    243 
    244         // Update label coloring.
    245         collection_label.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
    246         collection_label.setForeground(Configuration.getColor("coloring.collection_heading_foreground", false));
    247         collection_tree.setModel(collection_model);
    248 
    249         // Update tree coloring.
    250         collection_tree.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
    251         collection_tree.setForeground(Configuration.getColor("coloring.collection_tree_foreground", false));
    252     }
    253     else {
    254         Dictionary.registerText(collection_label, "Collection.No_Collection");
    255         collection_label.setBackground(Color.lightGray);
    256         collection_label.setForeground(Color.black);
    257         collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode(Dictionary.get("Collection.No_Collection"))));
    258     }
    259 
    260     filter.setEnabled(ready);
    261     // Ensure that this collection tree view is synchronized with any others.
    262     tree_sync.add(collection_tree);
    263     }
    264 
    265 
    266233    /** Used to create, connect and layout the components to be shown on this control panel.
    267234     * @see org.greenstone.gatherer.Gatherer
     
    453420    // Select the first node in the tree if nothing is already selected
    454421    if (collection_tree.getSelectionPaths() == null) {
    455         System.err.println("Nothing selected... selecting first tree node.");
    456422        collection_tree.setImmediate(true);
    457423        collection_tree.setSelectionRow(0);
     
    470436    {
    471437    filter.setEditable(mode > Configuration.LIBRARIAN_MODE);
     438    }
     439
     440
     441    public void refresh(int refresh_reason, boolean ready)
     442    {
     443    System.err.println("In EnrichPane.collectionChanged(" + ready + ")...");
     444    if (ready) {
     445        TreeModel collection_model = Gatherer.c_man.getRecordSet();
     446        Dictionary.registerText(collection_label, "Collection.Collection");
     447
     448        // Update label coloring.
     449        collection_label.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
     450        collection_label.setForeground(Configuration.getColor("coloring.collection_heading_foreground", false));
     451        collection_tree.setModel(collection_model);
     452
     453        // Update tree coloring.
     454        collection_tree.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
     455        collection_tree.setForeground(Configuration.getColor("coloring.collection_tree_foreground", false));
     456    }
     457    else {
     458        Dictionary.registerText(collection_label, "Collection.No_Collection");
     459        collection_label.setBackground(Color.lightGray);
     460        collection_label.setForeground(Color.black);
     461        collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode(Dictionary.get("Collection.No_Collection"))));
     462    }
     463
     464    filter.setEnabled(ready);
     465    // Ensure that this collection tree view is synchronized with any others.
     466    tree_sync.add(collection_tree);
    472467    }
    473468
Note: See TracChangeset for help on using the changeset viewer.