Changeset 7505


Ignore:
Timestamp:
2004-05-31T14:47:49+12:00 (20 years ago)
Author:
mdewsnip
Message:

Preferences are now saved to file as soon as the OK button is pressed (in case the GLI crashes).

File:
1 edited

Legend:

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

    r7483 r7505  
    7474    private JCheckBox use_proxy_checkbox;
    7575    private JCheckBox view_extracted_metadata_checkbox;
    76     private JCheckBox workflow_browse;
    7776    private JCheckBox workflow_create;
    7877    private JCheckBox workflow_mirror;
     
    8180    private JCheckBox workflow_design;
    8281    private JCheckBox workflow_export;
    83     private JCheckBox workflow_preview;
    8482    private JComboBox language_combobox;
    8583    private JComboBox servlet_combobox; // GS3
     
    9290    private JLabel proxy_host_label;
    9391    private JLabel proxy_port_label;
    94     //private JLabel recursion_depth_label;
    9592    private JLabel title_label;
    9693    private JPanel servlet_pane;
     
    10097    private JRadioButton systems_mode_radio_button;
    10198    private JSpinner proxy_port_field;
    102     //private JSpinner recursion_depth_spinner;
    10399    private JTabbedPane tab_pane;
    104100    private JTextArea mode_description_textarea;
     
    461457    }
    462458
    463     // Recursion
    464     /*
    465     JPanel recursion_depth_pane = new JPanel();
    466     recursion_depth_label = new JLabel();
    467     recursion_depth_label.setPreferredSize(LABEL_SIZE);
    468     Dictionary.registerText(recursion_depth_label, "Preferences.General.Recursion_Depth");
    469     recursion_depth_spinner = new JSpinner(new SpinnerNumberModel(Gatherer.config.getInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC), 0, Integer.MAX_VALUE, 1));
    470     Dictionary.registerTooltip(recursion_depth_spinner, "Preferences.General.Recursion_Depth_Tooltip");
    471     */
    472 
    473459    // Connect
    474460    language_combobox.addActionListener(new LanguageComboboxListener());
     
    483469    language_pane.add(language_combobox, BorderLayout.CENTER);
    484470
    485     //recursion_depth_pane.setLayout(new BorderLayout());
    486     //recursion_depth_pane.add(recursion_depth_label, BorderLayout.WEST);
    487     //recursion_depth_pane.add(recursion_depth_spinner, BorderLayout.CENTER);
    488 
    489471    general_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    490472    general_pane.setLayout(new GridLayout(5,1,0,5));
    491473    general_pane.add(email_pane);
    492474    general_pane.add(language_pane);
    493     //general_pane.add(recursion_depth_pane);
    494475    general_pane.add(view_extracted_metadata_checkbox);
    495476    general_pane.add(show_file_size_checkbox);
     
    605586    Dictionary.registerText(title_label, "Preferences.Workflow.Title");
    606587
    607     workflow_browse = new JCheckBox();
    608     workflow_browse.setSelected(Gatherer.config.get("workflow.browse", false));
    609     workflow_browse.setPreferredSize(ROW_SIZE);
    610     Dictionary.registerText(workflow_browse, "Preferences.Workflow.Browse");
    611 
    612588    workflow_mirror = new JCheckBox();
    613589    workflow_mirror.setSelected(Gatherer.config.get("workflow.mirror", false));
     
    640616    Dictionary.registerText(workflow_create, "Preferences.Workflow.Create");
    641617
    642     workflow_preview = new JCheckBox();
    643     workflow_preview.setSelected(Gatherer.config.get("workflow.preview", false));
    644     workflow_preview.setPreferredSize(ROW_SIZE);
    645     Dictionary.registerText(workflow_preview, "Preferences.Workflow.Preview");
    646 
    647618    JPanel predefined_pane = new JPanel();
    648619    predefined_label = new JLabel();
     
    656627    checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS));
    657628    checklist_pane.add(title_label);
    658     if (Gatherer.config.get("workflow.browse", true)) {
    659         checklist_pane.add(workflow_browse);
    660     }
    661629    if (Gatherer.config.get("workflow.mirror", true)) {
    662630        checklist_pane.add(workflow_mirror);
     
    677645        checklist_pane.add(workflow_create);
    678646    }
    679     if (Gatherer.config.get("workflow.preview", true)) {
    680         checklist_pane.add(workflow_preview);
    681     }
     647
    682648    predefined_pane.setLayout(new BorderLayout(5,0));
    683649    predefined_pane.add(predefined_label, BorderLayout.WEST);
     
    754720        ClassifierManager.clearClassifierCache();
    755721        }
    756         //Gatherer.config.setInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC, ((Integer)recursion_depth_spinner.getValue()).intValue());
    757722
    758723        // Mode preferences
     
    793758
    794759        // Workflow preferences
    795         // Gatherer.config.set("workflow.browse", false, workflow_browse.isSelected());
    796760        // Gatherer.config.set("workflow.mirror", false, workflow_mirror.isSelected());
    797761        // Gatherer.config.set("workflow.gather", false, workflow_gather.isSelected());
     
    800764        // Gatherer.config.set("workflow.export", false, workflow_export.isSelected());
    801765        // Gatherer.config.set("workflow.create", false, workflow_create.isSelected());
    802         // Gatherer.config.set("workflow.preview", false, workflow_preview.isSelected());
    803         // Gatherer.g_man.workflowUpdate("Hunt", workflow_browse.isSelected());
    804766        // Gatherer.g_man.workflowUpdate("Mirror", workflow_mirror.isSelected());
    805767        // Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected());
     
    808770        // Gatherer.g_man.workflowUpdate("Export", workflow_export.isSelected());
    809771        // Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected());
    810         // Gatherer.g_man.workflowUpdate("Preview", workflow_preview.isSelected());
     772
     773        // Always save configuration changes immediately (in case the GLI crashes)
     774        Gatherer.config.save();
     775
    811776        // Hide dialog
    812777        if(close) {
     
    899864        }
    900865        public void run() {
    901         workflow_browse.setSelected(element.getEnabled("browse"));
    902866        workflow_create.setSelected(element.getEnabled("create"));
    903867        workflow_mirror.setSelected(element.getEnabled("mirror"));
     
    906870        workflow_design.setSelected(element.getEnabled("design"));
    907871        workflow_export.setSelected(element.getEnabled("export"));
    908         workflow_preview.setSelected(element.getEnabled("preview"));
    909872        }
    910873    }
Note: See TracChangeset for help on using the changeset viewer.