source: gli/trunk/src/org/greenstone/gatherer/gui/Preferences.java@ 18376

Last change on this file since 18376 was 18372, checked in by kjdon, 15 years ago

set the ComponentOrientation for a few things, for RTL gli

  • Property svn:keywords set to Author Date Id Revision
File size: 45.5 KB
Line 
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 */
27package org.greenstone.gatherer.gui;
28
29import java.awt.*;
30import java.awt.event.*;
31import java.io.*;
32import java.net.*;
33import java.util.*;
34import javax.swing.*;
35import javax.swing.event.*;
36import javax.swing.plaf.*;
37import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
38import org.greenstone.gatherer.Configuration;
39import org.greenstone.gatherer.GAuthenticator;
40import org.greenstone.gatherer.DebugStream;
41import org.greenstone.gatherer.Dictionary;
42import org.greenstone.gatherer.Gatherer;
43import org.greenstone.gatherer.cdm.ClassifierManager;
44import org.greenstone.gatherer.cdm.LanguageManager;
45import org.greenstone.gatherer.cdm.PluginManager;
46import org.greenstone.gatherer.collection.Collection;
47import org.greenstone.gatherer.gui.tree.DragTree;
48import org.greenstone.gatherer.util.ArrayTools; // just for debug
49import org.greenstone.gatherer.util.CheckList;
50import org.greenstone.gatherer.util.CheckListEntry;
51import org.greenstone.gatherer.util.StaticStrings;
52import org.greenstone.gatherer.util.XMLTools;
53import org.w3c.dom.*;
54
55public class Preferences
56 extends ModalDialog
57{
58 static final public String CONNECTION_PREFS = "connection";
59 static final public String GENERAL_PREFS = "general";
60
61 static final private Dimension LABEL_SIZE = new Dimension(280, 25);
62 static final private Dimension ROW_SIZE = new Dimension(640, 25);
63 static final private Dimension SIZE = new Dimension(640, 345);
64 static final private String TRUE = "true";
65
66 private CheckList warning_preferences_check_list;
67 private EmailField email_field;
68 private JButton apply_button;
69 private JButton cancel_button;
70 private JButton ok_button;
71 private JCheckBox show_file_size_checkbox;
72 private JCheckBox use_proxy_checkbox;
73 private JCheckBox view_extracted_metadata_checkbox;
74 private JCheckBox workflow_download;
75 private JCheckBox workflow_gather;
76 private JCheckBox workflow_enrich;
77 private JCheckBox workflow_design;
78 private JCheckBox workflow_create;
79 private JCheckBox workflow_format;
80 private JComboBox language_combobox;
81 private JComboBox servlet_combobox; // GS3
82 private JComboBox site_combobox; // GS3
83 private JRadioButton assistant_mode_radio_button;
84 private JRadioButton expert_mode_radio_button;
85 private JRadioButton librarian_mode_radio_button;
86 private JRadioButton systems_mode_radio_button;
87 private JSpinner proxy_port_field;
88 private JTabbedPane tab_pane;
89 private JTextArea mode_description_textarea;
90 private JTextField font_field;
91 private JTextField gliserver_url_field;
92 private JTextField library_path_field;
93 private JTextField program_field;
94 private JTextField proxy_host_field;
95 private Preferences self;
96
97 private String current_site_selection;
98
99 public Preferences() {
100 this(GENERAL_PREFS);
101 }
102
103 public Preferences(String initial_view) {
104 // Initialize
105 super(Gatherer.g_man, true);
106 this.self = this;
107 setSize(SIZE);
108 setTitle(Dictionary.get("Preferences"));
109 setJMenuBar(new SimpleMenuBar("preferences"));
110
111 // Creation
112 JPanel content_pane = (JPanel) getContentPane();
113 content_pane.setComponentOrientation(Dictionary.getOrientation());
114 tab_pane = new JTabbedPane();
115 tab_pane.setComponentOrientation(Dictionary.getOrientation());
116 JPanel general_preferences = createGeneralPreferences();
117 general_preferences.setComponentOrientation(Dictionary.getOrientation());
118 tab_pane.addTab(Dictionary.get("Preferences.General"), null, general_preferences, Dictionary.get("Preferences.General_Tooltip"));
119 tab_pane.addTab(Dictionary.get("Preferences.Mode"), null, createModePreferences(), Dictionary.get("Preferences.Mode_Tooltip"));
120 // tab_pane.addTab(Dictionary.get("Preferences.Workflow"), null, createWorkflowPreferences(), Dictionary.get("Preferences.Workflow_Tooltip"));
121 JPanel connection_preferences = createConnectionPreferences();
122 connection_preferences.setComponentOrientation(Dictionary.getOrientation());
123 tab_pane.addTab(Dictionary.get("Preferences.Connection"), null, connection_preferences, Dictionary.get("Preferences.Connection_Tooltip"));
124 tab_pane.addTab(Dictionary.get("Preferences.Warnings"), null, createWarningPreferences(), Dictionary.get("Preferences.Warnings_Tooltip"));
125
126 JPanel button_pane = new JPanel();
127 button_pane.setComponentOrientation(Dictionary.getOrientation());
128 ok_button = new GLIButton(Dictionary.get("General.OK"), Dictionary.get("General.OK_Tooltip"));
129
130 apply_button = new GLIButton(Dictionary.get("General.Apply"), Dictionary.get("General.Apply_Tooltip"));
131
132 cancel_button = new GLIButton(Dictionary.get("General.Cancel"), Dictionary.get("General.Cancel_Tooltip"));
133
134 // Connection
135 ok_button.addActionListener(new OKButtonListener(true));
136 apply_button.addActionListener(new OKButtonListener(false));
137 cancel_button.addActionListener(new CancelButtonListener());
138
139 // Layout
140 button_pane.setBorder(BorderFactory.createEmptyBorder(5,2,2,2));
141 button_pane.setLayout(new GridLayout(1,3,0,5));
142 button_pane.add(ok_button);
143 button_pane.add(apply_button);
144 button_pane.add(cancel_button);
145 button_pane.setComponentOrientation(Dictionary.getOrientation());
146
147 content_pane.setLayout(new BorderLayout());
148 content_pane.add(tab_pane, BorderLayout.CENTER);
149 content_pane.add(button_pane, BorderLayout.SOUTH);
150 content_pane.setComponentOrientation(Dictionary.getOrientation());
151
152 Dimension frame_size = Gatherer.g_man.getSize();
153 Point frame_location = Gatherer.g_man.getLocation();
154 setLocation(((frame_size.width - SIZE.width) / 2), ((frame_size.height - SIZE.height)));
155
156 // Bring the desired pane to the fore
157 if (initial_view.equals(CONNECTION_PREFS)) {
158 tab_pane.setSelectedComponent(connection_preferences);
159 }
160 else {
161 tab_pane.setSelectedComponent(general_preferences);
162 }
163
164 // Clean up
165 general_preferences = null;
166 connection_preferences = null;
167 frame_location = null;
168 frame_size = null;
169 cancel_button = null;
170 ok_button = null;
171 button_pane = null;
172 tab_pane = null;
173 content_pane = null;
174
175 setVisible(true);
176 }
177
178 private JPanel createConnectionPreferences() {
179 JPanel program_pane = new JPanel();
180 program_pane.setComponentOrientation(Dictionary.getOrientation());
181 program_pane.setPreferredSize(ROW_SIZE);
182 JLabel program_label = new JLabel(Dictionary.get("Preferences.Connection.ProgramCommand"));
183 program_label.setPreferredSize(LABEL_SIZE);
184 program_label.setComponentOrientation(Dictionary.getOrientation());
185
186 program_field = new JTextField(Configuration.getPreviewCommand());
187 program_field.setCaretPosition(0);
188 program_field.setToolTipText(Dictionary.get("Preferences.Connection.ProgramCommand_Tooltip"));
189 program_field.setComponentOrientation(Dictionary.getOrientation());
190
191 JPanel library_path_pane = new JPanel();
192 library_path_pane.setPreferredSize(ROW_SIZE);
193 library_path_pane.setComponentOrientation(Dictionary.getOrientation());
194 JLabel library_path_label = new JLabel();
195 library_path_label.setPreferredSize(LABEL_SIZE);
196 library_path_label.setComponentOrientation(Dictionary.getOrientation());
197 String library_url_string = "";
198 if (Configuration.library_url != null) {
199 library_url_string = Configuration.library_url.toString();
200 }
201 library_path_field = new JTextField(library_url_string);
202 library_path_field.setCaretPosition(0);
203 library_path_field.setComponentOrientation(Dictionary.getOrientation());
204 if (Gatherer.GS3) {
205 library_path_label.setText(Dictionary.get("Preferences.Connection.Library_Path_GS3"));
206 library_path_field.setToolTipText(Dictionary.get("Preferences.Connection.Library_Path_Tooltip_GS3"));
207 } else {
208 library_path_label.setText(Dictionary.get("Preferences.Connection.Library_Path"));
209 library_path_field.setToolTipText(Dictionary.get("Preferences.Connection.Library_Path_Tooltip"));
210 }
211
212 // Disable this field when using the applet, as it is automatically determined
213 library_path_label.setEnabled(!Gatherer.isApplet);
214 library_path_field.setEnabled(!Gatherer.isApplet);
215
216 JPanel gliserver_url_pane = null;
217 JLabel gliserver_url_label = null;
218 if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
219 gliserver_url_pane = new JPanel();
220 gliserver_url_pane.setPreferredSize(ROW_SIZE);
221 gliserver_url_label = new JLabel(Dictionary.get("Preferences.Connection.GLIServer_URL"));
222 gliserver_url_label.setPreferredSize(LABEL_SIZE);
223 gliserver_url_label.setComponentOrientation(Dictionary.getOrientation());
224 String gliserver_url_string = "";
225 if (Configuration.gliserver_url != null) {
226 gliserver_url_string = Configuration.gliserver_url.toString();
227 }
228 gliserver_url_field = new JTextField(gliserver_url_string);
229 gliserver_url_field.setComponentOrientation(Dictionary.getOrientation());
230 gliserver_url_field.setCaretPosition(0);
231 gliserver_url_field.setToolTipText(Dictionary.get("Preferences.Connection.GLIServer_URL_Tooltip"));
232
233 // Disable this field when using the applet, as it is automatically determined
234 gliserver_url_label.setEnabled(!Gatherer.isApplet);
235 gliserver_url_field.setEnabled(!Gatherer.isApplet);
236 }
237
238 JPanel site_pane = null;
239 JLabel site_label = null;
240 JPanel servlet_pane = null;
241 JLabel servlet_label = null;
242 if (Gatherer.GS3) {
243 site_pane = new JPanel();
244 site_pane.setPreferredSize(ROW_SIZE);
245 site_pane.setComponentOrientation(Dictionary.getOrientation());
246 site_label = new JLabel(Dictionary.get("Preferences.Connection.Site"));
247 site_label.setPreferredSize(LABEL_SIZE);
248 site_label.setComponentOrientation(Dictionary.getOrientation());
249 // what should we do if Gatherer.servlet_config.getSites() is null?
250 site_combobox = new JComboBox(Gatherer.servlet_config.getSites().toArray());
251 site_combobox.setOpaque(false);
252 site_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Site_Tooltip"));
253 site_combobox.setComponentOrientation(Dictionary.getOrientation());
254
255 servlet_pane = new JPanel();
256 servlet_pane.setPreferredSize(ROW_SIZE);
257 servlet_pane.setComponentOrientation(Dictionary.getOrientation());
258
259 servlet_label = new JLabel(Dictionary.get("Preferences.Connection.Servlet"));
260 servlet_label.setPreferredSize(LABEL_SIZE);
261 servlet_label.setComponentOrientation(Dictionary.getOrientation());
262 servlet_combobox = new JComboBox();
263 servlet_combobox.setOpaque(false);
264 servlet_combobox.setComponentOrientation(Dictionary.getOrientation());
265 // try to locate and select the current site
266 String this_site = Configuration.site_name;
267 for(int b = 0; b < site_combobox.getItemCount(); b++) {
268 String entry = (String) site_combobox.getItemAt(b);
269 if(this_site.equals(entry)) {
270 site_combobox.setSelectedIndex(b);
271 break;
272 }
273 }
274
275 // just in case its not the current one?
276 current_site_selection = (String)site_combobox.getSelectedItem();
277
278 ArrayList servlet_options = Gatherer.servlet_config.getServletsForSite(current_site_selection);
279 if (servlet_options == null) {
280 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip2"));
281 //servlet_combobox.setModel(new DefaultComboBoxModel());
282 servlet_combobox.setEnabled(false);
283 } else {
284 ///ystem.err.println(ArrayTools.objectArrayToString(servlet_options.toArray()));
285
286 servlet_combobox.setModel(new DefaultComboBoxModel(servlet_options.toArray()));
287 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip"));
288 servlet_combobox.setEnabled(true);
289 // try to locate and select the current servlet
290 String this_servlet = Configuration.getServletPath();
291 for(int b = 0; b < servlet_combobox.getItemCount(); b++) {
292 String entry = (String) servlet_combobox.getItemAt(b);
293 if(this_servlet.equals(entry)) {
294 servlet_combobox.setSelectedIndex(b);
295 break;
296 }
297 }
298
299 }
300 }
301
302 boolean currently_enabled = Configuration.get("general.use_proxy", true);
303 // Creation
304 JPanel connection_pane = new JPanel();
305 connection_pane.setComponentOrientation(Dictionary.getOrientation());
306 use_proxy_checkbox = new JCheckBox(Dictionary.get("Preferences.Connection.Use_Proxy"));
307 use_proxy_checkbox.setSelected(currently_enabled);
308 use_proxy_checkbox.setComponentOrientation(Dictionary.getOrientation());
309 use_proxy_checkbox.setPreferredSize(ROW_SIZE);
310
311 JPanel proxy_host_pane = new JPanel();
312 proxy_host_pane.setComponentOrientation(Dictionary.getOrientation());
313 proxy_host_pane.setPreferredSize(ROW_SIZE);
314
315 JLabel proxy_host_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Host"));
316 proxy_host_label.setComponentOrientation(Dictionary.getOrientation());
317 proxy_host_label.setPreferredSize(LABEL_SIZE);
318
319 proxy_host_field = new JTextField(Configuration.getString("general.proxy_host", true));
320 proxy_host_field.setEnabled(currently_enabled);
321 proxy_host_field.setToolTipText(Dictionary.get("Preferences.Connection.Proxy_Host_Tooltip"));
322 proxy_host_field.setComponentOrientation(Dictionary.getOrientation());
323
324 JPanel proxy_port_pane = new JPanel();
325 proxy_port_pane.setComponentOrientation(Dictionary.getOrientation());
326 proxy_port_pane.setPreferredSize(ROW_SIZE);
327
328 JLabel proxy_port_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Port"));
329 proxy_port_label.setPreferredSize(LABEL_SIZE);
330 proxy_port_label.setComponentOrientation(Dictionary.getOrientation());
331
332 String port_value = Configuration.getString("general.proxy_port", true);
333 if(port_value.length() > 0) {
334 proxy_port_field = new JSpinner(new SpinnerNumberModel((new Integer(port_value)).intValue(), 0, 65535, 1));
335 }
336 else {
337 proxy_port_field = new JSpinner(new SpinnerNumberModel(0, 0, 65535, 1));
338 }
339 proxy_port_field.setEnabled(currently_enabled);
340 proxy_port_field.setToolTipText(Dictionary.get("Preferences.Connection.Proxy_Port_Tooltip"));
341
342 // Connection
343 use_proxy_checkbox.addActionListener(new UseProxyListener());
344 if (Gatherer.GS3) {
345 site_combobox.addActionListener(new SiteComboboxListener());
346 }
347
348 // Layout
349 program_pane.setLayout(new BorderLayout());
350 program_pane.add(program_label, BorderLayout.LINE_START);
351 program_pane.add(program_field, BorderLayout.CENTER);
352
353 library_path_pane.setLayout(new BorderLayout());
354 library_path_pane.add(library_path_label, BorderLayout.LINE_START);
355 library_path_pane.add(library_path_field, BorderLayout.CENTER);
356
357 if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
358 gliserver_url_pane.setLayout(new BorderLayout());
359 gliserver_url_pane.add(gliserver_url_label, BorderLayout.LINE_START);
360 gliserver_url_pane.add(gliserver_url_field, BorderLayout.CENTER);
361 }
362
363 if (Gatherer.GS3) {
364 site_pane.setLayout(new BorderLayout());
365 site_pane.add(site_label, BorderLayout.LINE_START);
366 site_pane.add(site_combobox, BorderLayout.CENTER);
367
368 servlet_pane.setLayout(new BorderLayout());
369 servlet_pane.add(servlet_label, BorderLayout.LINE_START);
370 servlet_pane.add(servlet_combobox, BorderLayout.CENTER);
371 }
372
373 proxy_host_pane.setLayout(new BorderLayout());
374 proxy_host_pane.add(proxy_host_label, BorderLayout.LINE_START);
375 proxy_host_pane.add(proxy_host_field, BorderLayout.CENTER);
376
377 proxy_port_pane.setLayout(new BorderLayout());
378 proxy_port_pane.add(proxy_port_label, BorderLayout.LINE_START);
379 proxy_port_pane.add(proxy_port_field, BorderLayout.CENTER);
380
381 connection_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
382 connection_pane.setLayout(new GridLayout(8,1,0,2));
383 connection_pane.add(program_pane);
384 connection_pane.add(library_path_pane);
385 if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
386 connection_pane.add(gliserver_url_pane);
387 }
388 if (Gatherer.GS3) {
389 connection_pane.add(site_pane);
390 connection_pane.add(servlet_pane);
391 }
392 connection_pane.add(use_proxy_checkbox);
393 connection_pane.add(proxy_host_pane);
394 connection_pane.add(proxy_port_pane);
395
396 return connection_pane;
397 }
398
399 private JPanel createGeneralPreferences() {
400 JPanel general_pane = new JPanel();
401 general_pane.setComponentOrientation(Dictionary.getOrientation());
402 // Build the model of available languages
403 ArrayList dictionary_model = new ArrayList();
404
405 // The new method makes use of the successor to the languages.dat file, classes/xml/languages.xml
406 NodeList language_elements = LanguageManager.LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT);
407 for(int i = 0; i < language_elements.getLength(); i++) {
408 Element language_element = (Element) language_elements.item(i);
409 if((language_element.getAttribute(StaticStrings.GLI_ATTRIBUTE)).equalsIgnoreCase(StaticStrings.TRUE_STR) || (language_element.getAttribute(StaticStrings.MDS_ATTRIBUTE)).equalsIgnoreCase(StaticStrings.TRUE_STR)) {
410 Locale locale = new Locale(language_element.getAttribute(StaticStrings.CODE_ATTRIBUTE));
411 String description = language_element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
412 DictionaryEntry entry = new DictionaryEntry(description, locale);
413 if(!dictionary_model.contains(entry)) {
414 dictionary_model.add(entry);
415 }
416 entry = null;
417 description = null;
418 locale = null;
419 }
420 language_element = null;
421 }
422 language_elements = null;
423
424 // Users email
425 JPanel email_pane = new JPanel();
426 email_pane.setComponentOrientation(Dictionary.getOrientation());
427
428 JLabel email_label = new JLabel(Dictionary.get("Preferences.General.Email"));
429 email_label.setComponentOrientation(Dictionary.getOrientation());
430 email_label.setPreferredSize(LABEL_SIZE);
431
432 email_field = new EmailField(Configuration.getColor("coloring.error_background", false));
433 email_field.setText(Configuration.getEmail());
434 email_field.setToolTipText(Dictionary.get("Preferences.General.Email_Tooltip"));
435 email_field.setComponentOrientation(Dictionary.getOrientation());
436 // Font selection
437 JPanel font_pane = new JPanel();
438 font_pane.setComponentOrientation(Dictionary.getOrientation());
439
440 JLabel font_label = new JLabel(Dictionary.get("Preferences.General.Font"));
441 font_label.setComponentOrientation(Dictionary.getOrientation());
442 font_label.setPreferredSize(LABEL_SIZE);
443
444 font_field = new JTextField(Configuration.getString("general.font", true));
445 font_field.setToolTipText(Dictionary.get("Preferences.General.Font_Tooltip"));
446 font_field.setComponentOrientation(Dictionary.getOrientation());
447
448 // Extracted metadata
449 view_extracted_metadata_checkbox = new JCheckBox(Dictionary.get("Preferences.General.View_Extracted_Metadata"));
450 view_extracted_metadata_checkbox.setSelected(false);
451 view_extracted_metadata_checkbox.setComponentOrientation(Dictionary.getOrientation());
452
453 if (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {
454 view_extracted_metadata_checkbox.setSelected(true);
455 }
456 view_extracted_metadata_checkbox.setToolTipText(Dictionary.get("Preferences.General.View_Extracted_Metadata_Tooltip"));
457 view_extracted_metadata_checkbox.setComponentOrientation(Dictionary.getOrientation());
458
459 // Show file sizes
460 show_file_size_checkbox = new JCheckBox(Dictionary.get("Preferences.General.Show_File_Size"));
461 show_file_size_checkbox.setSelected(false);
462 show_file_size_checkbox.setComponentOrientation(Dictionary.getOrientation());
463
464 if (Configuration.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) {
465 show_file_size_checkbox.setSelected(true);
466 }
467 show_file_size_checkbox.setToolTipText(Dictionary.get("Preferences.General.Show_File_Size_Tooltip"));
468
469 // Language
470 JPanel language_pane = new JPanel();
471 language_pane.setComponentOrientation(Dictionary.getOrientation());
472
473 JLabel language_label = new JLabel(Dictionary.get("Preferences.General.Interface_Language"));
474 language_label.setComponentOrientation(Dictionary.getOrientation());
475 language_label.setPreferredSize(LABEL_SIZE);
476
477 language_combobox = new JComboBox(dictionary_model.toArray());
478 language_combobox.setOpaque(false);
479 language_combobox.setToolTipText(Dictionary.get("Preferences.General.Interface_Language_Tooltip"));
480 language_combobox.setComponentOrientation(Dictionary.getOrientation());
481
482 // Try to locate and select the current language
483 String language_code = Configuration.getLanguage();
484 for (int b = 0; b < language_combobox.getItemCount(); b++) {
485 DictionaryEntry entry = (DictionaryEntry) language_combobox.getItemAt(b);
486 if (language_code.equalsIgnoreCase(entry.getLocale().getLanguage())) {
487 language_combobox.setSelectedIndex(b);
488 break;
489 }
490 }
491
492 // Layout
493 email_pane.setLayout(new BorderLayout());
494 email_pane.add(email_label, BorderLayout.LINE_START);
495 email_pane.add(email_field, BorderLayout.CENTER);
496
497 language_pane.setLayout(new BorderLayout());
498 language_pane.add(language_label, BorderLayout.LINE_START);
499 language_pane.add(language_combobox, BorderLayout.CENTER);
500
501 font_pane.setLayout(new BorderLayout());
502 font_pane.add(font_label, BorderLayout.LINE_START);
503 font_pane.add(font_field, BorderLayout.CENTER);
504
505 general_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
506 general_pane.setLayout(new GridLayout(5,1,0,5));
507 general_pane.add(email_pane);
508 general_pane.add(language_pane);
509 general_pane.add(font_pane);
510 general_pane.add(view_extracted_metadata_checkbox);
511 general_pane.add(show_file_size_checkbox);
512
513 return general_pane;
514 }
515
516 /** Generate the controls for altering the detail mode.
517 * @return a JPanel of controls
518 */
519 private JPanel createModePreferences() {
520 // Create Controls
521 JPanel mode_panel = new JPanel();
522 mode_panel.setComponentOrientation(Dictionary.getOrientation());
523
524 JPanel button_panel = new JPanel();
525 button_panel.setComponentOrientation(Dictionary.getOrientation());
526
527 ButtonGroup mode_button_group = new ButtonGroup();
528
529 assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant"));
530 assistant_mode_radio_button.setOpaque(false);
531 assistant_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
532 mode_button_group.add(assistant_mode_radio_button);
533
534 expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert"));
535 expert_mode_radio_button.setOpaque(false);
536 expert_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
537 mode_button_group.add(expert_mode_radio_button);
538
539 librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian"));
540 librarian_mode_radio_button.setOpaque(false);
541 librarian_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
542 mode_button_group.add(librarian_mode_radio_button);
543
544 systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems"));
545 systems_mode_radio_button.setOpaque(false);
546 systems_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
547 mode_button_group.add(systems_mode_radio_button);
548
549 mode_description_textarea = new JTextArea();
550 mode_description_textarea.setComponentOrientation(Dictionary.getOrientation());
551 mode_description_textarea.setEditable(false);
552 mode_description_textarea.setLineWrap(true);
553 mode_description_textarea.setWrapStyleWord(true);
554 // Determine which value is already selected
555 switch(Configuration.getMode()) {
556 case Configuration.ASSISTANT_MODE:
557 assistant_mode_radio_button.setSelected(true);
558 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description"));
559 break;
560 case Configuration.SYSTEMS_MODE:
561 systems_mode_radio_button.setSelected(true);
562 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description"));
563 break;
564 case Configuration.EXPERT_MODE:
565 expert_mode_radio_button.setSelected(true);
566 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description"));
567 break;
568 default:
569 librarian_mode_radio_button.setSelected(true);
570 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description"));
571 }
572 // Connection - when a radio button is selected we have to change the description
573 ModeRadioButtonListener listener = new ModeRadioButtonListener();
574 assistant_mode_radio_button.addActionListener(listener);
575 expert_mode_radio_button.addActionListener(listener);
576 librarian_mode_radio_button.addActionListener(listener);
577 systems_mode_radio_button.addActionListener(listener);
578 listener = null;
579 // Layout
580 button_panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
581 button_panel.setLayout(new GridLayout(4,1,2,2));
582 button_panel.add(assistant_mode_radio_button);
583 button_panel.add(librarian_mode_radio_button);
584 button_panel.add(systems_mode_radio_button);
585 button_panel.add(expert_mode_radio_button);
586
587 mode_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
588 mode_panel.setLayout(new BorderLayout());
589 mode_panel.add(button_panel, BorderLayout.NORTH);
590 mode_panel.add(new JScrollPane(mode_description_textarea), BorderLayout.CENTER);
591
592 return mode_panel;
593 }
594
595
596 /** The warning preferences are controlled through a checklist. */
597 private JPanel createWarningPreferences()
598 {
599 warning_preferences_check_list = new CheckList(false);
600 warning_preferences_check_list.setComponentOrientation(Dictionary.getOrientation());
601
602 // Read all the warnings from the general xml/config.xml file, and their values from the user config.xml file
603 Document general_config_xml_file_document = XMLTools.parseXMLFile("xml/config.xml", true);
604 NodeList argument_elements_nodelist = general_config_xml_file_document.getDocumentElement().getElementsByTagName("Argument");
605 for (int i = 0; i < argument_elements_nodelist.getLength(); i++) {
606 Element argument_element = (Element) argument_elements_nodelist.item(i);
607 String argument_element_name = argument_element.getAttribute("name");
608 if (argument_element_name.startsWith("warning.")) {
609 String warning_title = Dictionary.get(argument_element_name.substring("warning.".length()) + ".Title");
610 boolean warning_enabled = Configuration.get(argument_element_name, true);
611 CheckListEntry warning_entry = new CheckListEntry(warning_title, warning_enabled);
612 warning_entry.setProperty(argument_element_name);
613 warning_preferences_check_list.addEntry(warning_entry);
614 }
615 }
616
617 JPanel warning_preferences_pane = new JPanel();
618 warning_preferences_pane.setComponentOrientation(Dictionary.getOrientation());
619 warning_preferences_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
620 warning_preferences_pane.setLayout(new BorderLayout());
621 JScrollPane scrol_tmp = new JScrollPane(warning_preferences_check_list);
622 scrol_tmp.setComponentOrientation(Dictionary.getOrientation());
623 warning_preferences_pane.add(scrol_tmp, BorderLayout.CENTER);
624 return warning_preferences_pane;
625 }
626
627
628 private JPanel createWorkflowPreferences() {
629 // Read in the predefined configurations file
630 Vector predefined = new Vector();
631 Document predefined_document = XMLTools.parseXMLFile("xml/workflows.xml", true);
632 Element predefined_element = predefined_document.getDocumentElement();
633 NodeList workflow_elements = predefined_element.getElementsByTagName("Workflow");
634 for(int i = 0; i < workflow_elements.getLength(); i++) {
635 predefined.add(new WorkflowElementWrapper((Element)workflow_elements.item(i)));
636 }
637
638 // Creation
639 JPanel workflow_preferences_pane = new JPanel();
640 workflow_preferences_pane.setComponentOrientation(Dictionary.getOrientation());
641
642 JPanel checklist_pane = new JPanel();
643 checklist_pane.setComponentOrientation(Dictionary.getOrientation());
644
645 JLabel title_label = new JLabel(Dictionary.get("Preferences.Workflow.Title"));
646 title_label.setComponentOrientation(Dictionary.getOrientation());
647 title_label.setPreferredSize(ROW_SIZE);
648
649 workflow_download = new JCheckBox(Dictionary.get("GUI.Download")+" - "+Dictionary.get("GUI.Download_Tooltip"));
650 workflow_download.setComponentOrientation(Dictionary.getOrientation());
651 workflow_download.setSelected(Configuration.get("workflow.download", false));
652 workflow_download.setPreferredSize(ROW_SIZE);
653
654 workflow_gather = new JCheckBox(Dictionary.get("GUI.Gather")+" - "+Dictionary.get("GUI.Gather_Tooltip"));
655 workflow_gather.setSelected(Configuration.get("workflow.gather", false));
656 workflow_gather.setPreferredSize(ROW_SIZE);
657 workflow_gather.setComponentOrientation(Dictionary.getOrientation());
658
659 workflow_enrich = new JCheckBox(Dictionary.get("GUI.Enrich")+" - "+Dictionary.get("GUI.Enrich_Tooltip"));
660 workflow_enrich.setSelected(Configuration.get("workflow.enrich", false));
661 workflow_enrich.setPreferredSize(ROW_SIZE);
662 workflow_enrich.setComponentOrientation(Dictionary.getOrientation());
663
664 workflow_design = new JCheckBox(Dictionary.get("GUI.Design")+" - "+Dictionary.get("GUI.Design_Tooltip"));
665 workflow_design.setSelected(Configuration.get("workflow.design", false));
666 workflow_design.setPreferredSize(ROW_SIZE);
667 workflow_design.setComponentOrientation(Dictionary.getOrientation());
668
669 workflow_create = new JCheckBox(Dictionary.get("GUI.Create")+" - "+Dictionary.get("GUI.Create_Tooltip"));
670 workflow_create.setSelected(Configuration.get("workflow.create", false));
671 workflow_create.setPreferredSize(ROW_SIZE);
672 workflow_create.setComponentOrientation(Dictionary.getOrientation());
673
674 workflow_format = new JCheckBox(Dictionary.get("GUI.Format")+" - "+Dictionary.get("GUI.Format_Tooltip"));
675 workflow_format.setSelected(Configuration.get("workflow.format", false));
676 workflow_format.setPreferredSize(ROW_SIZE);
677 workflow_format.setComponentOrientation(Dictionary.getOrientation());
678
679 JPanel predefined_pane = new JPanel();
680 predefined_pane.setComponentOrientation(Dictionary.getOrientation());
681
682 JLabel predefined_label = new JLabel(Dictionary.get("Preferences.Workflow.Predefined.Label"));
683 predefined_label.setComponentOrientation(Dictionary.getOrientation());
684
685 JComboBox predefined_combobox = new JComboBox(predefined);
686 predefined_combobox.setOpaque(false);
687 // Connection
688 predefined_combobox.addActionListener(new PredefinedActionListener());
689
690 // Layout
691 checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS));
692 checklist_pane.add(title_label);
693 if (Configuration.get("workflow.download", true)) {
694 checklist_pane.add(workflow_download);
695 }
696 if (Configuration.get("workflow.gather", true)) {
697 checklist_pane.add(workflow_gather);
698 }
699 if (Configuration.get("workflow.enrich", true)) {
700 checklist_pane.add(workflow_enrich);
701 }
702 if (Configuration.get("workflow.design", true)) {
703 checklist_pane.add(workflow_design);
704 }
705 if (Configuration.get("workflow.create", true)) {
706 checklist_pane.add(workflow_create);
707 }
708 if (Configuration.get("workflow.format", true)) {
709 checklist_pane.add(workflow_format);
710 }
711
712 predefined_pane.setLayout(new BorderLayout(5,0));
713 predefined_pane.add(predefined_label, BorderLayout.LINE_START);
714 predefined_pane.add(predefined_combobox, BorderLayout.CENTER);
715
716 workflow_preferences_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
717 workflow_preferences_pane.setLayout(new BorderLayout());
718 workflow_preferences_pane.add(checklist_pane, BorderLayout.CENTER);
719 workflow_preferences_pane.add(predefined_pane, BorderLayout.SOUTH);
720
721 return workflow_preferences_pane;
722 }
723
724
725 private class OKButtonListener
726 implements ActionListener {
727 private boolean close;
728 public OKButtonListener(boolean close) {
729 this.close = close;
730 }
731 public void actionPerformed(ActionEvent event)
732 {
733 // Several options requiring restarting the GLI to apply:
734 // interface font, interface language, changed gliserver url or library url
735 boolean restart_required = false;
736 String restart_message = "";
737
738
739 // Connection preferences
740 String program_str = program_field.getText();
741 if (program_str.length() > 0 && program_str.indexOf("%1") == -1) {
742 program_str = program_str + " %1";
743 }
744 Configuration.setPreviewCommand(program_str);
745
746 String old_library_url = (Configuration.library_url == null) ? null : Configuration.library_url.toString();
747 String library_url_string = library_path_field.getText();
748 if(old_library_url != null && !old_library_url.equals(library_url_string)) {
749
750 // If the server is remote and the library path's been changed, then GLI client needs restart
751 // If the server is local, GLI is going to work with the collection of GSDLPath anyway,
752 // even if the library path for previewing has changed
753 if (Gatherer.isGsdlRemote) {
754 restart_required = true;
755 restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
756 }
757 if(Gatherer.c_man.getCollection() != null) {
758 // if the gliserver url has changed while a collection is open,
759 // close the open collection of the old library URL
760 Gatherer.c_man.saveCollection();
761 Gatherer.c_man.closeCollection();
762 Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
763 }
764 }
765 if (library_url_string.equals("")) {
766 Configuration.library_url = null;
767 }
768 else {
769 try {
770 Configuration.library_url = new URL(library_url_string);
771 }
772 catch (MalformedURLException exception) {
773 DebugStream.printStackTrace(exception);
774 }
775 }
776
777 Configuration.setString("general.library_url"+Configuration.gliPropertyNameSuffix(),
778 true, library_url_string);
779
780 if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
781 String old_gliserver_url = Configuration.gliserver_url.toString();
782 String gliserver_url_string = gliserver_url_field.getText();
783 if(!old_gliserver_url.equals(gliserver_url_string)) {
784 restart_required = true;
785 restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
786
787 if(Gatherer.c_man.getCollection() != null) {
788 // if the gliserver url has changed while a collection is open,
789 // close the open collection of the old gliserver URL
790 Gatherer.c_man.saveCollection();
791 Gatherer.c_man.closeCollection();
792 Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
793 }
794 }
795 if (gliserver_url_string.equals("")) {
796 Configuration.gliserver_url = null;
797 }
798 else {
799 try {
800 Configuration.gliserver_url = new URL(gliserver_url_string);
801 }
802 catch (MalformedURLException exception) {
803 DebugStream.printStackTrace(exception);
804 }
805 }
806 Configuration.setString("general.gliserver_url", true, gliserver_url_string);
807 }
808
809
810 boolean site_changed = false;
811 if (Gatherer.GS3) {
812 String current_site = Configuration.site_name;
813 String new_site =(String)site_combobox.getSelectedItem() ;
814 if (!new_site.equals(current_site)) {
815 site_changed = true;
816 }
817 Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem());
818 }
819
820 Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
821 Configuration.setString("general.proxy_host", true, proxy_host_field.getText());
822 Configuration.setString("general.proxy_port", true, proxy_port_field.getValue() + "");
823 Gatherer.setProxy();
824
825 // General preferences
826 Configuration.setEmail(email_field.getText());
827 Configuration.set("general.show_file_size", Configuration.COLLECTION_SPECIFIC, show_file_size_checkbox.isSelected());
828 Configuration.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());
829
830
831 // GLI interface font
832 String current_font = Configuration.getString("general.font", true);
833 if (!current_font.equals(font_field.getText())) {
834 Configuration.setString("general.font", true, font_field.getText());
835 restart_required = true;
836 restart_message = Dictionary.get("Preferences.General.Restart_Required");
837 }
838
839 // GLI interface language
840 String current_lang = Configuration.getLanguage();
841 if (!current_lang.equals(((DictionaryEntry) language_combobox.getSelectedItem()).getLocale().getLanguage())) {
842 Configuration.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry) language_combobox.getSelectedItem()).getLocale());
843 restart_required = true;
844 restart_message = Dictionary.get("Preferences.General.Restart_Required");
845 }
846
847 // Inform the user that a restart is required, if necessary
848 if (restart_required) {
849 JOptionPane.showMessageDialog(Gatherer.g_man, restart_message, Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
850 }
851
852 // Mode preferences
853 int current_mode = Configuration.getMode();
854 int new_mode;
855 if (assistant_mode_radio_button.isSelected()) {
856 new_mode = Configuration.ASSISTANT_MODE;
857 }
858 else if (systems_mode_radio_button.isSelected()) {
859 new_mode = Configuration.SYSTEMS_MODE;
860 }
861 else if (expert_mode_radio_button.isSelected()) {
862 new_mode = Configuration.EXPERT_MODE;
863 }
864 else {
865 new_mode = Configuration.LIBRARIAN_MODE;
866 }
867
868 // If there has been a change in modes, update the config, and also inform the persistant gui views that have a need to know
869 if (new_mode != current_mode) {
870 Configuration.setMode(new_mode);
871 Collection collection = Gatherer.c_man.getCollection();
872 if (collection != null) {
873 collection.cdm.modeChanged(new_mode);
874 }
875 Gatherer.g_man.modeChanged(new_mode);
876 }
877
878 // Warning preferences
879 ListModel warning_preferences_check_list_model = warning_preferences_check_list.getModel();
880 for (int i = 0; i < warning_preferences_check_list_model.getSize(); i++) {
881 CheckListEntry entry = (CheckListEntry) warning_preferences_check_list_model.getElementAt(i);
882 Configuration.set(entry.getProperty(), true, entry.isSelected());
883 }
884
885 if (Gatherer.GS3 && site_changed && Gatherer.c_man.getCollection() != null && !Gatherer.isGsdlRemote) {
886 // shut down the collection
887 System.err.println("shutting down the collection");
888 Gatherer.g_man.saveThenCloseCurrentCollection();
889 }
890
891 // Workflow preferences
892// Configuration.set("workflow.download", false, workflow_download.isSelected());
893// Configuration.set("workflow.gather", false, workflow_gather.isSelected());
894// Configuration.set("workflow.enrich", false, workflow_enrich.isSelected());
895// Configuration.set("workflow.design", false, workflow_design.isSelected());
896// Configuration.set("workflow.create", false, workflow_create.isSelected());
897// Configuration.set("workflow.format", false, workflow_format.isSelected());
898
899// Gatherer.g_man.workflowUpdate("Download", workflow_download.isSelected());
900// Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected());
901// Gatherer.g_man.workflowUpdate("Enrich", workflow_enrich.isSelected());
902// Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Configuration.getMode() > Configuration.ASSISTANT_MODE));
903// Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected());
904// Gatherer.g_man.workflowUpdate("Format", workflow_format.isSelected());
905
906 // Always save configuration changes immediately (in case the GLI crashes)
907 Configuration.save();
908 if (Gatherer.isGsdlRemote && Gatherer.GS3 && site_changed ){
909 Gatherer.remoteGreenstoneServer.downloadCollectionConfigurations();
910 }
911 // Refresh the GLI to account for the configuration changes
912 Gatherer.refresh(Gatherer.PREFERENCES_CHANGED);
913
914 // Hide dialog
915 if (close) {
916 self.dispose();
917 }
918
919 if (restart_required) {
920 Gatherer.g_man.exit(Gatherer.EXIT_THEN_RESTART);
921 }
922 }
923 }
924
925 private class CancelButtonListener
926 implements ActionListener {
927 public void actionPerformed(ActionEvent event) {
928 self.dispose();
929 }
930 }
931
932 private class DictionaryEntry
933 implements Comparable {
934 private Locale locale;
935 private String description;
936 public DictionaryEntry(Locale locale) {
937 this.description = null;
938 this.locale = locale;
939 }
940 public DictionaryEntry(String description, Locale locale) {
941 this.description = description;
942 this.locale = locale;
943 }
944 public int compareTo(Object object) {
945 return toString().compareTo(object.toString());
946 }
947 public boolean equals(Object object) {
948 return toString().equals(object.toString());
949 }
950 public Locale getLocale() {
951 return locale;
952 }
953 public String toString() {
954 if(description != null) {
955 return description;
956 }
957 else {
958 return locale.getDisplayName();
959 }
960 }
961 }
962
963 /** This listener updates the mode description depending on what mode is selected. */
964 private class ModeRadioButtonListener
965 implements ActionListener {
966 public void actionPerformed(ActionEvent event) {
967 Object source = event.getSource();
968 if(source == assistant_mode_radio_button) {
969 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description"));
970 }
971 else if(source == expert_mode_radio_button) {
972 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description"));
973 }
974 else if(source == systems_mode_radio_button) {
975 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description"));
976 }
977 else {
978 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description"));
979 }
980 source = null;
981 }
982 }
983
984 private class PredefinedActionListener
985 implements ActionListener {
986 public void actionPerformed(ActionEvent event) {
987 JComboBox cb = (JComboBox) event.getSource();
988 WorkflowElementWrapper element = (WorkflowElementWrapper) cb.getSelectedItem();
989 CheckboxUpdater task = new CheckboxUpdater(element);
990 SwingUtilities.invokeLater(task);
991 }
992
993 private class CheckboxUpdater
994 implements Runnable {
995 private WorkflowElementWrapper element;
996 public CheckboxUpdater(WorkflowElementWrapper element) {
997 this.element = element;
998 }
999 public void run() {
1000 workflow_download.setSelected(element.getEnabled("download"));
1001 workflow_gather.setSelected(element.getEnabled("gather"));
1002 workflow_enrich.setSelected(element.getEnabled("enrich"));
1003 workflow_design.setSelected(element.getEnabled("design"));
1004 workflow_create.setSelected(element.getEnabled("create"));
1005 workflow_format.setSelected(element.getEnabled("format"));
1006 }
1007 }
1008 }
1009
1010
1011 private class SiteComboboxListener
1012 implements ActionListener {
1013 private boolean ignore_event=false;
1014 public void actionPerformed(ActionEvent event) {
1015 System.err.println("event occurred "+event.paramString());
1016 String site = (String) site_combobox.getSelectedItem();
1017 System.err.println("The site changed to = "+site);
1018 if (!site.equals(current_site_selection)) {
1019 current_site_selection = site;
1020 System.err.println("changed the current selection");
1021
1022 ArrayList servlet_options = Gatherer.servlet_config.getServletsForSite(current_site_selection);
1023 if (servlet_options == null) {
1024 ///ystem.err.println("no servlets for this site");
1025 servlet_combobox.setModel(new DefaultComboBoxModel());
1026 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip2"));
1027 servlet_combobox.setEnabled(false);
1028
1029 } else {
1030 ///ystem.err.println(ArrayTools.objectArrayToString(servlet_options.toArray()));
1031 servlet_combobox.setModel(new DefaultComboBoxModel(servlet_options.toArray()));
1032 servlet_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Servlet_Tooltip"));
1033 servlet_combobox.setEnabled(true);
1034 }
1035 if (Gatherer.isGsdlRemote){
1036 // Close the current collection, remove the lock on this file, ask to login to the new site, then download collection configurations of the site.
1037 if (Gatherer.c_man.getCollection()!=null){
1038 File lock_file = new File(Gatherer.c_man.getLoadedCollectionDirectoryPath() + "gli.lck");
1039 Gatherer.remoteGreenstoneServer.deleteCollectionFile(Gatherer.c_man.getLoadedCollectionName(),lock_file);
1040 Gatherer.g_man.closeCurrentCollection();
1041 }
1042 Configuration.site_name=site;
1043 Gatherer.remoteGreenstoneServer.set_remote_greenstone_server_authentication_to_null();
1044 Gatherer.remoteGreenstoneServer.downloadCollectionConfigurations();
1045 }
1046 }
1047 }
1048 }
1049
1050 private class UseProxyListener
1051 implements ActionListener {
1052 public void actionPerformed(ActionEvent event) {
1053 boolean enabled = use_proxy_checkbox.isSelected();
1054 Configuration.set("general.use_proxy", true, enabled);
1055 // Fortunately this is already driven by the event thread.
1056 proxy_host_field.setEnabled(enabled);
1057 proxy_port_field.setEnabled(enabled);
1058 }
1059 }
1060
1061 private class WorkflowElementWrapper {
1062 private Element element;
1063 private String text;
1064 public WorkflowElementWrapper(Element element) {
1065 this.element = element;
1066 }
1067 public boolean getEnabled(String name) {
1068 boolean result = true;
1069 if(element.getAttribute(name).equalsIgnoreCase("false")) {
1070 result = false;
1071 }
1072 return result;
1073 }
1074 public String toString() {
1075 if (text == null) {
1076 text = Dictionary.get(element.getFirstChild().getNodeValue());
1077 }
1078 return text;
1079 }
1080 }
1081}
Note: See TracBrowser for help on using the repository browser.