Changeset 12118
- Timestamp:
- 2006-07-10T14:48:26+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r11662 r12118 75 75 private JCheckBox workflow_design; 76 76 private JCheckBox workflow_create; 77 private JCheckBox workflow_format; 77 78 private JComboBox language_combobox; 78 79 private JComboBox servlet_combobox; // GS3 … … 103 104 this.self = this; 104 105 setSize(SIZE); 105 Dictionary.registerText(this, "Preferences");106 setTitle(Dictionary.get("Preferences")); 106 107 setJMenuBar(new SimpleMenuBar("preferences")); 107 108 … … 110 111 tab_pane = new JTabbedPane(); 111 112 JPanel general_preferences = createGeneralPreferences(); 112 tab_pane.add ("Preferences.General", general_preferences); // Also uses "Preferences.General_Tooltip"113 tab_pane.add ("Preferences.Mode", createModePreferences()); // Also uses "Preferences.Mode_Tooltip"114 tab_pane.add ("Preferences.Workflow", createWorkflowPreferences()); // Also uses "Preferences.Workflow_Tooltip"113 tab_pane.addTab(Dictionary.get("Preferences.General"), null, general_preferences, Dictionary.get("Preferences.General_Tooltip")); 114 tab_pane.addTab(Dictionary.get("Preferences.Mode"), null, createModePreferences(), Dictionary.get("Preferences.Mode_Tooltip")); 115 tab_pane.addTab(Dictionary.get("Preferences.Workflow"), null, createWorkflowPreferences(), Dictionary.get("Preferences.Workflow_Tooltip")); 115 116 JPanel connection_preferences = createConnectionPreferences(); 116 tab_pane.add("Preferences.Connection", connection_preferences); // Also uses "Preferences.Connection_Tooltip" 117 tab_pane.add("Preferences.Warnings", createWarningPreferences()); // Also uses "Preferences.Warnings_Tooltip" 118 Dictionary.register(tab_pane); 119 117 tab_pane.addTab(Dictionary.get("Preferences.Connection"), null, connection_preferences, Dictionary.get("Preferences.Connection_Tooltip")); 118 tab_pane.addTab(Dictionary.get("Preferences.Warnings"), null, createWarningPreferences(), Dictionary.get("Preferences.Warnings_Tooltip")); 119 120 120 JPanel button_pane = new JPanel(); 121 ok_button = new GLIButton(); 122 ok_button.setMnemonic(KeyEvent.VK_O); 123 Dictionary.registerBoth(ok_button, "General.OK", "General.OK_Tooltip"); 124 apply_button = new GLIButton(); 125 apply_button.setMnemonic(KeyEvent.VK_A); 126 Dictionary.registerBoth(apply_button, "General.Apply", "General.Apply_Tooltip"); 127 cancel_button = new GLIButton(); 128 cancel_button.setMnemonic(KeyEvent.VK_C); 129 Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 130 121 ok_button = new GLIButton(Dictionary.get("General.OK"), Dictionary.get("General.OK_Tooltip")); 122 123 apply_button = new GLIButton(Dictionary.get("General.Apply"), Dictionary.get("General.Apply_Tooltip")); 124 125 cancel_button = new GLIButton(Dictionary.get("General.Cancel"), Dictionary.get("General.Cancel_Tooltip")); 126 131 127 // Connection 132 128 ok_button.addActionListener(new OKButtonListener(true)); … … 174 170 JPanel program_pane = new JPanel(); 175 171 program_pane.setPreferredSize(ROW_SIZE); 176 JLabel program_label = new JLabel( );172 JLabel program_label = new JLabel(Dictionary.get("Preferences.Connection.ProgramCommand")); 177 173 program_label.setPreferredSize(LABEL_SIZE); 178 Dictionary.registerText(program_label, "Preferences.Connection.ProgramCommand");174 179 175 program_field = new JTextField(Configuration.getPreviewCommand()); 180 176 program_field.setCaretPosition(0); 181 Dictionary.registerTooltip(program_field, "Preferences.Connection.ProgramCommand_Tooltip");182 177 program_field.setToolTipText(Dictionary.get("Preferences.Connection.ProgramCommand_Tooltip")); 178 183 179 JPanel library_path_pane = new JPanel(); 184 180 library_path_pane.setPreferredSize(ROW_SIZE); … … 192 188 library_path_field.setCaretPosition(0); 193 189 if (Gatherer.GS3) { 194 Dictionary.registerText(library_path_label, "Preferences.Connection.Library_Path_GS3");195 Dictionary.registerTooltip(library_path_field, "Preferences.Connection.Library_Path_Tooltip_GS3");190 library_path_label.setText(Dictionary.get("Preferences.Connection.Library_Path_GS3")); 191 library_path_field.setToolTipText(Dictionary.get("Preferences.Connection.Library_Path_Tooltip_GS3")); 196 192 } else { 197 Dictionary.registerText(library_path_label, "Preferences.Connection.Library_Path"); 198 Dictionary.registerTooltip(library_path_field, "Preferences.Connection.Library_Path_Tooltip"); 199 } 193 library_path_label.setText(Dictionary.get("Preferences.Connection.Library_Path")); 194 library_path_field.setToolTipText(Dictionary.get("Preferences.Connection.Library_Path_Tooltip")); 195 } 196 200 197 // Disable this field when using the applet, as it is automatically determined 201 198 library_path_label.setEnabled(!Gatherer.isApplet); … … 207 204 gliserver_url_pane = new JPanel(); 208 205 gliserver_url_pane.setPreferredSize(ROW_SIZE); 209 gliserver_url_label = new JLabel( );206 gliserver_url_label = new JLabel(Dictionary.get("Preferences.Connection.GLIServer_URL")); 210 207 gliserver_url_label.setPreferredSize(LABEL_SIZE); 211 208 String gliserver_url_string = ""; … … 215 212 gliserver_url_field = new JTextField(gliserver_url_string); 216 213 gliserver_url_field.setCaretPosition(0); 217 Dictionary.registerText(gliserver_url_label, "Preferences.Connection.GLIServer_URL"); 218 Dictionary.registerTooltip(gliserver_url_field, "Preferences.Connection.GLIServer_URL_Tooltip"); 219 214 gliserver_url_field.setToolTipText(Dictionary.get("Preferences.Connection.GLIServer_URL_Tooltip")); 215 220 216 // Disable this field when using the applet, as it is automatically determined 221 217 gliserver_url_label.setEnabled(!Gatherer.isApplet); … … 230 226 site_pane = new JPanel(); 231 227 site_pane.setPreferredSize(ROW_SIZE); 232 site_label = new JLabel(); 233 Dictionary.registerText(site_label, "Preferences.Connection.Site"); 228 site_label = new JLabel(Dictionary.get("Preferences.Connection.Site")); 234 229 site_label.setPreferredSize(LABEL_SIZE); 235 230 // what should we do if Gatherer.servlet_config.getSites() is null? 236 231 site_combobox = new JComboBox(Gatherer.servlet_config.getSites().toArray()); 237 Dictionary.registerTooltip(site_combobox, "Preferences.Connection.Site_Tooltip"); 232 site_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Site_Tooltip")); 233 238 234 servlet_pane = new JPanel(); 239 235 servlet_pane.setPreferredSize(ROW_SIZE); 240 servlet_label = new JLabel(); 241 Dictionary.registerText(servlet_label, "Preferences.Connection.Servlet"); 236 servlet_label = new JLabel(Dictionary.get("Preferences.Connection.Servlet")); 242 237 servlet_label.setPreferredSize(LABEL_SIZE); 243 238 servlet_combobox = new JComboBox(); … … 257 252 ArrayList servlet_options = Gatherer.servlet_config.getServletsForSite(current_site_selection); 258 253 if (servlet_options == null) { 254 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip2")); 259 255 //servlet_combobox.setModel(new DefaultComboBoxModel()); 260 Dictionary.registerTooltip(servlet_combobox, "Preferences.Connection.Servlet_Tooltip2");261 256 servlet_combobox.setEnabled(false); 262 257 } else { 263 System.err.println(ArrayTools.objectArrayToString(servlet_options.toArray()));258 ///ystem.err.println(ArrayTools.objectArrayToString(servlet_options.toArray())); 264 259 265 260 servlet_combobox.setModel(new DefaultComboBoxModel(servlet_options.toArray())); 266 Dictionary.registerTooltip(servlet_combobox, "Preferences.Connection.Servlet_Tooltip");261 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip")); 267 262 servlet_combobox.setEnabled(true); 268 263 // try to locate and select the current servlet … … 282 277 // Creation 283 278 JPanel connection_pane = new JPanel(); 284 use_proxy_checkbox = new JCheckBox( );279 use_proxy_checkbox = new JCheckBox(Dictionary.get("Preferences.Connection.Use_Proxy")); 285 280 use_proxy_checkbox.setSelected(currently_enabled); 286 Dictionary.registerText(use_proxy_checkbox, "Preferences.Connection.Use_Proxy"); 287 281 288 282 use_proxy_checkbox.setPreferredSize(ROW_SIZE); 289 283 JPanel proxy_host_pane = new JPanel(); 290 284 proxy_host_pane.setPreferredSize(ROW_SIZE); 291 JLabel proxy_host_label = new JLabel( );285 JLabel proxy_host_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Host")); 292 286 proxy_host_label.setPreferredSize(LABEL_SIZE); 293 Dictionary.registerText(proxy_host_label, "Preferences.Connection.Proxy_Host");287 294 288 proxy_host_field = new JTextField(Configuration.getString("general.proxy_host", true)); 295 289 proxy_host_field.setEnabled(currently_enabled); 296 Dictionary.registerTooltip(proxy_host_field, "Preferences.Connection.Proxy_Host_Tooltip"); 290 proxy_host_field.setToolTipText(Dictionary.get("Preferences.Connection.Proxy_Host_Tooltip")); 291 297 292 JPanel proxy_port_pane = new JPanel(); 298 293 proxy_port_pane.setPreferredSize(ROW_SIZE); 299 JLabel proxy_port_label = new JLabel( );294 JLabel proxy_port_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Port")); 300 295 proxy_port_label.setPreferredSize(LABEL_SIZE); 301 Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port");296 302 297 String port_value = Configuration.getString("general.proxy_port", true); 303 298 if(port_value.length() > 0) { … … 308 303 } 309 304 proxy_port_field.setEnabled(currently_enabled); 310 Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip");311 305 proxy_port_field.setToolTipText(Dictionary.get("Preferences.Connection.Proxy_Port_Tooltip")); 306 312 307 // Connection 313 308 use_proxy_checkbox.addActionListener(new UseProxyListener()); … … 394 389 // Users email 395 390 JPanel email_pane = new JPanel(); 396 JLabel email_label = new JLabel( );391 JLabel email_label = new JLabel(Dictionary.get("Preferences.General.Email")); 397 392 email_label.setPreferredSize(LABEL_SIZE); 398 Dictionary.registerText(email_label, "Preferences.General.Email");399 393 email_field = new EmailField(Configuration.getColor("coloring.error_background", false)); 400 394 email_field.setText(Configuration.getEmail()); 401 Dictionary.registerTooltip(email_field, "Preferences.General.Email_Tooltip");402 395 email_field.setToolTipText(Dictionary.get("Preferences.General.Email_Tooltip")); 396 403 397 // Font selection 404 398 JPanel font_pane = new JPanel(); 405 JLabel font_label = new JLabel( );399 JLabel font_label = new JLabel(Dictionary.get("Preferences.General.Font")); 406 400 font_label.setPreferredSize(LABEL_SIZE); 407 Dictionary.registerText(font_label, "Preferences.General.Font");408 401 font_field = new JTextField(Configuration.getString("general.font", true)); 409 Dictionary.registerTooltip(font_field, "Preferences.General.Font_Tooltip");410 402 font_field.setToolTipText(Dictionary.get("Preferences.General.Font_Tooltip")); 403 411 404 // Extracted metadata 412 view_extracted_metadata_checkbox = new JCheckBox( );405 view_extracted_metadata_checkbox = new JCheckBox(Dictionary.get("Preferences.General.View_Extracted_Metadata")); 413 406 view_extracted_metadata_checkbox.setSelected(false); 414 407 if (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) { 415 408 view_extracted_metadata_checkbox.setSelected(true); 416 409 } 417 Dictionary.registerBoth(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata", "Preferences.General.View_Extracted_Metadata_Tooltip");418 410 view_extracted_metadata_checkbox.setToolTipText(Dictionary.get("Preferences.General.View_Extracted_Metadata_Tooltip")); 411 419 412 // Show file sizes 420 show_file_size_checkbox = new JCheckBox( );413 show_file_size_checkbox = new JCheckBox(Dictionary.get("Preferences.General.Show_File_Size")); 421 414 show_file_size_checkbox.setSelected(false); 422 415 if (Configuration.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) { 423 416 show_file_size_checkbox.setSelected(true); 424 417 } 425 Dictionary.registerBoth(show_file_size_checkbox, "Preferences.General.Show_File_Size", "Preferences.General.Show_File_Size_Tooltip");426 418 show_file_size_checkbox.setToolTipText(Dictionary.get("Preferences.General.Show_File_Size_Tooltip")); 419 427 420 // Language 428 421 JPanel language_pane = new JPanel(); 429 JLabel language_label = new JLabel( );422 JLabel language_label = new JLabel(Dictionary.get("Preferences.General.Interface_Language")); 430 423 language_label.setPreferredSize(LABEL_SIZE); 431 Dictionary.registerText(language_label, "Preferences.General.Interface_Language");424 432 425 language_combobox = new JComboBox(dictionary_model.toArray()); 433 Dictionary.registerTooltip(language_combobox, "Preferences.General.Interface_Language_Tooltip"); 426 language_combobox.setToolTipText(Dictionary.get("Preferences.General.Interface_Language_Tooltip")); 427 434 428 // Try to locate and select the current language 435 429 String language_code = Configuration.getLanguage(); … … 573 567 JPanel workflow_preferences_pane = new JPanel(); 574 568 JPanel checklist_pane = new JPanel(); 575 JLabel title_label = new JLabel( );569 JLabel title_label = new JLabel(Dictionary.get("Preferences.Workflow.Title")); 576 570 title_label.setPreferredSize(ROW_SIZE); 577 Dictionary.registerText(title_label, "Preferences.Workflow.Title"); 578 579 workflow_download = new JCheckBox(); 571 572 workflow_download = new JCheckBox(Dictionary.get("GUI.Download")+" - "+Dictionary.get("GUI.Download_Tooltip")); 580 573 workflow_download.setSelected(Configuration.get("workflow.download", false)); 581 574 workflow_download.setPreferredSize(ROW_SIZE); 582 Dictionary.registerText(workflow_download, "Preferences.Workflow.Download"); 583 584 workflow_gather = new JCheckBox(); 575 576 workflow_gather = new JCheckBox(Dictionary.get("GUI.Gather")+" - "+Dictionary.get("GUI.Gather_Tooltip")); 585 577 workflow_gather.setSelected(Configuration.get("workflow.gather", false)); 586 578 workflow_gather.setPreferredSize(ROW_SIZE); 587 Dictionary.registerText(workflow_gather, "Preferences.Workflow.Gather"); 588 589 workflow_enrich = new JCheckBox(); 579 580 workflow_enrich = new JCheckBox(Dictionary.get("GUI.Enrich")+" - "+Dictionary.get("GUI.Enrich_Tooltip")); 590 581 workflow_enrich.setSelected(Configuration.get("workflow.enrich", false)); 591 582 workflow_enrich.setPreferredSize(ROW_SIZE); 592 Dictionary.registerText(workflow_enrich, "Preferences.Workflow.Enrich"); 593 594 workflow_design = new JCheckBox(); 583 584 workflow_design = new JCheckBox(Dictionary.get("GUI.Design")+" - "+Dictionary.get("GUI.Design_Tooltip")); 595 585 workflow_design.setSelected(Configuration.get("workflow.design", false)); 596 586 workflow_design.setPreferredSize(ROW_SIZE); 597 Dictionary.registerText(workflow_design, "Preferences.Workflow.Design"); 598 599 workflow_create = new JCheckBox(); 587 588 workflow_create = new JCheckBox(Dictionary.get("GUI.Create")+" - "+Dictionary.get("GUI.Create_Tooltip")); 600 589 workflow_create.setSelected(Configuration.get("workflow.create", false)); 601 590 workflow_create.setPreferredSize(ROW_SIZE); 602 Dictionary.registerText(workflow_create, "Preferences.Workflow.Create"); 603 591 592 593 workflow_format = new JCheckBox(Dictionary.get("GUI.Format")+" - "+Dictionary.get("GUI.Format_Tooltip")); 594 workflow_format.setSelected(Configuration.get("workflow.format", false)); 595 workflow_format.setPreferredSize(ROW_SIZE); 596 604 597 JPanel predefined_pane = new JPanel(); 605 JLabel predefined_label = new JLabel(); 606 Dictionary.registerText(predefined_label, "Preferences.Workflow.Predefined.Label"); 598 JLabel predefined_label = new JLabel(Dictionary.get("Preferences.Workflow.Predefined.Label")); 607 599 JComboBox predefined_combobox = new JComboBox(predefined); 608 600 … … 628 620 checklist_pane.add(workflow_create); 629 621 } 630 622 if (Configuration.get("workflow.format", true)) { 623 checklist_pane.add(workflow_format); 624 } 625 631 626 predefined_pane.setLayout(new BorderLayout(5,0)); 632 627 predefined_pane.add(predefined_label, BorderLayout.WEST); … … 778 773 Configuration.set("workflow.design", false, workflow_design.isSelected()); 779 774 Configuration.set("workflow.create", false, workflow_create.isSelected()); 775 Configuration.set("workflow.format", false, workflow_format.isSelected()); 776 780 777 Gatherer.g_man.workflowUpdate("Download", workflow_download.isSelected()); 781 778 Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected()); … … 783 780 Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Configuration.getMode() > Configuration.ASSISTANT_MODE)); 784 781 Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected()); 782 Gatherer.g_man.workflowUpdate("Format", workflow_format.isSelected()); 785 783 786 784 // Always save configuration changes immediately (in case the GLI crashes) … … 877 875 workflow_design.setSelected(element.getEnabled("design")); 878 876 workflow_create.setSelected(element.getEnabled("create")); 877 workflow_format.setSelected(element.getEnabled("format")); 879 878 } 880 879 } … … 894 893 ArrayList servlet_options = Gatherer.servlet_config.getServletsForSite(current_site_selection); 895 894 if (servlet_options == null) { 896 System.err.println("no servlets for this site");895 ///ystem.err.println("no servlets for this site"); 897 896 servlet_combobox.setModel(new DefaultComboBoxModel()); 898 Dictionary.registerTooltip(servlet_combobox, "Preferences.Connection.Servlet_Tooltip2");897 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip2")); 899 898 servlet_combobox.setEnabled(false); 900 899 901 900 } else { 902 System.err.println(ArrayTools.objectArrayToString(servlet_options.toArray()));901 ///ystem.err.println(ArrayTools.objectArrayToString(servlet_options.toArray())); 903 902 servlet_combobox.setModel(new DefaultComboBoxModel(servlet_options.toArray())); 904 Dictionary.registerTooltip(servlet_combobox, "Preferences.Connection.Servlet_Tooltip");903 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip")); 905 904 servlet_combobox.setEnabled(true); 906 905 }
Note:
See TracChangeset
for help on using the changeset viewer.