- Timestamp:
- 2004-10-07T16:44:32+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r8212 r8231 190 190 program_label.setPreferredSize(LABEL_SIZE); 191 191 Dictionary.registerText(program_label, "Preferences.Connection.ProgramCommand"); 192 program_field = new JTextField( Gatherer.config.getPreviewCommand());192 program_field = new JTextField(Configuration.getPreviewCommand()); 193 193 program_field.setCaretPosition(0); 194 194 Dictionary.registerTooltip(program_field, "Preferences.Connection.ProgramCommand_Tooltip"); … … 198 198 library_path_label = new JLabel(); 199 199 library_path_label.setPreferredSize(LABEL_SIZE); 200 library_path_field = new JTextField( Gatherer.config.getString("general.exec_address", true));200 library_path_field = new JTextField(Configuration.getString("general.exec_address", true)); 201 201 library_path_field.setCaretPosition(0); 202 202 if (Gatherer.GS3) { … … 228 228 servlet_combobox = new JComboBox(); 229 229 // try to locate and select the current site 230 String this_site = Gatherer.config.site_name;230 String this_site = Configuration.site_name; 231 231 for(int b = 0; b < site_combobox.getItemCount(); b++) { 232 232 String entry = (String) site_combobox.getItemAt(b); … … 252 252 servlet_combobox.setEnabled(true); 253 253 // try to locate and select the current servlet 254 String this_servlet = Gatherer.config.getServletPath();254 String this_servlet = Configuration.getServletPath(); 255 255 for(int b = 0; b < servlet_combobox.getItemCount(); b++) { 256 256 String entry = (String) servlet_combobox.getItemAt(b); … … 264 264 } 265 265 266 boolean currently_enabled = Gatherer.config.get("general.use_proxy", true);266 boolean currently_enabled = Configuration.get("general.use_proxy", true); 267 267 // Creation 268 268 JPanel connection_pane = new JPanel(); … … 277 277 proxy_host_label.setPreferredSize(LABEL_SIZE); 278 278 Dictionary.registerText(proxy_host_label, "Preferences.Connection.Proxy_Host"); 279 proxy_host_field = new JTextField( Gatherer.config.getString("general.proxy_host", true));279 proxy_host_field = new JTextField(Configuration.getString("general.proxy_host", true)); 280 280 proxy_host_field.setEnabled(currently_enabled); 281 281 Dictionary.registerTooltip(proxy_host_field, "Preferences.Connection.Proxy_Host_Tooltip"); … … 285 285 proxy_port_label.setPreferredSize(LABEL_SIZE); 286 286 Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port"); 287 String port_value = Gatherer.config.getString("general.proxy_port", true);287 String port_value = Configuration.getString("general.proxy_port", true); 288 288 if(port_value.length() > 0) { 289 289 proxy_port_field = new JSpinner(new SpinnerNumberModel((new Integer(port_value)).intValue(), 0, 65535, 1)); … … 414 414 email_label.setPreferredSize(LABEL_SIZE); 415 415 Dictionary.registerText(email_label, "Preferences.General.Email"); 416 email_field = new EmailField( Gatherer.config.getColor("coloring.error_background", false));417 email_field.setText( Gatherer.config.getEmail());416 email_field = new EmailField(Configuration.getColor("coloring.error_background", false)); 417 email_field.setText(Configuration.getEmail()); 418 418 Dictionary.registerTooltip(email_field, "Preferences.General.Email_Tooltip"); 419 419 … … 421 421 view_extracted_metadata_checkbox = new JCheckBox(); 422 422 view_extracted_metadata_checkbox.setSelected(false); 423 if ( Gatherer.config.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {423 if (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) { 424 424 view_extracted_metadata_checkbox.setSelected(true); 425 425 } … … 429 429 show_file_size_checkbox = new JCheckBox(); 430 430 show_file_size_checkbox.setSelected(false); 431 if ( Gatherer.config.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) {431 if (Configuration.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) { 432 432 show_file_size_checkbox.setSelected(true); 433 433 } … … 442 442 Dictionary.registerTooltip(language_combobox, "Preferences.General.Interface_Language_Tooltip"); 443 443 // Try to locate and select the current language 444 String language_code = Gatherer.config.getLanguage();444 String language_code = Configuration.getLanguage(); 445 445 for(int b = 0; b < language_combobox.getItemCount(); b++) { 446 446 DictionaryEntry entry = (DictionaryEntry) language_combobox.getItemAt(b); … … 497 497 mode_description_textarea.setWrapStyleWord(true); 498 498 // Determine which value is already selected 499 switch( Gatherer.config.getMode()) {499 switch(Configuration.getMode()) { 500 500 case Configuration.ASSISTANT_MODE: 501 501 assistant_mode_radio_button.setSelected(true); … … 540 540 private JPanel createWarningPreferences() { 541 541 // Retrieve all of the warning preferences settings. 542 HashMap warning_preferences = Gatherer.config.getAll("warning\\..*", true);542 HashMap warning_preferences = Configuration.getAll("warning\\..*", true); 543 543 warning_preferences_check_list = new CheckList(false); 544 544 for(Iterator keys = warning_preferences.keySet().iterator(); keys.hasNext(); ) { … … 580 580 581 581 workflow_mirror = new JCheckBox(); 582 workflow_mirror.setSelected( Gatherer.config.get("workflow.mirror", false));582 workflow_mirror.setSelected(Configuration.get("workflow.mirror", false)); 583 583 workflow_mirror.setPreferredSize(ROW_SIZE); 584 584 Dictionary.registerText(workflow_mirror, "Preferences.Workflow.Mirror"); 585 585 586 586 workflow_gather = new JCheckBox(); 587 workflow_gather.setSelected( Gatherer.config.get("workflow.gather", false));587 workflow_gather.setSelected(Configuration.get("workflow.gather", false)); 588 588 workflow_gather.setPreferredSize(ROW_SIZE); 589 589 Dictionary.registerText(workflow_gather, "Preferences.Workflow.Gather"); 590 590 591 591 workflow_enrich = new JCheckBox(); 592 workflow_enrich.setSelected( Gatherer.config.get("workflow.enrich", false));592 workflow_enrich.setSelected(Configuration.get("workflow.enrich", false)); 593 593 workflow_enrich.setPreferredSize(ROW_SIZE); 594 594 Dictionary.registerText(workflow_enrich, "Preferences.Workflow.Enrich"); 595 595 596 596 workflow_design = new JCheckBox(); 597 workflow_design.setSelected( Gatherer.config.get("workflow.design", false));597 workflow_design.setSelected(Configuration.get("workflow.design", false)); 598 598 workflow_design.setPreferredSize(ROW_SIZE); 599 599 Dictionary.registerText(workflow_design, "Preferences.Workflow.Design"); 600 600 601 601 workflow_export = new JCheckBox(); 602 workflow_export.setSelected( Gatherer.config.get("workflow.export", false));602 workflow_export.setSelected(Configuration.get("workflow.export", false)); 603 603 workflow_export.setPreferredSize(ROW_SIZE); 604 604 Dictionary.registerText(workflow_export, "Preferences.Workflow.Export"); 605 605 606 606 workflow_create = new JCheckBox(); 607 workflow_create.setSelected( Gatherer.config.get("workflow.create", false));607 workflow_create.setSelected(Configuration.get("workflow.create", false)); 608 608 workflow_create.setPreferredSize(ROW_SIZE); 609 609 Dictionary.registerText(workflow_create, "Preferences.Workflow.Create"); … … 620 620 checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS)); 621 621 checklist_pane.add(title_label); 622 if ( Gatherer.config.get("workflow.mirror", true)) {622 if (Configuration.get("workflow.mirror", true)) { 623 623 checklist_pane.add(workflow_mirror); 624 624 } 625 if ( Gatherer.config.get("workflow.gather", true)) {625 if (Configuration.get("workflow.gather", true)) { 626 626 checklist_pane.add(workflow_gather); 627 627 } 628 if ( Gatherer.config.get("workflow.enrich", true)) {628 if (Configuration.get("workflow.enrich", true)) { 629 629 checklist_pane.add(workflow_enrich); 630 630 } 631 if ( Gatherer.config.get("workflow.design", true)) {631 if (Configuration.get("workflow.design", true)) { 632 632 checklist_pane.add(workflow_design); 633 633 } 634 if ( Gatherer.config.get("workflow.export", true)) {634 if (Configuration.get("workflow.export", true)) { 635 635 checklist_pane.add(workflow_export); 636 636 } 637 if ( Gatherer.config.get("workflow.create", true)) {637 if (Configuration.get("workflow.create", true)) { 638 638 checklist_pane.add(workflow_create); 639 639 } … … 665 665 program_str = program_str + " %1"; 666 666 } 667 Gatherer.config.setPreviewCommand(program_str);667 Configuration.setPreviewCommand(program_str); 668 668 669 669 String library_path_string = library_path_field.getText(); 670 Gatherer.config.setString("general.exec_address", true, library_path_string);670 Configuration.setString("general.exec_address", true, library_path_string); 671 671 if (!library_path_string.equals("")) { 672 672 try { 673 Gatherer.config.exec_address = new URL(library_path_string);673 Configuration.exec_address = new URL(library_path_string); 674 674 } 675 675 catch (MalformedURLException error) { … … 679 679 boolean site_changed = false; 680 680 if (Gatherer.GS3) { 681 String current_site = Gatherer.config.site_name;681 String current_site = Configuration.site_name; 682 682 String new_site =(String)site_combobox.getSelectedItem() ; 683 683 if (!new_site.equals(current_site)) { 684 684 site_changed = true; 685 685 } 686 Gatherer.config.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem());686 Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem()); 687 687 } 688 688 689 Gatherer.config.set("general.use_proxy", true, use_proxy_checkbox.isSelected());690 Gatherer.config.setString("general.proxy_host", true, proxy_host_field.getText());691 Gatherer.config.setString("general.proxy_port", true, proxy_port_field.getValue() + "");689 Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected()); 690 Configuration.setString("general.proxy_host", true, proxy_host_field.getText()); 691 Configuration.setString("general.proxy_port", true, proxy_port_field.getValue() + ""); 692 692 Gatherer.setProxy(); 693 693 694 694 // General preferences 695 Gatherer.config.setEmail(email_field.getText());696 697 Gatherer.config.set("general.show_file_size", Configuration.COLLECTION_SPECIFIC, show_file_size_checkbox.isSelected());695 Configuration.setEmail(email_field.getText()); 696 697 Configuration.set("general.show_file_size", Configuration.COLLECTION_SPECIFIC, show_file_size_checkbox.isSelected()); 698 698 // Force both workspace and collection trees to redraw 699 699 if (Gatherer.g_man != null) { … … 702 702 } 703 703 704 Gatherer.config.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());704 Configuration.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected()); 705 705 Gatherer.g_man.enrich_pane.valueChanged((TreeSelectionEvent) null); // Refresh metadata table 706 706 707 String current_lang = Gatherer.config.getLanguage();707 String current_lang = Configuration.getLanguage(); 708 708 String new_lang = ((DictionaryEntry)language_combobox.getSelectedItem()).getLocale().getLanguage(); 709 709 if (!current_lang.equals(new_lang)) { 710 Gatherer.config.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry)language_combobox.getSelectedItem()).getLocale());710 Configuration.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry)language_combobox.getSelectedItem()).getLocale()); 711 711 // delete the plugins and classifiers.dat files 712 712 PlugInManager.clearPlugInCache(); … … 715 715 716 716 // Mode preferences 717 int current_mode = Gatherer.config.getMode();717 int current_mode = Configuration.getMode(); 718 718 int new_mode; 719 719 if(assistant_mode_radio_button.isSelected()) { … … 731 731 // If there has been a change in modes, update the config, and also inform the persistant gui views that have a need to know 732 732 if(new_mode != current_mode) { 733 Gatherer.config.setMode(new_mode);733 Configuration.setMode(new_mode); 734 734 Collection collection = Gatherer.c_man.getCollection(); 735 735 if (collection != null) { … … 741 741 for(int i = 0; i < warning_preferences_check_list.getEntryCount(); i++) { 742 742 Entry entry = warning_preferences_check_list.get(i); 743 Gatherer.config.set(entry.getProperty(), true, entry.isSelected());743 Configuration.set(entry.getProperty(), true, entry.isSelected()); 744 744 } 745 745 … … 751 751 752 752 // Workflow preferences 753 // Gatherer.config.set("workflow.mirror", false, workflow_mirror.isSelected());754 // Gatherer.config.set("workflow.gather", false, workflow_gather.isSelected());755 // Gatherer.config.set("workflow.enrich", false, workflow_enrich.isSelected());756 // Gatherer.config.set("workflow.design", false, workflow_design.isSelected());757 // Gatherer.config.set("workflow.export", false, workflow_export.isSelected());758 // Gatherer.config.set("workflow.create", false, workflow_create.isSelected());753 // Configuration.set("workflow.mirror", false, workflow_mirror.isSelected()); 754 // Configuration.set("workflow.gather", false, workflow_gather.isSelected()); 755 // Configuration.set("workflow.enrich", false, workflow_enrich.isSelected()); 756 // Configuration.set("workflow.design", false, workflow_design.isSelected()); 757 // Configuration.set("workflow.export", false, workflow_export.isSelected()); 758 // Configuration.set("workflow.create", false, workflow_create.isSelected()); 759 759 // Gatherer.g_man.workflowUpdate("Mirror", workflow_mirror.isSelected()); 760 760 // Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected()); 761 761 // Gatherer.g_man.workflowUpdate("Enrich", workflow_enrich.isSelected()); 762 // Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE));762 // Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Configuration.getMode() > Configuration.ASSISTANT_MODE)); 763 763 // Gatherer.g_man.workflowUpdate("Export", workflow_export.isSelected()); 764 764 // Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected()); 765 765 766 766 // Always save configuration changes immediately (in case the GLI crashes) 767 Gatherer.config.save();767 Configuration.save(); 768 768 769 769 // Hide dialog … … 903 903 public void actionPerformed(ActionEvent event) { 904 904 boolean enabled = use_proxy_checkbox.isSelected(); 905 Gatherer.config.set("general.use_proxy", true, enabled);905 Configuration.set("general.use_proxy", true, enabled); 906 906 // Fortunately this is already driven by the event thread. 907 907 proxy_host_field.setEnabled(enabled);
Note:
See TracChangeset
for help on using the changeset viewer.