Changeset 6145


Ignore:
Timestamp:
2003-12-08T14:19:24+13:00 (20 years ago)
Author:
jmt12
Message:

Changed how a collection name appears. It now displays the collection title, followed by the shorter filename in curved brackets. Also added methods for changing the frame title from outside g_man

File:
1 edited

Legend:

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

    r6051 r6145  
    6868import org.greenstone.gatherer.gui.OpenCollectionDialog;
    6969import org.greenstone.gatherer.gui.Preferences;
    70 import org.greenstone.gatherer.gui.PreviewPane;
     70//import org.greenstone.gatherer.gui.PreviewPane;
    7171import org.greenstone.gatherer.gui.SimpleOpenCollectionDialog;
    7272import org.greenstone.gatherer.gui.metaaudit.MetaAuditFrame;
     
    7777import org.greenstone.gatherer.msm.Metadata;
    7878import org.greenstone.gatherer.shell.GShell;
     79import org.greenstone.gatherer.util.StaticStrings;
    7980import org.greenstone.gatherer.util.TreeSynchronizer;
    8081import org.greenstone.gatherer.util.Utility;
     
    105106    public MirrorPane mirror_pane = null;
    106107    /** The preview pane contains a preview of your build collection. */
    107     public PreviewPane preview_pane = null;
     108    //public PreviewPane preview_pane = null;
    108109    /** Are certain panes currently locked? */
    109110    private boolean locked = false;
     
    374375        SwingUtilities.invokeLater(tab_updater);
    375376    }
    376     // Finally display the collection name in the title bar.
     377    // Set the title
     378    String collection_title = null;
     379    String collection_name = null;
    377380    if (ready) {
    378         this.setTitle(Utility.PROGRAM_NAME + ":\"" + Gatherer.c_man.getCollection().getTitle() + "\"");
    379     }
    380     else {
    381         this.setTitle(Utility.PROGRAM_NAME + ": " + Dictionary.get("Collection.No_Collection"));
    382     }
     381        Collection collection = Gatherer.c_man.getCollection();
     382        collection_title = collection.getTitle();
     383        collection_name = collection.getName();
     384        collection = null;
     385    }
     386    setTitle(collection_title, collection_name);
     387    collection_title = null;
     388    collection_name = null;
    383389    // Now is a good time to force a garbage collect.
    384390    ///ystem.err.println("Calling garbage collection.");
     
    395401    try {
    396402        this.setSize(size);
    397         if(Gatherer.c_man.ready()) {
    398         this.setTitle(Utility.PROGRAM_NAME + ":\"" + Gatherer.c_man.getCollection().getTitle() + "\"");
    399         }
    400         else {
    401         this.setTitle(Utility.PROGRAM_NAME + ": " + Dictionary.get("Collection.No_Collection"));
    402         }
     403
     404        // Set the title
     405        String collection_title = null;
     406        String collection_name = null;
     407        if (Gatherer.c_man.ready()) {
     408        Collection collection = Gatherer.c_man.getCollection();
     409        collection_title = collection.getTitle();
     410        collection_name = collection.getName();
     411        collection = null;
     412        }
     413        setTitle(collection_title, collection_name);
     414        collection_title = null;
     415        collection_name = null;
     416
    403417        // Pretty corner icon
    404418        this.setIconImage(Utility.getImage("gatherer_small.gif").getImage());
     
    461475        }
    462476
    463         preview_pane = new PreviewPane();
    464         preview_pane.display();
    465         if(Gatherer.config.get("workflow.preview", true)) {
    466         tab_pane.addTab("GUI.Preview", Utility.getImage("final.gif"), preview_pane);
    467         tab_pane.setEnabledAt(tab_pane.indexOfComponent(preview_pane), false);
    468         }
     477        //preview_pane = new PreviewPane();
     478        //preview_pane.display();
     479        //if(Gatherer.config.get("workflow.preview", true)) {
     480        //tab_pane.addTab("GUI.Preview", Utility.getImage("final.gif"), preview_pane);
     481        //tab_pane.setEnabledAt(tab_pane.indexOfComponent(preview_pane), false);
     482        //}
    469483
    470484        // Find the first tab that is enabled and select that.
     
    559573        // Some tabs are also dependant on if a collection is ready
    560574        Component component = tab_pane.getComponentAt(index);
    561         if(component == preview_pane) {
    562         tab_pane.setEnabledAt(index, state && Gatherer.c_man != null && Gatherer.c_man.ready() && Gatherer.c_man.built());
    563         }
    564         else if(component == metaedit_pane || component == config_pane || component == export_pane || component == create_pane) {
     575        //if(component == preview_pane) {
     576        //tab_pane.setEnabledAt(index, state && Gatherer.c_man != null && Gatherer.c_man.ready() && Gatherer.c_man.built());
     577        //}
     578        //else
     579        if(component == metaedit_pane || component == config_pane || component == export_pane || component == create_pane) {
    565580        tab_pane.setEnabledAt(index, state && Gatherer.c_man != null && Gatherer.c_man.ready());
    566581        }
     
    587602        collection_pane.refreshWorkspaceTree(WorkspaceTree.MAPPED_DIRECTORIES_CHANGED);
    588603    }
     604    }
     605
     606    /** Change the string shown in the title bar of the main gui frame. If either value is null, the 'No Collection' string is shown instead.
     607     * @param title
     608     * @param name
     609     */
     610    public void setTitle(String title, String name) {
     611    // Finally display the collection name in the title bar.
     612    StringBuffer title_buffer = new StringBuffer(Utility.PROGRAM_NAME);
     613    title_buffer.append(StaticStrings.COLON_CHARACTER);
     614    title_buffer.append(StaticStrings.SPACE_CHARACTER);
     615    if (title != null && name != null) {
     616        title_buffer.append(title);
     617        title_buffer.append(StaticStrings.SPACE_CHARACTER);
     618        title_buffer.append(StaticStrings.OPEN_PARENTHESIS_CHARACTER);
     619        title_buffer.append(name);
     620        title_buffer.append(StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
     621    }
     622    else {
     623        title_buffer.append(Dictionary.get("Collection.No_Collection"));
     624    }
     625    this.setTitle(title_buffer.toString());
     626    title_buffer = null;
    589627    }
    590628
     
    796834        create_pane.gainFocus();
    797835    }
    798     else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(preview_pane)) {
    799         config_pane.saveConfiguration();
    800         preview_pane.gainFocus();
    801     }
     836    //else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(preview_pane)) {
     837    //config_pane.saveConfiguration();
     838    //preview_pane.gainFocus();
     839    //}
    802840
    803841    previous_pane = (JPanel) tab_pane.getSelectedComponent();
Note: See TracChangeset for help on using the changeset viewer.