Changeset 10016


Ignore:
Timestamp:
2005-06-07T11:21:55+12:00 (19 years ago)
Author:
mdewsnip
Message:

Fixed a bug where the GLI would attempt to enable/disable non-existant tabs.

File:
1 edited

Legend:

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

    r10011 r10016  
    342342        tab_pane.setFont(Configuration.getFont("general.font", false));
    343343
    344         if(Configuration.get("workflow.download", true)) {
     344        if (Configuration.get("workflow.download", true)) {
    345345        download_pane = new DownloadPane();
    346346        // "GUI.Download_Tooltip" is used automatically
     
    351351        gather_pane = new GatherPane(collection_tree_sync);
    352352        gather_pane.display();
    353         if(Configuration.get("workflow.gather", true)) {
     353        if (Configuration.get("workflow.gather", true)) {
    354354        // "GUI.Gather_Tooltip" is used automatically
    355355        tab_pane.addTab("GUI.Gather", JarTools.getImage("gather.gif"), gather_pane);
     
    359359        enrich_pane = new EnrichPane(collection_tree_sync);
    360360        enrich_pane.display();
    361         if(Configuration.get("workflow.enrich", true)) {
     361        if (Configuration.get("workflow.enrich", true)) {
    362362        // "GUI.Enrich_Tooltip" is used automatically
    363363        tab_pane.addTab("GUI.Enrich", JarTools.getImage("enrich.gif"), enrich_pane);
     
    367367        design_pane = new DesignPane();
    368368        design_pane.display();
    369         if(Configuration.get("workflow.design", true)) {
     369        if (Configuration.get("workflow.design", true)) {
    370370        // "GUI.Design_Tooltip" is used automatically
    371371        tab_pane.addTab("GUI.Design", JarTools.getImage("design.gif"), design_pane);
     
    375375        create_pane = new CreatePane();
    376376        create_pane.display();
    377         if(Configuration.get("workflow.create", true)) {
     377        if (Configuration.get("workflow.create", true)) {
    378378        // "GUI.Create_Tooltip" is used automatically
    379379        tab_pane.addTab("GUI.Create", JarTools.getImage("create.gif"), create_pane);
     
    382382
    383383        // Select the collect pane if it is available
    384         if(Configuration.get("workflow.gather", false)) {
     384        if (tab_pane.indexOfComponent(gather_pane) != -1) {
    385385        tab_pane.setSelectedComponent(gather_pane);
    386386        }
    387387        // Otherwise find the first tab that is enabled and select that.
    388388        else {
    389         boolean found = false;
    390         for(int i = 0; !found && i < tab_pane.getTabCount(); i++) {
    391             if(tab_pane.isEnabledAt(i)) {
     389        for (int i = 0; i < tab_pane.getTabCount(); i++) {
     390            if (tab_pane.isEnabledAt(i)) {
    392391            tab_pane.setSelectedIndex(i);
    393             found = true;
     392            break;
    394393            }
    395394        }
     
    452451    /** This method is called when the collection is being built, and is used to disable all controls in all pane which could change the state of the collection.
    453452     */
    454     public void lockCollection(boolean import_stage, boolean lock) {
     453    public void lockCollection(boolean import_stage, boolean lock)
     454    {
    455455    locked = lock;
     456
    456457    if (import_stage) {
    457458        int gather_pos = tab_pane.indexOfComponent(gather_pane);
     459        if (gather_pos != -1) {
     460        tab_pane.setEnabledAt(gather_pos, !lock);
     461        }
    458462        int enrich_pos = tab_pane.indexOfComponent(enrich_pane);
    459         int design_pos = tab_pane.indexOfComponent(design_pane);
    460         tab_pane.setEnabledAt(gather_pos, !lock);
    461         tab_pane.setEnabledAt(enrich_pos, !lock);
     463        if (enrich_pos != -1) {
     464        tab_pane.setEnabledAt(enrich_pos, !lock);
     465        }
     466    }
     467
     468    int design_pos = tab_pane.indexOfComponent(design_pane);
     469    if (design_pos != -1) {
    462470        tab_pane.setEnabledAt(design_pos, !lock);
    463471    }
    464     else {
    465         int design_pos = tab_pane.indexOfComponent(design_pane);
    466         tab_pane.setEnabledAt(design_pos, !lock);
    467     }
    468     }
     472    }
     473
    469474
    470475    public void modeChanged(int mode) {
Note: See TracChangeset for help on using the changeset viewer.