1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
5 | * library suite from the New Zealand Digital Library Project at the
|
---|
6 | * University of Waikato, New Zealand.
|
---|
7 | *
|
---|
8 | * Author: John Thompson, Greenstone Digital Library, University of Waikato
|
---|
9 | *
|
---|
10 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | *########################################################################
|
---|
26 | */
|
---|
27 | package org.greenstone.gatherer.gui;
|
---|
28 |
|
---|
29 | import java.awt.*;
|
---|
30 | import java.awt.event.*;
|
---|
31 | import java.io.*;
|
---|
32 | import java.net.*;
|
---|
33 | import java.util.*;
|
---|
34 | import javax.swing.*;
|
---|
35 | import javax.swing.event.*;
|
---|
36 | import org.greenstone.gatherer.Configuration;
|
---|
37 | import org.greenstone.gatherer.Dictionary;
|
---|
38 | import org.greenstone.gatherer.Gatherer;
|
---|
39 | import org.greenstone.gatherer.cdm.LanguageManager;
|
---|
40 | import org.greenstone.gatherer.checklist.CheckList;
|
---|
41 | import org.greenstone.gatherer.checklist.Entry;
|
---|
42 | import org.greenstone.gatherer.gui.EmailField;
|
---|
43 | import org.greenstone.gatherer.gui.GLIButton;
|
---|
44 | import org.greenstone.gatherer.gui.ModalDialog;
|
---|
45 | import org.greenstone.gatherer.gui.SimpleMenuBar;
|
---|
46 | import org.greenstone.gatherer.gui.tree.DragTree;
|
---|
47 | import org.greenstone.gatherer.util.StaticStrings;
|
---|
48 | import org.greenstone.gatherer.util.Utility;
|
---|
49 | import org.w3c.dom.*;
|
---|
50 |
|
---|
51 | public class Preferences
|
---|
52 | extends ModalDialog {
|
---|
53 |
|
---|
54 | private CheckList warning_preferences_check_list;
|
---|
55 | private EmailField email_field;
|
---|
56 | private JButton apply_button;
|
---|
57 | private JButton cancel_button;
|
---|
58 | private JButton ok_button;
|
---|
59 | private JCheckBox show_file_size_checkbox;
|
---|
60 | private JCheckBox use_proxy_checkbox;
|
---|
61 | private JCheckBox view_extracted_metadata_checkbox;
|
---|
62 | private JCheckBox workflow_browse;
|
---|
63 | private JCheckBox workflow_create;
|
---|
64 | private JCheckBox workflow_mirror;
|
---|
65 | private JCheckBox workflow_gather;
|
---|
66 | private JCheckBox workflow_enrich;
|
---|
67 | private JCheckBox workflow_design;
|
---|
68 | private JCheckBox workflow_export;
|
---|
69 | private JCheckBox workflow_preview;
|
---|
70 | private JComboBox language_combobox;
|
---|
71 | private JLabel email_label;
|
---|
72 | private JLabel language_label;
|
---|
73 | private JLabel library_path_label;
|
---|
74 | private JLabel predefined_label;
|
---|
75 | private JLabel program_label;
|
---|
76 | private JLabel proxy_host_label;
|
---|
77 | private JLabel proxy_port_label;
|
---|
78 | //private JLabel recursion_depth_label;
|
---|
79 | private JLabel title_label;
|
---|
80 | private JRadioButton assistant_mode_radio_button;
|
---|
81 | private JRadioButton expert_mode_radio_button;
|
---|
82 | private JRadioButton librarian_mode_radio_button;
|
---|
83 | private JRadioButton systems_mode_radio_button;
|
---|
84 | private JSpinner proxy_port_field;
|
---|
85 | //private JSpinner recursion_depth_spinner;
|
---|
86 | private JTabbedPane tab_pane;
|
---|
87 | private JTextArea mode_description_textarea;
|
---|
88 | private JTextField library_path_field;
|
---|
89 | private JTextField program_field;
|
---|
90 | private JTextField proxy_host_field;
|
---|
91 | private Preferences self;
|
---|
92 |
|
---|
93 | static final Dimension LABEL_SIZE = new Dimension(240, 25);
|
---|
94 | static final Dimension ROW_SIZE = new Dimension(640, 25);
|
---|
95 | static final Dimension SIZE = new Dimension(640, 345);
|
---|
96 | static final String TRUE = "true";
|
---|
97 |
|
---|
98 | public Preferences() {
|
---|
99 | // Initialize
|
---|
100 | super(Gatherer.g_man, true);
|
---|
101 | this.self = this;
|
---|
102 | setSize(SIZE);
|
---|
103 | Dictionary.registerText(this, "Preferences");
|
---|
104 | setJMenuBar(new SimpleMenuBar("preferences"));
|
---|
105 |
|
---|
106 | // Creation
|
---|
107 | JPanel content_pane = (JPanel) getContentPane();
|
---|
108 | tab_pane = new JTabbedPane();
|
---|
109 | JPanel general_preferences = createGeneralPreferences();
|
---|
110 | tab_pane.add("Preferences.General", general_preferences);
|
---|
111 | tab_pane.add("Preferences.Mode", createModePreferences());
|
---|
112 | tab_pane.add("Preferences.Workflow", createWorkflowPreferences());
|
---|
113 | tab_pane.add("Preferences.Connection", createConnectionPreferences());
|
---|
114 | tab_pane.add("Preferences.Warnings", createWarningPreferences());
|
---|
115 | Dictionary.register(tab_pane);
|
---|
116 |
|
---|
117 | JPanel button_pane = new JPanel();
|
---|
118 | ok_button = new GLIButton();
|
---|
119 | ok_button.setMnemonic(KeyEvent.VK_O);
|
---|
120 | Dictionary.registerBoth(ok_button, "General.OK", "General.OK_Tooltip");
|
---|
121 | apply_button = new GLIButton();
|
---|
122 | apply_button.setMnemonic(KeyEvent.VK_A);
|
---|
123 | Dictionary.registerBoth(apply_button, "General.Apply", "General.Apply_Tooltip");
|
---|
124 | cancel_button = new GLIButton();
|
---|
125 | cancel_button.setMnemonic(KeyEvent.VK_C);
|
---|
126 | Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip");
|
---|
127 |
|
---|
128 | // Connection
|
---|
129 | ok_button.addActionListener(new OKButtonListener(true));
|
---|
130 | apply_button.addActionListener(new OKButtonListener(false));
|
---|
131 | cancel_button.addActionListener(new CancelButtonListener());
|
---|
132 |
|
---|
133 | // Layout
|
---|
134 | button_pane.setBorder(BorderFactory.createEmptyBorder(5,2,2,2));
|
---|
135 | button_pane.setLayout(new GridLayout(1,3,0,5));
|
---|
136 | button_pane.add(ok_button);
|
---|
137 | button_pane.add(apply_button);
|
---|
138 | button_pane.add(cancel_button);
|
---|
139 |
|
---|
140 | content_pane.setLayout(new BorderLayout());
|
---|
141 | content_pane.add(tab_pane, BorderLayout.CENTER);
|
---|
142 | content_pane.add(button_pane, BorderLayout.SOUTH);
|
---|
143 |
|
---|
144 | Dimension frame_size = Gatherer.g_man.getSize();
|
---|
145 | Point frame_location = Gatherer.g_man.getLocation();
|
---|
146 | //setLocation(frame_location.x + ((frame_size.width - SIZE.width) / 2), frame_location.y + ((frame_size.height - SIZE.height)));
|
---|
147 | setLocation(((frame_size.width - SIZE.width) / 2), ((frame_size.height - SIZE.height)));
|
---|
148 |
|
---|
149 | // Clean up
|
---|
150 | frame_location = null;
|
---|
151 | frame_size = null;
|
---|
152 | cancel_button = null;
|
---|
153 | ok_button = null;
|
---|
154 | button_pane = null;
|
---|
155 | tab_pane = null;
|
---|
156 | content_pane = null;
|
---|
157 | setVisible(true);
|
---|
158 | }
|
---|
159 |
|
---|
160 | private JPanel createConnectionPreferences() {
|
---|
161 | JPanel program_pane = new JPanel();
|
---|
162 | program_pane.setPreferredSize(ROW_SIZE);
|
---|
163 | program_label = new JLabel();
|
---|
164 | program_label.setPreferredSize(LABEL_SIZE);
|
---|
165 | Dictionary.registerText(program_label, "Preferences.Connection.ProgramCommand");
|
---|
166 | program_field = new JTextField(Gatherer.config.getPreviewCommand());
|
---|
167 | program_field.setCaretPosition(0);
|
---|
168 | Dictionary.registerTooltip(program_field, "Preferences.Connection.ProgramCommand_Tooltip");
|
---|
169 |
|
---|
170 | JPanel library_path_pane = new JPanel();
|
---|
171 | library_path_pane.setPreferredSize(ROW_SIZE);
|
---|
172 | library_path_label = new JLabel();
|
---|
173 | library_path_label.setPreferredSize(LABEL_SIZE);
|
---|
174 | Dictionary.registerText(library_path_label, "Preferences.Connection.Library_Path");
|
---|
175 | library_path_field = new JTextField(Gatherer.config.getString("general.exec_address", true));
|
---|
176 | library_path_field.setCaretPosition(0);
|
---|
177 | Dictionary.registerTooltip(library_path_field, "Preferences.Connection.Library_Path_Tooltip");
|
---|
178 |
|
---|
179 | boolean currently_enabled = Gatherer.config.get("general.use_proxy", true);
|
---|
180 | // Creation
|
---|
181 | JPanel connection_pane = new JPanel();
|
---|
182 | use_proxy_checkbox = new JCheckBox();
|
---|
183 | use_proxy_checkbox.setSelected(currently_enabled);
|
---|
184 | Dictionary.registerText(use_proxy_checkbox, "Preferences.Connection.Use_Proxy");
|
---|
185 |
|
---|
186 | use_proxy_checkbox.setPreferredSize(ROW_SIZE);
|
---|
187 | JPanel proxy_host_pane = new JPanel();
|
---|
188 | proxy_host_pane.setPreferredSize(ROW_SIZE);
|
---|
189 | proxy_host_label = new JLabel();
|
---|
190 | proxy_host_label.setPreferredSize(LABEL_SIZE);
|
---|
191 | Dictionary.registerText(proxy_host_label, "Preferences.Connection.Proxy_Host");
|
---|
192 | proxy_host_field = new JTextField(Gatherer.config.getString("general.proxy_host", true));
|
---|
193 | proxy_host_field.setEnabled(currently_enabled);
|
---|
194 | Dictionary.registerTooltip(proxy_host_field, "Preferences.Connection.Proxy_Host_Tooltip");
|
---|
195 | JPanel proxy_port_pane = new JPanel();
|
---|
196 | proxy_port_pane.setPreferredSize(ROW_SIZE);
|
---|
197 | proxy_port_label = new JLabel();
|
---|
198 | proxy_port_label.setPreferredSize(LABEL_SIZE);
|
---|
199 | Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port");
|
---|
200 | String port_value = Gatherer.config.getString("general.proxy_port", true);
|
---|
201 | if(port_value.length() > 0) {
|
---|
202 | proxy_port_field = new JSpinner(new SpinnerNumberModel((new Integer(port_value)).intValue(), 0, 65535, 1));
|
---|
203 | }
|
---|
204 | else {
|
---|
205 | proxy_port_field = new JSpinner(new SpinnerNumberModel(0, 0, 65535, 1));
|
---|
206 | }
|
---|
207 | proxy_port_field.setEnabled(currently_enabled);
|
---|
208 | Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip");
|
---|
209 |
|
---|
210 | // Connection
|
---|
211 | use_proxy_checkbox.addActionListener(new UseProxyListener());
|
---|
212 |
|
---|
213 | // Layout
|
---|
214 | program_pane.setLayout(new BorderLayout());
|
---|
215 | program_pane.add(program_label, BorderLayout.WEST);
|
---|
216 | program_pane.add(program_field, BorderLayout.CENTER);
|
---|
217 |
|
---|
218 | library_path_pane.setLayout(new BorderLayout());
|
---|
219 | library_path_pane.add(library_path_label, BorderLayout.WEST);
|
---|
220 | library_path_pane.add(library_path_field, BorderLayout.CENTER);
|
---|
221 |
|
---|
222 | proxy_host_pane.setLayout(new BorderLayout());
|
---|
223 | proxy_host_pane.add(proxy_host_label, BorderLayout.WEST);
|
---|
224 | proxy_host_pane.add(proxy_host_field, BorderLayout.CENTER);
|
---|
225 |
|
---|
226 | proxy_port_pane.setLayout(new BorderLayout());
|
---|
227 | proxy_port_pane.add(proxy_port_label, BorderLayout.WEST);
|
---|
228 | proxy_port_pane.add(proxy_port_field, BorderLayout.CENTER);
|
---|
229 |
|
---|
230 | connection_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
231 | connection_pane.setLayout(new GridLayout(8,1,0,2));
|
---|
232 | connection_pane.add(program_pane);
|
---|
233 | connection_pane.add(library_path_pane);
|
---|
234 | connection_pane.add(use_proxy_checkbox);
|
---|
235 | connection_pane.add(proxy_host_pane);
|
---|
236 | connection_pane.add(proxy_port_pane);
|
---|
237 |
|
---|
238 | return connection_pane;
|
---|
239 | }
|
---|
240 |
|
---|
241 | private JPanel createGeneralPreferences() {
|
---|
242 | JPanel general_pane = new JPanel();
|
---|
243 |
|
---|
244 | // Build the model of available languages
|
---|
245 | ArrayList dictionary_model = new ArrayList();
|
---|
246 |
|
---|
247 | // Old method for determining what languages should be available in the combobox
|
---|
248 | /*
|
---|
249 | dictionary_model.add(new DictionaryEntry(Locale.ENGLISH));
|
---|
250 | File classes_folder = new File(Utility.BASE_DIR + StaticStrings.CLASSES_FOLDER);
|
---|
251 | File[] possible_dictionaries = classes_folder.listFiles();
|
---|
252 | for(int i = 0; i < possible_dictionaries.length; i++) {
|
---|
253 | String filename = possible_dictionaries[i].getName();
|
---|
254 | if(filename.endsWith(StaticStrings.PROPERTIES_FILE_EXTENSION) && filename.indexOf(StaticStrings.UNDERSCORE_CHARACTER) != -1) {
|
---|
255 | StringTokenizer tokenizer = new StringTokenizer(filename.substring(filename.indexOf(StaticStrings.UNDERSCORE_CHARACTER) + 1, filename.indexOf(StaticStrings.STOP_CHARACTER)), StaticStrings.UNDERSCORE_CHARACTER);
|
---|
256 | Locale locale = null;
|
---|
257 | switch(tokenizer.countTokens()) {
|
---|
258 | case 1:
|
---|
259 | locale = new Locale(tokenizer.nextToken().toLowerCase());
|
---|
260 | break;
|
---|
261 | case 2:
|
---|
262 | locale = new Locale(tokenizer.nextToken().toLowerCase(), tokenizer.nextToken().toUpperCase());
|
---|
263 | break;
|
---|
264 | }
|
---|
265 | tokenizer = null;
|
---|
266 | // Open the file and read the first line
|
---|
267 | String description = null;
|
---|
268 | try {
|
---|
269 | BufferedReader br = new BufferedReader(new FileReader(possible_dictionaries[i]));
|
---|
270 | String first_line = br.readLine();
|
---|
271 | br.close();
|
---|
272 | description = first_line.substring(first_line.indexOf(StaticStrings.COLON_CHARACTER) + 1);
|
---|
273 | }
|
---|
274 | catch(Exception error) {
|
---|
275 | }
|
---|
276 | DictionaryEntry entry = new DictionaryEntry(description, locale);
|
---|
277 | description = null;
|
---|
278 | locale = null;
|
---|
279 | if(!dictionary_model.contains(entry)) {
|
---|
280 | dictionary_model.add(entry);
|
---|
281 | }
|
---|
282 | entry = null;
|
---|
283 | }
|
---|
284 | filename = null;
|
---|
285 | }
|
---|
286 | possible_dictionaries = null;
|
---|
287 | classes_folder = null;
|
---|
288 | */
|
---|
289 |
|
---|
290 | // The new method makes use of the successor to the languages.dat file, classes/xml/languages.xml
|
---|
291 | NodeList language_elements = LanguageManager.LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT);
|
---|
292 | for(int i = 0; i < language_elements.getLength(); i++) {
|
---|
293 | Element language_element = (Element) language_elements.item(i);
|
---|
294 | if((language_element.getAttribute(StaticStrings.GLI_ATTRIBUTE)).equalsIgnoreCase(StaticStrings.TRUE_STR) || (language_element.getAttribute(StaticStrings.MDS_ATTRIBUTE)).equalsIgnoreCase(StaticStrings.TRUE_STR)) {
|
---|
295 | Locale locale = new Locale(language_element.getAttribute(StaticStrings.CODE_ATTRIBUTE));
|
---|
296 | String description = language_element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
|
---|
297 | DictionaryEntry entry = new DictionaryEntry(description, locale);
|
---|
298 | if(!dictionary_model.contains(entry)) {
|
---|
299 | dictionary_model.add(entry);
|
---|
300 | }
|
---|
301 | entry = null;
|
---|
302 | description = null;
|
---|
303 | locale = null;
|
---|
304 | }
|
---|
305 | language_element = null;
|
---|
306 | }
|
---|
307 | language_elements = null;
|
---|
308 |
|
---|
309 | // Users email
|
---|
310 | JPanel email_pane = new JPanel();
|
---|
311 | email_label = new JLabel();
|
---|
312 | email_label.setPreferredSize(LABEL_SIZE);
|
---|
313 | Dictionary.registerText(email_label, "Preferences.General.Email");
|
---|
314 | email_field = new EmailField(Gatherer.config.getColor("coloring.error_background", false));
|
---|
315 | email_field.setText(Gatherer.config.getEmail());
|
---|
316 | Dictionary.registerTooltip(email_field, "Preferences.General.Email_Tooltip");
|
---|
317 |
|
---|
318 | // Extracted metadata
|
---|
319 | view_extracted_metadata_checkbox = new JCheckBox();
|
---|
320 | view_extracted_metadata_checkbox.setSelected(false);
|
---|
321 | if (Gatherer.config.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {
|
---|
322 | view_extracted_metadata_checkbox.setSelected(true);
|
---|
323 | }
|
---|
324 | Dictionary.registerBoth(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata", "Preferences.General.View_Extracted_Metadata_Tooltip");
|
---|
325 |
|
---|
326 | // Show file sizes
|
---|
327 | show_file_size_checkbox = new JCheckBox();
|
---|
328 | show_file_size_checkbox.setSelected(false);
|
---|
329 | if (Gatherer.config.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) {
|
---|
330 | show_file_size_checkbox.setSelected(true);
|
---|
331 | }
|
---|
332 | Dictionary.registerBoth(show_file_size_checkbox, "Preferences.General.Show_File_Size", "Preferences.General.Show_File_Size_Tooltip");
|
---|
333 |
|
---|
334 | // Language
|
---|
335 | JPanel language_pane = new JPanel();
|
---|
336 | language_label = new JLabel();
|
---|
337 | language_label.setPreferredSize(LABEL_SIZE);
|
---|
338 | Dictionary.registerText(language_label, "Preferences.General.Interface_Language");
|
---|
339 | language_combobox = new JComboBox(dictionary_model.toArray());
|
---|
340 | Dictionary.registerTooltip(language_combobox, "Preferences.General.Interface_Language_Tooltip");
|
---|
341 | // Try to locate and select the current language
|
---|
342 | String language_code = Gatherer.config.getLanguage();
|
---|
343 | for(int b = 0; b < language_combobox.getItemCount(); b++) {
|
---|
344 | DictionaryEntry entry = (DictionaryEntry) language_combobox.getItemAt(b);
|
---|
345 | if(language_code.equalsIgnoreCase(entry.getLocale().getLanguage())) {
|
---|
346 | language_combobox.setSelectedIndex(b);
|
---|
347 | }
|
---|
348 | }
|
---|
349 |
|
---|
350 | // Recursion
|
---|
351 | /*
|
---|
352 | JPanel recursion_depth_pane = new JPanel();
|
---|
353 | recursion_depth_label = new JLabel();
|
---|
354 | recursion_depth_label.setPreferredSize(LABEL_SIZE);
|
---|
355 | Dictionary.registerText(recursion_depth_label, "Preferences.General.Recursion_Depth");
|
---|
356 | recursion_depth_spinner = new JSpinner(new SpinnerNumberModel(Gatherer.config.getInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC), 0, Integer.MAX_VALUE, 1));
|
---|
357 | Dictionary.registerTooltip(recursion_depth_spinner, "Preferences.General.Recursion_Depth_Tooltip");
|
---|
358 | */
|
---|
359 |
|
---|
360 | // Connect
|
---|
361 | language_combobox.addActionListener(new LanguageComboboxListener());
|
---|
362 |
|
---|
363 | // Layout
|
---|
364 | email_pane.setLayout(new BorderLayout());
|
---|
365 | email_pane.add(email_label, BorderLayout.WEST);
|
---|
366 | email_pane.add(email_field, BorderLayout.CENTER);
|
---|
367 |
|
---|
368 | language_pane.setLayout(new BorderLayout());
|
---|
369 | language_pane.add(language_label, BorderLayout.WEST);
|
---|
370 | language_pane.add(language_combobox, BorderLayout.CENTER);
|
---|
371 |
|
---|
372 | //recursion_depth_pane.setLayout(new BorderLayout());
|
---|
373 | //recursion_depth_pane.add(recursion_depth_label, BorderLayout.WEST);
|
---|
374 | //recursion_depth_pane.add(recursion_depth_spinner, BorderLayout.CENTER);
|
---|
375 |
|
---|
376 | general_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
377 | general_pane.setLayout(new GridLayout(5,1,0,5));
|
---|
378 | general_pane.add(email_pane);
|
---|
379 | general_pane.add(language_pane);
|
---|
380 | //general_pane.add(recursion_depth_pane);
|
---|
381 | general_pane.add(view_extracted_metadata_checkbox);
|
---|
382 | general_pane.add(show_file_size_checkbox);
|
---|
383 |
|
---|
384 | return general_pane;
|
---|
385 | }
|
---|
386 |
|
---|
387 | /** Generate the controls for altering the detail mode.
|
---|
388 | * @return a JPanel of controls
|
---|
389 | */
|
---|
390 | private JPanel createModePreferences() {
|
---|
391 | // Create Controls
|
---|
392 | JPanel mode_panel = new JPanel();
|
---|
393 | JPanel button_panel = new JPanel();
|
---|
394 | ButtonGroup mode_button_group = new ButtonGroup();
|
---|
395 | assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant"));
|
---|
396 | assistant_mode_radio_button.setOpaque(false);
|
---|
397 | mode_button_group.add(assistant_mode_radio_button);
|
---|
398 | expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert"));
|
---|
399 | expert_mode_radio_button.setOpaque(false);
|
---|
400 | mode_button_group.add(expert_mode_radio_button);
|
---|
401 | librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian"));
|
---|
402 | librarian_mode_radio_button.setOpaque(false);
|
---|
403 | mode_button_group.add(librarian_mode_radio_button);
|
---|
404 | systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems"));
|
---|
405 | systems_mode_radio_button.setOpaque(false);
|
---|
406 | mode_button_group.add(systems_mode_radio_button);
|
---|
407 | mode_description_textarea = new JTextArea();
|
---|
408 | mode_description_textarea.setEditable(false);
|
---|
409 | mode_description_textarea.setLineWrap(true);
|
---|
410 | mode_description_textarea.setWrapStyleWord(true);
|
---|
411 | // Determine which value is already selected
|
---|
412 | switch(Gatherer.config.getMode()) {
|
---|
413 | case Configuration.ASSISTANT_MODE:
|
---|
414 | assistant_mode_radio_button.setSelected(true);
|
---|
415 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description"));
|
---|
416 | break;
|
---|
417 | case Configuration.SYSTEMS_MODE:
|
---|
418 | systems_mode_radio_button.setSelected(true);
|
---|
419 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description"));
|
---|
420 | break;
|
---|
421 | case Configuration.EXPERT_MODE:
|
---|
422 | expert_mode_radio_button.setSelected(true);
|
---|
423 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description"));
|
---|
424 | break;
|
---|
425 | default:
|
---|
426 | librarian_mode_radio_button.setSelected(true);
|
---|
427 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description"));
|
---|
428 | }
|
---|
429 | // Connection - when a radio button is selected we have to change the description
|
---|
430 | ModeRadioButtonListener listener = new ModeRadioButtonListener();
|
---|
431 | assistant_mode_radio_button.addActionListener(listener);
|
---|
432 | expert_mode_radio_button.addActionListener(listener);
|
---|
433 | librarian_mode_radio_button.addActionListener(listener);
|
---|
434 | systems_mode_radio_button.addActionListener(listener);
|
---|
435 | listener = null;
|
---|
436 | // Layout
|
---|
437 | button_panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
|
---|
438 | button_panel.setLayout(new GridLayout(4,1,2,2));
|
---|
439 | button_panel.add(assistant_mode_radio_button);
|
---|
440 | button_panel.add(librarian_mode_radio_button);
|
---|
441 | button_panel.add(systems_mode_radio_button);
|
---|
442 | button_panel.add(expert_mode_radio_button);
|
---|
443 |
|
---|
444 | mode_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
445 | mode_panel.setLayout(new BorderLayout());
|
---|
446 | mode_panel.add(button_panel, BorderLayout.NORTH);
|
---|
447 | mode_panel.add(new JScrollPane(mode_description_textarea), BorderLayout.CENTER);
|
---|
448 |
|
---|
449 | return mode_panel;
|
---|
450 | }
|
---|
451 |
|
---|
452 | /** The warning preferences are controlled through a checklist. */
|
---|
453 | private JPanel createWarningPreferences() {
|
---|
454 | // Retrieve all of the warning preferences settings.
|
---|
455 | HashMap warning_preferences = Gatherer.config.getAll("warning\\..*", true);
|
---|
456 | warning_preferences_check_list = new CheckList(false);
|
---|
457 | for(Iterator keys = warning_preferences.keySet().iterator(); keys.hasNext(); ) {
|
---|
458 | String property = (String) keys.next();
|
---|
459 | String value = (String) warning_preferences.get(property);
|
---|
460 | // Remove 'warning.'
|
---|
461 | String title = Dictionary.get(property.substring(8) + ".Title");
|
---|
462 | Entry entry = new Entry(title, value.equalsIgnoreCase(TRUE));
|
---|
463 | entry.setProperty(property);
|
---|
464 | warning_preferences_check_list.addEntry(entry);
|
---|
465 | }
|
---|
466 | // Creation
|
---|
467 | JPanel warning_preferences_pane = new JPanel();
|
---|
468 | // Connection
|
---|
469 | // Layout
|
---|
470 | warning_preferences_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
471 | warning_preferences_pane.setLayout(new BorderLayout());
|
---|
472 | warning_preferences_pane.add(new JScrollPane(warning_preferences_check_list), BorderLayout.CENTER);
|
---|
473 |
|
---|
474 | return warning_preferences_pane;
|
---|
475 | }
|
---|
476 |
|
---|
477 | private JPanel createWorkflowPreferences() {
|
---|
478 | // Read in the predefined configurations file
|
---|
479 | Vector predefined = new Vector();
|
---|
480 | Document predefined_document = Utility.parse("xml/workflows.xml", true);
|
---|
481 | Element predefined_element = predefined_document.getDocumentElement();
|
---|
482 | NodeList workflow_elements = predefined_element.getElementsByTagName("Workflow");
|
---|
483 | for(int i = 0; i < workflow_elements.getLength(); i++) {
|
---|
484 | predefined.add(new WorkflowElementWrapper((Element)workflow_elements.item(i)));
|
---|
485 | }
|
---|
486 |
|
---|
487 | // Creation
|
---|
488 | JPanel workflow_preferences_pane = new JPanel();
|
---|
489 | JPanel checklist_pane = new JPanel();
|
---|
490 | title_label = new JLabel();
|
---|
491 | title_label.setPreferredSize(ROW_SIZE);
|
---|
492 | Dictionary.registerText(title_label, "Preferences.Workflow.Title");
|
---|
493 |
|
---|
494 | workflow_browse = new JCheckBox();
|
---|
495 | workflow_browse.setSelected(Gatherer.config.get("workflow.browse", false));
|
---|
496 | workflow_browse.setPreferredSize(ROW_SIZE);
|
---|
497 | Dictionary.registerText(workflow_browse, "Preferences.Workflow.Browse");
|
---|
498 |
|
---|
499 | workflow_mirror = new JCheckBox();
|
---|
500 | workflow_mirror.setSelected(Gatherer.config.get("workflow.mirror", false));
|
---|
501 | workflow_mirror.setPreferredSize(ROW_SIZE);
|
---|
502 | Dictionary.registerText(workflow_mirror, "Preferences.Workflow.Mirror");
|
---|
503 |
|
---|
504 | workflow_gather = new JCheckBox();
|
---|
505 | workflow_gather.setSelected(Gatherer.config.get("workflow.gather", false));
|
---|
506 | workflow_gather.setPreferredSize(ROW_SIZE);
|
---|
507 | Dictionary.registerText(workflow_gather, "Preferences.Workflow.Gather");
|
---|
508 |
|
---|
509 | workflow_enrich = new JCheckBox();
|
---|
510 | workflow_enrich.setSelected(Gatherer.config.get("workflow.enrich", false));
|
---|
511 | workflow_enrich.setPreferredSize(ROW_SIZE);
|
---|
512 | Dictionary.registerText(workflow_enrich, "Preferences.Workflow.Enrich");
|
---|
513 |
|
---|
514 | workflow_design = new JCheckBox();
|
---|
515 | workflow_design.setSelected(Gatherer.config.get("workflow.design", false));
|
---|
516 | workflow_design.setPreferredSize(ROW_SIZE);
|
---|
517 | Dictionary.registerText(workflow_design, "Preferences.Workflow.Design");
|
---|
518 |
|
---|
519 | workflow_export = new JCheckBox();
|
---|
520 | workflow_export.setSelected(Gatherer.config.get("workflow.export", false));
|
---|
521 | workflow_export.setPreferredSize(ROW_SIZE);
|
---|
522 | Dictionary.registerText(workflow_export, "Preferences.Workflow.Export");
|
---|
523 |
|
---|
524 | workflow_create = new JCheckBox();
|
---|
525 | workflow_create.setSelected(Gatherer.config.get("workflow.create", false));
|
---|
526 | workflow_create.setPreferredSize(ROW_SIZE);
|
---|
527 | Dictionary.registerText(workflow_create, "Preferences.Workflow.Create");
|
---|
528 |
|
---|
529 | workflow_preview = new JCheckBox();
|
---|
530 | workflow_preview.setSelected(Gatherer.config.get("workflow.preview", false));
|
---|
531 | workflow_preview.setPreferredSize(ROW_SIZE);
|
---|
532 | Dictionary.registerText(workflow_preview, "Preferences.Workflow.Preview");
|
---|
533 |
|
---|
534 | JPanel predefined_pane = new JPanel();
|
---|
535 | predefined_label = new JLabel();
|
---|
536 | predefined_label.setPreferredSize(new Dimension(150,25));
|
---|
537 | Dictionary.registerText(predefined_label, "Preferences.Workflow.Predefined.Label");
|
---|
538 | JComboBox predefined_combobox = new JComboBox(predefined);
|
---|
539 |
|
---|
540 | // Connection
|
---|
541 | predefined_combobox.addActionListener(new PredefinedActionListener());
|
---|
542 |
|
---|
543 | // Layout
|
---|
544 | checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS));
|
---|
545 | checklist_pane.add(title_label);
|
---|
546 | if (Gatherer.config.get("workflow.browse", true)) {
|
---|
547 | checklist_pane.add(workflow_browse);
|
---|
548 | }
|
---|
549 | if (Gatherer.config.get("workflow.mirror", true)) {
|
---|
550 | checklist_pane.add(workflow_mirror);
|
---|
551 | }
|
---|
552 | if (Gatherer.config.get("workflow.gather", true)) {
|
---|
553 | checklist_pane.add(workflow_gather);
|
---|
554 | }
|
---|
555 | if (Gatherer.config.get("workflow.enrich", true)) {
|
---|
556 | checklist_pane.add(workflow_enrich);
|
---|
557 | }
|
---|
558 | if (Gatherer.config.get("workflow.design", true)) {
|
---|
559 | checklist_pane.add(workflow_design);
|
---|
560 | }
|
---|
561 | if (Gatherer.config.get("workflow.export", true)) {
|
---|
562 | checklist_pane.add(workflow_export);
|
---|
563 | }
|
---|
564 | if (Gatherer.config.get("workflow.create", true)) {
|
---|
565 | checklist_pane.add(workflow_create);
|
---|
566 | }
|
---|
567 | if (Gatherer.config.get("workflow.preview", true)) {
|
---|
568 | checklist_pane.add(workflow_preview);
|
---|
569 | }
|
---|
570 | predefined_pane.setLayout(new BorderLayout());
|
---|
571 | predefined_pane.add(predefined_label, BorderLayout.WEST);
|
---|
572 | predefined_pane.add(predefined_combobox, BorderLayout.CENTER);
|
---|
573 |
|
---|
574 | workflow_preferences_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
575 | workflow_preferences_pane.setLayout(new BorderLayout());
|
---|
576 | workflow_preferences_pane.add(checklist_pane, BorderLayout.CENTER);
|
---|
577 | workflow_preferences_pane.add(predefined_pane, BorderLayout.SOUTH);
|
---|
578 |
|
---|
579 | return workflow_preferences_pane;
|
---|
580 | }
|
---|
581 |
|
---|
582 | public void dispose() {
|
---|
583 | // Unregister component
|
---|
584 | Dictionary.unregister(this);
|
---|
585 | Dictionary.unregister(tab_pane);
|
---|
586 | Dictionary.unregister(ok_button);
|
---|
587 | Dictionary.unregister(apply_button);
|
---|
588 | Dictionary.unregister(cancel_button);
|
---|
589 | Dictionary.unregister(library_path_label);
|
---|
590 | Dictionary.unregister(library_path_field);
|
---|
591 | Dictionary.unregister(use_proxy_checkbox);
|
---|
592 | Dictionary.unregister(program_label);
|
---|
593 | Dictionary.unregister(proxy_host_label);
|
---|
594 | Dictionary.unregister(proxy_host_field);
|
---|
595 | Dictionary.unregister(proxy_port_label);
|
---|
596 | Dictionary.unregister(proxy_port_field);
|
---|
597 | Dictionary.unregister(email_label);
|
---|
598 | Dictionary.unregister(email_field);
|
---|
599 | Dictionary.unregister(view_extracted_metadata_checkbox);
|
---|
600 | Dictionary.unregister(show_file_size_checkbox);
|
---|
601 | Dictionary.unregister(language_label);
|
---|
602 | Dictionary.unregister(language_combobox);
|
---|
603 | //Dictionary.unregister(recursion_depth_label);
|
---|
604 | //Dictionary.unregister(recursion_depth_spinner);
|
---|
605 | Dictionary.unregister(title_label);
|
---|
606 | Dictionary.unregister(workflow_browse);
|
---|
607 | Dictionary.unregister(workflow_mirror);
|
---|
608 | Dictionary.unregister(workflow_gather);
|
---|
609 | Dictionary.unregister(workflow_enrich);
|
---|
610 | Dictionary.unregister(workflow_design);
|
---|
611 | Dictionary.unregister(workflow_export);
|
---|
612 | Dictionary.unregister(workflow_create);
|
---|
613 | Dictionary.unregister(workflow_preview);
|
---|
614 | Dictionary.unregister(predefined_label);
|
---|
615 | // Dispose
|
---|
616 | super.dispose();
|
---|
617 | }
|
---|
618 |
|
---|
619 | private class OKButtonListener
|
---|
620 | implements ActionListener {
|
---|
621 | private boolean close;
|
---|
622 | public OKButtonListener(boolean close) {
|
---|
623 | this.close = close;
|
---|
624 | }
|
---|
625 | public void actionPerformed(ActionEvent event) {
|
---|
626 | // Submit the various changes.
|
---|
627 | // Connection preferences
|
---|
628 | String program_str = program_field.getText();
|
---|
629 | if(program_str.length() > 0 && program_str.indexOf("%1") == -1) {
|
---|
630 | program_str = program_str + " %1";
|
---|
631 | }
|
---|
632 | Gatherer.config.setPreviewCommand(program_str);
|
---|
633 |
|
---|
634 | String library_path_string = library_path_field.getText();
|
---|
635 | Gatherer.config.setString("general.exec_address", true, library_path_string);
|
---|
636 | if (!library_path_string.equals("")) {
|
---|
637 | try {
|
---|
638 | Gatherer.config.exec_address = new URL(library_path_string);
|
---|
639 | }
|
---|
640 | catch (MalformedURLException error) {
|
---|
641 | ///ystem.err.println("Error: Bad address: " + exec_address_string);
|
---|
642 | }
|
---|
643 | }
|
---|
644 | Gatherer.config.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
|
---|
645 | Gatherer.config.setString("general.proxy_host", true, proxy_host_field.getText());
|
---|
646 | Gatherer.config.setString("general.proxy_port", true, proxy_port_field.getValue() + "");
|
---|
647 | Gatherer.setProxy();
|
---|
648 |
|
---|
649 | // General preferences
|
---|
650 | Gatherer.config.setEmail(email_field.getText());
|
---|
651 |
|
---|
652 | Gatherer.config.set("general.show_file_size", Configuration.COLLECTION_SPECIFIC, show_file_size_checkbox.isSelected());
|
---|
653 | Gatherer.g_man.refreshTrees(DragTree.TREE_DISPLAY_CHANGED);
|
---|
654 |
|
---|
655 | Gatherer.config.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());
|
---|
656 | Gatherer.g_man.metaedit_pane.valueChanged((TreeSelectionEvent) null); // Refresh metadata table
|
---|
657 |
|
---|
658 | Gatherer.config.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry)language_combobox.getSelectedItem()).getLocale());
|
---|
659 |
|
---|
660 | //Gatherer.config.setInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC, ((Integer)recursion_depth_spinner.getValue()).intValue());
|
---|
661 |
|
---|
662 | // Mode preferences
|
---|
663 | int current_mode = Gatherer.config.getMode();
|
---|
664 | int new_mode;
|
---|
665 | if(assistant_mode_radio_button.isSelected()) {
|
---|
666 | new_mode = Configuration.ASSISTANT_MODE;
|
---|
667 | }
|
---|
668 | else if(systems_mode_radio_button.isSelected()) {
|
---|
669 | new_mode = Configuration.SYSTEMS_MODE;
|
---|
670 | }
|
---|
671 | else if(expert_mode_radio_button.isSelected()) {
|
---|
672 | new_mode = Configuration.EXPERT_MODE;
|
---|
673 | }
|
---|
674 | else {
|
---|
675 | new_mode = Configuration.LIBRARIAN_MODE;
|
---|
676 | }
|
---|
677 | // If there has been a change in modes, update the config, and also inform the persistant gui views that have a need to know
|
---|
678 | if(new_mode != current_mode) {
|
---|
679 | Gatherer.config.setMode(new_mode);
|
---|
680 | Gatherer.c_man.getCollection().cdm.modeChanged(new_mode);
|
---|
681 | Gatherer.g_man.modeChanged(new_mode);
|
---|
682 | }
|
---|
683 | // Warning preferences
|
---|
684 | for(int i = 0; i < warning_preferences_check_list.getEntryCount(); i++) {
|
---|
685 | Entry entry = warning_preferences_check_list.get(i);
|
---|
686 | Gatherer.config.set(entry.getProperty(), true, entry.isSelected());
|
---|
687 | }
|
---|
688 | // Workflow preferences
|
---|
689 | Gatherer.config.set("workflow.browse", false, workflow_browse.isSelected());
|
---|
690 | Gatherer.config.set("workflow.mirror", false, workflow_mirror.isSelected());
|
---|
691 | Gatherer.config.set("workflow.gather", false, workflow_gather.isSelected());
|
---|
692 | Gatherer.config.set("workflow.enrich", false, workflow_enrich.isSelected());
|
---|
693 | Gatherer.config.set("workflow.design", false, workflow_design.isSelected());
|
---|
694 | Gatherer.config.set("workflow.export", false, workflow_export.isSelected());
|
---|
695 | Gatherer.config.set("workflow.create", false, workflow_create.isSelected());
|
---|
696 | Gatherer.config.set("workflow.preview", false, workflow_preview.isSelected());
|
---|
697 | Gatherer.g_man.workflowUpdate("Hunt", workflow_browse.isSelected());
|
---|
698 | Gatherer.g_man.workflowUpdate("Mirror", workflow_mirror.isSelected());
|
---|
699 | Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected());
|
---|
700 | Gatherer.g_man.workflowUpdate("Enrich", workflow_enrich.isSelected());
|
---|
701 | Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE));
|
---|
702 | Gatherer.g_man.workflowUpdate("Export", workflow_export.isSelected());
|
---|
703 | Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected());
|
---|
704 | Gatherer.g_man.workflowUpdate("Preview", workflow_preview.isSelected());
|
---|
705 | // Hide dialog
|
---|
706 | if(close) {
|
---|
707 | self.dispose();
|
---|
708 | }
|
---|
709 | }
|
---|
710 | }
|
---|
711 |
|
---|
712 | private class CancelButtonListener
|
---|
713 | implements ActionListener {
|
---|
714 | public void actionPerformed(ActionEvent event) {
|
---|
715 | self.dispose();
|
---|
716 | }
|
---|
717 | }
|
---|
718 |
|
---|
719 | private class DictionaryEntry
|
---|
720 | implements Comparable {
|
---|
721 | private Locale locale;
|
---|
722 | private String description;
|
---|
723 | public DictionaryEntry(Locale locale) {
|
---|
724 | this.description = null;
|
---|
725 | this.locale = locale;
|
---|
726 | }
|
---|
727 | public DictionaryEntry(String description, Locale locale) {
|
---|
728 | this.description = description;
|
---|
729 | this.locale = locale;
|
---|
730 | }
|
---|
731 | public int compareTo(Object object) {
|
---|
732 | return toString().compareTo(object.toString());
|
---|
733 | }
|
---|
734 | public boolean equals(Object object) {
|
---|
735 | return toString().equals(object.toString());
|
---|
736 | }
|
---|
737 | public Locale getLocale() {
|
---|
738 | return locale;
|
---|
739 | }
|
---|
740 | public String toString() {
|
---|
741 | if(description != null) {
|
---|
742 | return description;
|
---|
743 | }
|
---|
744 | else {
|
---|
745 | return locale.getDisplayName();
|
---|
746 | }
|
---|
747 | }
|
---|
748 | }
|
---|
749 |
|
---|
750 | /** This listener updates the mode description depending on what mode is selected. */
|
---|
751 | private class ModeRadioButtonListener
|
---|
752 | implements ActionListener {
|
---|
753 | public void actionPerformed(ActionEvent event) {
|
---|
754 | Object source = event.getSource();
|
---|
755 | if(source == assistant_mode_radio_button) {
|
---|
756 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description"));
|
---|
757 | }
|
---|
758 | else if(source == expert_mode_radio_button) {
|
---|
759 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description"));
|
---|
760 | }
|
---|
761 | else if(source == systems_mode_radio_button) {
|
---|
762 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description"));
|
---|
763 | }
|
---|
764 | else {
|
---|
765 | mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description"));
|
---|
766 | }
|
---|
767 | source = null;
|
---|
768 | }
|
---|
769 | }
|
---|
770 |
|
---|
771 | private class PredefinedActionListener
|
---|
772 | implements ActionListener {
|
---|
773 | public void actionPerformed(ActionEvent event) {
|
---|
774 | JComboBox cb = (JComboBox) event.getSource();
|
---|
775 | WorkflowElementWrapper element = (WorkflowElementWrapper) cb.getSelectedItem();
|
---|
776 | CheckboxUpdater task = new CheckboxUpdater(element);
|
---|
777 | SwingUtilities.invokeLater(task);
|
---|
778 | }
|
---|
779 |
|
---|
780 | private class CheckboxUpdater
|
---|
781 | implements Runnable {
|
---|
782 | private WorkflowElementWrapper element;
|
---|
783 | public CheckboxUpdater(WorkflowElementWrapper element) {
|
---|
784 | this.element = element;
|
---|
785 | }
|
---|
786 | public void run() {
|
---|
787 | workflow_browse.setSelected(element.getEnabled("browse"));
|
---|
788 | workflow_create.setSelected(element.getEnabled("create"));
|
---|
789 | workflow_mirror.setSelected(element.getEnabled("mirror"));
|
---|
790 | workflow_gather.setSelected(element.getEnabled("gather"));
|
---|
791 | workflow_enrich.setSelected(element.getEnabled("enrich"));
|
---|
792 | workflow_design.setSelected(element.getEnabled("design"));
|
---|
793 | workflow_export.setSelected(element.getEnabled("export"));
|
---|
794 | workflow_preview.setSelected(element.getEnabled("preview"));
|
---|
795 | }
|
---|
796 | }
|
---|
797 | }
|
---|
798 |
|
---|
799 | private class LanguageComboboxListener
|
---|
800 | implements ActionListener {
|
---|
801 | public void actionPerformed(ActionEvent event) {
|
---|
802 | // Retrieve the entry
|
---|
803 | DictionaryEntry entry = (DictionaryEntry) language_combobox.getSelectedItem();
|
---|
804 | if(entry != null) {
|
---|
805 | //Gatherer.dictionary.changeDictionary(entry.getLocale());
|
---|
806 | // Display message
|
---|
807 | JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Preferences.General.Restart_Required"), Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
|
---|
808 | }
|
---|
809 | }
|
---|
810 | }
|
---|
811 |
|
---|
812 | private class UseProxyListener
|
---|
813 | implements ActionListener {
|
---|
814 | public void actionPerformed(ActionEvent event) {
|
---|
815 | boolean enabled = use_proxy_checkbox.isSelected();
|
---|
816 | Gatherer.config.set("general.use_proxy", true, enabled);
|
---|
817 | // Fortunately this is already driven by the event thread.
|
---|
818 | proxy_host_field.setEnabled(enabled);
|
---|
819 | proxy_port_field.setEnabled(enabled);
|
---|
820 | }
|
---|
821 | }
|
---|
822 |
|
---|
823 | private class WorkflowElementWrapper {
|
---|
824 | private Element element;
|
---|
825 | private String text;
|
---|
826 | public WorkflowElementWrapper(Element element) {
|
---|
827 | this.element = element;
|
---|
828 | }
|
---|
829 | public boolean getEnabled(String name) {
|
---|
830 | boolean result = true;
|
---|
831 | if(element.getAttribute(name).equalsIgnoreCase("false")) {
|
---|
832 | result = false;
|
---|
833 | }
|
---|
834 | return result;
|
---|
835 | }
|
---|
836 | public String toString() {
|
---|
837 | if(text == null) {
|
---|
838 | text = element.getFirstChild().getNodeValue();
|
---|
839 | }
|
---|
840 | return text;
|
---|
841 | }
|
---|
842 | }
|
---|
843 | }
|
---|