Changeset 6395


Ignore:
Timestamp:
2004-01-09T15:18:06+13:00 (20 years ago)
Author:
jmt12
Message:

Introduced the idea of detail modes - these have an effect on several parts of the gui, such as disabling or hiding all regular expression based controls, simplifying the output from perl scripts and (having been given yet another new last minute feature to implement) displays a completely different create pane. Mode is stored in the config.xml and is changable via the Preferences controls

File:
1 edited

Legend:

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

    r6318 r6395  
    4444import javax.swing.event.*;
    4545import javax.swing.tree.*;
     46import org.greenstone.gatherer.Configuration;
    4647import org.greenstone.gatherer.Dictionary;
    4748import org.greenstone.gatherer.Gatherer;
     
    8283    /** The collection model which is used to build, and hold the data of, the collection tree. */
    8384    private TreeModel collection    = null;
    84     /** The GTree model used as the data source for the workspace tree. */
     85    /** The Tree model used as the data source for the workspace tree. */
    8586    private TreeModel workspace       =  null;
    8687    /** The button used to cancel all pending file queue jobs. */
     
    241242    collection_tree.setEnabled(ready);
    242243    collection_filter.setEnabled(ready);
     244    collection_filter.setEditable(Gatherer.config.getMode() > Configuration.LIBRARIAN_MODE);
    243245    Dictionary.registerTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip");
    244246
     
    294296    workspace_filter = Gatherer.g_man.getFilter(workspace_tree);
    295297    workspace_filter.setBackground(Gatherer.config.getColor("coloring.workspace_heading_background", false));
    296     // Change the default colours of this filters combobox.
    297     GComboBox fcb = workspace_filter.getComboBox();
    298     fcb.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable_background", false));
    299     fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    300     fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
    301     fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    302     Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip");
    303     fcb = null;
     298    workspace_filter.setEditable(Gatherer.config.getMode() > Configuration.LIBRARIAN_MODE);
     299    Dictionary.registerTooltip(workspace_filter.getComboBox(), "Collection.Filter_Tooltip");
    304300
    305301    // Collection Tree
     
    348344        collection_filter.setBackground(Color.lightGray);
    349345    }
    350     // Change the default colours of this filters combobox.
    351     fcb = collection_filter.getComboBox();
    352     fcb.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable_background", false));
    353     fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.collection_tree_foreground", false));
    354     fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
    355     fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    356     fcb = null;
     346    // Add a tool tip
     347    Dictionary.registerTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip");
    357348
    358349    tree_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     
    462453    }
    463454
    464     /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab.
    465      * @see org.greenstone.gatherer.tree.GTree
    466     */
    467     public void gainFocus() {
     455    /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab.
     456     * @see org.greenstone.gatherer.gui.tree.DragTree
     457    */
     458    public void gainFocus() {
    468459    // Update the menubar's idea of whats been selected
    469460    if (collection_tree != null) {
    470         if (collection_tree.isSelectionEmpty()) {
     461        if (collection_tree.isSelectionEmpty()) {
    471462        Gatherer.g_man.menu_bar.setMetaAuditSuffix(null);
    472         }
    473         else {
     463        }
     464        else {
    474465        Gatherer.g_man.menu_bar.setMetaAuditSuffix(collection_tree.getSelectionDetails());
    475         }
     466        }
    476467    }
    477468    // Update the meta-audit view to show the current selection, if any.
    478469    Gatherer.g_man.meta_audit.setRecords(getSelected());
    479     }
    480 
    481     /** Retrieve a list of the currently selected file records in the active tree. */
    482     public FileNode[] getSelected() {
     470    }
     471   
     472    /** Retrieve a list of the currently selected file records in the active tree. */
     473    public FileNode[] getSelected() {
    483474    TreePath paths[] = collection_tree.getSelectionPaths();
    484475    FileNode records[] = null;
    485476    if(paths != null) {
    486         records = new FileNode[paths.length];
    487         for(int i = 0; i < records.length; i++) {
     477        records = new FileNode[paths.length];
     478        for(int i = 0; i < records.length; i++) {
    488479        records[i] = (FileNode) paths[i].getLastPathComponent();
    489         }
     480        }
    490481    }
    491482    return records;
    492     }
    493 
    494     public String getSelectionDetails() {
     483    }
     484   
     485    public String getSelectionDetails() {
    495486    return collection_tree.getSelectionDetails();
    496     }
    497 
    498 
    499     public void refreshCollectionTree(int refresh_reason)
    500     {
     487    }
     488   
     489    /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching)
     490     * @param mode the mode level as an int
     491     */
     492    public void modeChanged(int mode) {
     493    collection_filter.setEditable(mode > Configuration.LIBRARIAN_MODE);
     494    workspace_filter.setEditable(mode > Configuration.LIBRARIAN_MODE);
     495    }
     496
     497    public void refreshCollectionTree(int refresh_reason) {
    501498    collection_tree.refresh(null);
    502     }
    503 
    504 
    505     public void refreshWorkspaceTree(int refresh_reason)
    506     {
     499    }
     500   
     501
     502    public void refreshWorkspaceTree(int refresh_reason) {
    507503    workspace_tree.refresh(refresh_reason);
    508     }
    509 
    510 
     504    }
     505   
     506   
    511507    /** Used to set the enabled state, and hence the colouring, of the two tree labels.
    512508     * @param label The <strong>JLabel</strong> to be affected.
Note: See TracChangeset for help on using the changeset viewer.