Changeset 11626


Ignore:
Timestamp:
2006-04-07T14:43:27+12:00 (18 years ago)
Author:
mdewsnip
Message:

Now there is only one collection tree, and it is added/removed from the Gather/Enrich panes as necessary. This will save a lot of time (previously all operations on one tree had to be duplicated on the other) and memory.

Location:
trunk/gli/src/org/greenstone/gatherer/gui
Files:
3 edited

Legend:

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

    r11622 r11626  
    7070    /** The label at the top of the collection tree, which shows the collection name. */
    7171    private JLabel collection_label;
     72    /** The panel that contains the collection tree. */
     73    private JPanel collection_pane = null;
     74    /** The scrollable area into which the collection tree is placed. */
     75    private JScrollPane collection_scroll = null;
    7276    /** The splitpane dividing the collection tree and the metadata editing controls. */
    7377    private JSplitPane external_split;
     
    116120    {
    117121    // Creation
    118     JPanel collection_pane = new JPanel(new BorderLayout());
     122    collection_pane = new JPanel(new BorderLayout());
    119123    collection_pane.setMinimumSize(MINIMUM_SIZE);
    120124    collection_pane.setPreferredSize(COLLECTION_TREE_SIZE);
     
    127131
    128132    DragGroup group = new DragGroup();
    129     collection_tree = new CollectionTree(Gatherer.c_man.getCollectionTreeModel(), false);
     133    collection_tree = Gatherer.g_man.gather_pane.collection_tree;
    130134    group.add(collection_tree);
    131135    collection_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    132136    collection_tree.addTreeSelectionListener(this);
    133     JScrollPane collection_scroll = new JScrollPane(collection_tree);
    134137    collection_filter = collection_tree.getFilter();
    135138
     
    141144    // Collection Pane
    142145    collection_pane.add(collection_label, BorderLayout.NORTH);
    143     collection_pane.add(collection_scroll, BorderLayout.CENTER);
    144     collection_pane.add(collection_filter, BorderLayout.SOUTH);
    145146
    146147    JSplitPane metadata_editing_pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
     
    168169        return;
    169170    }
     171
     172    // Add the collection tree and filter back into this pane
     173    collection_scroll = new JScrollPane(collection_tree);
     174    collection_pane.add(collection_scroll, BorderLayout.CENTER);
     175    collection_pane.add(collection_filter, BorderLayout.SOUTH);
    170176
    171177    // Select the first node in the tree if nothing is already selected
     
    191197    // Upload the modified metadata.xml files to the server now, if we're using one
    192198    MetadataXMLFileManager.uploadModifiedMetadataXMLFiles();
     199
     200    // Remove the collection tree and filter from this pane so it can be added to the Gather pane
     201    collection_pane.remove(collection_scroll);
     202    collection_pane.remove(collection_filter);
    193203    }
    194204
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r11624 r11626  
    768768    // Tell the previous pane that it has lost focus
    769769    if (previous_pane != null) {
    770         if (previous_pane == enrich_pane) {
     770        if (previous_pane == gather_pane) {
     771        gather_pane.loseFocus();
     772        }
     773        else if (previous_pane == enrich_pane) {
    771774        enrich_pane.loseFocus();
    772775        }
  • trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java

    r11622 r11626  
    7676    private DragGroup group               =  null;
    7777    /** The tree showing the files within the collection. */
    78     private CollectionTree collection_tree = null;
     78    public CollectionTree collection_tree = null;
    7979    /** The threaded queue that handles the actually movement of files, so that the gui remains responsive. */
    8080    private FileQueue file_queue          =  null;
     
    237237    collection_tree.setEnabled(Gatherer.c_man.getCollectionTreeModel() != null);
    238238    group.add(collection_tree);
    239     collection_scroll = new JScrollPane(collection_tree);
    240239    collection_filter = collection_tree.getFilter();
    241240
     
    271270    collection_pane.setLayout(new BorderLayout());
    272271    collection_pane.add(collection_label, BorderLayout.NORTH);
    273     collection_pane.add(collection_scroll, BorderLayout.CENTER);
    274     collection_pane.add(collection_filter, BorderLayout.SOUTH);
    275272
    276273    tree_pane.add(workspace_pane, JSplitPane.LEFT);
     
    307304    /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab.
    308305     */
    309     public void gainFocus() {
     306    public void gainFocus()
     307    {
     308    // Add the collection tree and filter back into this pane
     309    collection_scroll = new JScrollPane(collection_tree);
     310    collection_pane.add(collection_scroll, BorderLayout.CENTER);
     311    collection_pane.add(collection_filter, BorderLayout.SOUTH);
     312
    310313    // Update the meta-audit view to show the current selection, if any.
    311314    Gatherer.g_man.meta_audit.setRecords(getCollectionTreeSelection());
     315    }
     316
     317
     318    /** Called to inform this pane that it has just lost focus as an effect of the user clicking on another tab
     319     */
     320    public void loseFocus()
     321    {
     322    // Remove the collection tree and filter from this pane so it can be added to the Enrich pane
     323    collection_pane.remove(collection_scroll);
     324    collection_pane.remove(collection_filter);
    312325    }
    313326
Note: See TracChangeset for help on using the changeset viewer.