source: trunk/gli/src/org/greenstone/gatherer/Configuration.java@ 5785

Last change on this file since 5785 was 5785, checked in by mdewsnip, 21 years ago

Commented out about 60 unused functions.

  • Property svn:keywords set to Author Date Id Revision
File size: 28.4 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 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer;
38
39import java.awt.*;
40import java.io.*;
41import java.lang.ref.*;
42import java.net.*;
43import java.util.*;
44import javax.swing.*;
45import javax.swing.plaf.*;
46import org.greenstone.gatherer.msm.MSMUtils;
47import org.greenstone.gatherer.util.Utility;
48import org.w3c.dom.*;
49
50/** This class stores the various configurable settings inside the Gatherer, both during a session, and between sessions in the form of XML. However not all data members are retained during xml serialization. To further improve efficiency, the property-name -> DOM Element pairs are stored in a SoftReferenced Hashtable.
51 * @author John Thompson, Greenstone Digital Library, University of Waikato
52 * @version 2.3
53 */
54public class Configuration
55 extends Hashtable {
56
57 static final public boolean COLLECTION_SPECIFIC = true;
58 static final public boolean GENERAL_SETTING = true;
59
60 /** The string identifying an argument's name attribute. */
61 static final private String ARGUMENT_NAME = "name";
62 /** The name of the general Gatherer configuration file. */
63 static final private String CONFIG_XML = "config.xml";
64 /** The name of the root element of the subtree containing gatherer configuration options. This is required as the document itself may contain several other subtrees of settings (such as in the case of a '.col' file). */
65 static final private String GATHERER_CONFIG = "GathererConfig";
66 /** The string identifying an argument element. */
67 static final private String GATHERER_CONFIG_ARGUMENT = "Argument";
68 /** The name of a Name Element. */
69 static final private String NAME = "Name";
70 /** The name of the other arguments element. */
71 static final private String OTHER = "Other";
72 /** The name of an information Element within the Other subtree. */
73 static final private String OTHER_INFO = "Info";
74 /** The name of the general Gatherer configuration template. */
75 static final private String TEMPLATE_CONFIG_XML = "xml/config.xml";
76 /** The first of two patterns used during tokenization, this pattern handles a comma separated list. */
77 static final private String TOKENIZER_PATTERN1 = " ,\n\t";
78 /** The second of two patterns used during tokenization, this pattern handles an underscore separated list. */
79 static final private String TOKENIZER_PATTERN2 = "_\n\t";
80
81 public File exec_file;
82 /** The path (or url) to the webserver which is serving the Greenstone collection. */
83 public String exec_path = null;
84 /** The path to the Greenstone Suite installation directory. */
85 public String gsdl_path = "";
86 /** The path to the PERL executable, up to and including Perl.exe. */
87 public String perl_path = "";
88 /** The password for the proxy server indicated above. */
89 public String proxy_pass = null;
90 /** The username for the proxy server indicated above. */
91 public String proxy_user = null;
92 /** The language selected for the interface. Currently hard-wired. */
93 public String interface_language = "en";
94 /** The screen size of the desktop the Gatherer will be displayed on. */
95 public Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
96 /** Collection level configuration (which in some cases overrides general configuration. */
97 private Document collection_config;
98 /** The general configuration settings. */
99 private Document general_config;
100 private int cache_hit = 0;
101 private int cache_miss = 0;
102 public URL exec_address = null;
103
104 /** Constructor.
105 * @param gsdl_path The path to the Greenstone directory as a <strong>String</strong>.
106 * @param exec_path A <strong>String</strong> containing the path or url to the webserver serving the greenstone collections.
107 * @param perl_path The path to the PERL executable, as a <strong>String</strong>.
108 */
109 public Configuration(String gsdl_path, String exec_path, String perl_path) {
110 super();
111 this.gsdl_path = gsdl_path;
112 this.exec_path = exec_path;
113 // The exec_path may contain an url address, in which case we blindly use that and leave it up to the user to worry about settings and resetting.
114 Gatherer.println("EXEC_PATH = " + exec_path);
115 if(exec_path != null && exec_path.length() > 0) {
116 try {
117 exec_address = new URL(exec_path);
118 }
119 catch (MalformedURLException error) {
120 ///ystem.err.println("Not an address.");
121 }
122 }
123 // If the above failed, then its up to us to try and figure out what to do.
124 if(exec_address == null) {
125 // Try building a file from the given exec_path
126 try {
127 File local_file = new File(exec_path);
128 if(local_file.exists()) {
129 // All good. I hope.
130 exec_file = local_file;
131 }
132 else {
133 ///ystem.err.println("No local library at given file path.");
134 }
135 }
136 // All sorts of errors might be thrown by a bogus file path.
137 catch (Exception error) {
138 Gatherer.println("Not a valid file.");
139 }
140 // We can generate the path to where the local library should be and use that if it is there.
141 if(exec_file == null) {
142 File server_exe = new File(gsdl_path + Utility.SERVER_EXE);
143 if(server_exe.exists()) {
144 exec_file = server_exe;
145 }
146 else {
147 ///ystem.err.println("No local library.");
148 }
149 }
150 // If we get to here with no exec_address nor an exec_file its just plain not going to work.
151 }
152 else {
153 ///ystem.err.println("exec_address != null -> " + exec_address);
154 }
155 ///ystem.err.println("Perl path.");
156 this.perl_path = perl_path;
157 // Ensure the perl path includes exe under windoze
158 if(Utility.isWindows() && !perl_path.toLowerCase().endsWith(".exe")) {
159 if(!perl_path.endsWith(File.separator)) {
160 perl_path = perl_path + File.separator;
161 }
162 perl_path = perl_path + "perl.exe";
163 }
164 // Try to reload the configuration.
165 File config_xml = new File(CONFIG_XML);
166 if(config_xml.exists()) {
167 general_config = Utility.parse(CONFIG_XML, false);
168 }
169 // If that fails retrieve the default configuration file from our xml library, which I'll personally guarantee to work.
170 if(general_config == null) {
171 general_config = Utility.parse(TEMPLATE_CONFIG_XML, true);
172 Gatherer.println("Loaded default Gatherer configuration template.");
173 }
174 else {
175 Gatherer.println("Loaded current Gatherer configuration.");
176 }
177 // Re-establish the color settings.
178 updateUI();
179
180 // If we have no exec_address, see if one was specified in the config file
181 if (exec_address == null) {
182 String exec_address_string = getString("general.exec_address", true);
183 if (!exec_address_string.equals("")) {
184 try {
185 exec_address = new URL(exec_address_string);
186 }
187 catch (MalformedURLException error) {
188 ///ystem.err.println("Error: Bad address: " + exec_address_string);
189 }
190 }
191 }
192
193 Gatherer.println("EXEC_FILE = " + exec_file);
194 Gatherer.println("EXEC_ADDRESS = " + exec_address);
195 }
196
197 /** The default get action retrieves the named property from the desired configuration, and returns a true or false. */
198 public boolean get(String property, boolean general) {
199 String raw = getString(property, general);
200 return (raw != null && raw.equalsIgnoreCase("true"));
201 }
202
203 /** Retrieve all of the configuration preferences which match a certain string. They are returned as a hash map of property names to String objects. */
204 public HashMap getAll(String property_pattern, boolean general) {
205 HashMap properties = new HashMap();
206 try {
207 // Locate the appropriate element
208 Element document_element = null;
209 if(general) {
210 document_element = general_config.getDocumentElement();
211 }
212 else if(collection_config != null) {
213 document_element = collection_config.getDocumentElement();
214 }
215 if(document_element != null) {
216 // Retrieve the Gatherer element
217 Element gatherer_element = (Element) MSMUtils.getNodeFromNamed(document_element, GATHERER_CONFIG);
218 NodeList arguments = gatherer_element.getElementsByTagName(GATHERER_CONFIG_ARGUMENT);
219 for(int i = 0; i < arguments.getLength(); i++) {
220 Element argument_element = (Element) arguments.item(i);
221 if(argument_element.getAttribute(ARGUMENT_NAME).matches(property_pattern)) {
222 String result = MSMUtils.getValue(argument_element);
223 // Store a mapping in the cache. Sometimes we will overwrite an existing value (say for collection and general level workflow options) but the processing overhead of detecting these clashes far exceeds any savings.
224 put(argument_element.getAttribute(ARGUMENT_NAME) + general, new SoftReference(argument_element));
225 // Add mapping to the properties we're going to return
226 properties.put(argument_element.getAttribute(ARGUMENT_NAME), result);
227 }
228 }
229 }
230 }
231 catch(Exception error) {
232 }
233 return properties;
234 }
235
236 /** Retrieve the information subtree containing the arguments for the desired external program. If the program has marked superclasses append their arguments as well. */
237 public Element getArguments(String filename) {
238 Element argument_element = null;
239 try {
240 // Retrieve the other information subtree.
241 Element document_element = general_config.getDocumentElement();
242 Element other_element = (Element) MSMUtils.getNodeFromNamed(document_element, OTHER);
243 NodeList argument_elements = other_element.getElementsByTagName(OTHER_INFO);
244 for(int i = 0; argument_element == null && i < argument_elements.getLength(); i++) {
245 Element possible_element = (Element) argument_elements.item(i);
246 Element possible_name_element = (Element) MSMUtils.getNodeFromNamed(possible_element, NAME);
247 String possible_name = MSMUtils.getValue(possible_name_element);
248 ///ystem.err.println("Does " + possible_name + " equal " + filename);
249 if(possible_name.equalsIgnoreCase(filename)) {
250 argument_element = possible_element;
251 }
252 possible_name = null;
253 possible_name_element = null;
254 possible_element = null;
255 }
256 argument_elements = null;
257 other_element = null;
258 document_element = null;
259 }
260 catch(Exception error) {
261 }
262 return argument_element;
263 }
264
265 /** Retrieve the value of the named property as a Rectangle. */
266 public Rectangle getBounds(String property, boolean general) {
267 Rectangle result = null;
268 try {
269 String raw = getString(property, general);
270 // Rectangle is (x, y, width, height)
271 StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN1);
272 int x = Integer.parseInt(tokenizer.nextToken());
273 int y = Integer.parseInt(tokenizer.nextToken());
274 int width = Integer.parseInt(tokenizer.nextToken());
275 int height = Integer.parseInt(tokenizer.nextToken());
276 result = new Rectangle(x, y, width, height);
277 }
278 catch(Exception error) {
279 Gatherer.printStackTrace(error);
280 }
281 return result;
282 }
283
284 /** Retrieve the value of the named property as a Color. */
285 public Color getColor(String property, boolean general) {
286 Color result = Color.white; // Default
287 try {
288 String raw = getString(property, general);
289 // Color is a RGB triplet list, comma separated (also remove whitespace)
290 StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN1);
291 int red = Integer.parseInt(tokenizer.nextToken());
292 int green = Integer.parseInt(tokenizer.nextToken());
293 int blue = Integer.parseInt(tokenizer.nextToken());
294 result = new Color(red, green, blue);
295 }
296 catch(Exception error) {
297 Gatherer.printStackTrace(error);
298 }
299 return result;
300 }
301
302 /** Retrieve the value of the named property as a Dimension. */
303 /* private Dimension getDimension(String property, boolean general) {
304 Dimension result = new Dimension(100, 100); // Default
305 try {
306 String raw = getString(property, general);
307 // Dimension is a width by height pair, comma separated (also remove whitespace)
308 StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN1);
309 int width = Integer.parseInt(tokenizer.nextToken());
310 int height = Integer.parseInt(tokenizer.nextToken());
311 result = new Dimension(width, height);
312 }
313 catch(Exception error) {
314 Gatherer.printStackTrace(error);
315 }
316 return result;
317 } */
318
319 /** Retrieve the value of the named property as a FontUIResource. */
320 public FontUIResource getFont(String property, boolean general) {
321 FontUIResource result = new FontUIResource("Times New Roman", Font.PLAIN, 10);
322 try {
323 String raw = getString(property, general);
324 // Font is a face, style, size triplet.
325 StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN1);
326 String face = tokenizer.nextToken();
327 int style = Font.PLAIN;
328 String temp = tokenizer.nextToken().toUpperCase();
329 if(temp.equals("BOLD")) {
330 style = Font.BOLD;
331 }
332 else if(temp.equals("ITALIC")) {
333 style = Font.ITALIC;
334 }
335 int size = Integer.parseInt(tokenizer.nextToken());
336 result = new FontUIResource(face, style, size);
337 }
338 catch(Exception error) {
339 Gatherer.printStackTrace(error);
340 }
341 return result;
342 }
343
344 /** Retrieve the value of the named property as an integer. */
345 public int getInt(String property, boolean general) {
346 int result = -1;
347 try {
348 String raw = getString(property, general);
349 result = Integer.parseInt(raw);
350 }
351 catch(Exception error) {
352 Gatherer.printStackTrace(error);
353 }
354 return result;
355 }
356
357 /** Retrieve the value of the named property as a Locale. */
358 public Locale getLocale(String property, boolean general) {
359 Locale result = Locale.getDefault();
360 try {
361 String raw = getString(property, general);
362 // Locale is a underscore separated code.
363 StringTokenizer tokenizer = new StringTokenizer(raw, TOKENIZER_PATTERN2);
364 String language = tokenizer.nextToken();
365 if(tokenizer.hasMoreTokens()) {
366 String country = tokenizer.nextToken();
367 result = new Locale(language, country);
368 }
369 else {
370 result = new Locale(language);
371 }
372 }
373 catch(Exception error) {
374 Gatherer.printStackTrace(error);
375 }
376 return result;
377 }
378
379 /** Retrieve the value of the named property, and noting whether we consult the general or collection specific configuration. */
380 public String getString(String property, boolean general) {
381 // Its up to this method to find the appropriate node and retrieve the data itself.
382 String result = "";
383 try {
384 // First of all we look in the cache to see if we have a match.
385 SoftReference reference = (SoftReference) get(property + general);
386 if(reference != null) {
387 Element argument_element = (Element) reference.get();
388 if(argument_element != null) {
389 cache_hit++;
390 result = MSMUtils.getValue(argument_element);
391 }
392 }
393 // We may have missed in the cache, or the reference may have been consumed.
394 if(result.length() == 0) {
395 cache_miss++;
396 // Locate the appropriate element
397 Element document_element = null;
398 if(general) {
399 document_element = general_config.getDocumentElement();
400 }
401 else if(collection_config != null) {
402 document_element = collection_config.getDocumentElement();
403 }
404 if(document_element != null) {
405 // Retrieve the Gatherer element
406 Element gatherer_element = (Element) MSMUtils.getNodeFromNamed(document_element, GATHERER_CONFIG);
407 NodeList arguments = gatherer_element.getElementsByTagName(GATHERER_CONFIG_ARGUMENT);
408 for(int i = 0; result.length() == 0 && i < arguments.getLength(); i++) {
409 Element argument_element = (Element) arguments.item(i);
410 if(argument_element.getAttribute(ARGUMENT_NAME).equalsIgnoreCase(property)) {
411 result = MSMUtils.getValue(argument_element);
412 // Store a mapping in the cache. Sometimes we will overwrite an existing value (say for collection and general level workflow options) but the processing overhead of detecting these clashes far exceeds any savings.
413 put(property + general, new SoftReference(argument_element));
414 }
415 }
416 }
417 }
418 }
419 catch (Exception error) {
420 Gatherer.printStackTrace(error);
421 }
422 // If we still have no result, and the search was made in the collection configuration, retrieve the general one instead.
423 if(result.length() == 0 && !general) {
424 result = getString(property, true);
425 }
426 return result;
427 }
428
429 /** Retrieve the path to the PERL scripts within the Greenstone directory.
430 * @return A <strong>String</strong> containing the path.
431 */
432 public String getScriptPath() {
433 return gsdl_path + "bin" + File.separator + "script" + File.separator;
434 }
435
436 /** Export the general configuration to file. */
437 public void save() {
438 ///ystem.err.println("Hits " + cache_hit + " vs Misses " + cache_miss);
439 Utility.export(general_config, Utility.BASE_DIR + CONFIG_XML);
440 }
441
442 /** Set the named property, from the specified configuration, using the given boolean value. */
443 public void set(String property, boolean general, boolean value) {
444 if(property.startsWith("workflow")) {
445 System.err.println("Set property: " + property + ", general=" + general + ", value=" + value);
446 }
447 setString(property, general, (value ? "true" : "false"));
448 }
449
450 /** Add a subtree of argument information to the other arguments part of the general configuration. This overwrites any such existing subtree. */
451 public void setArguments(Element arguments_element) {
452 try {
453 Element document_element = general_config.getDocumentElement();
454 Element other_element = (Element) MSMUtils.getNodeFromNamed(document_element, OTHER);
455 // Retrieve the name of the information
456 Element arguments_name_element = (Element)MSMUtils.getNodeFromNamed(arguments_element, NAME);
457 String filename = MSMUtils.getValue(arguments_element);
458 // Find any argument information subtree starting with the same name
459 Element obsolete_arguments_element = getArguments(filename);
460 // Create a copy of the arguments_element within our tree (import).
461 Element our_arguments_element = (Element) general_config.importNode(arguments_element, true);
462 // Now we insert this new node into the tree. If a previous node exists we replace it instead.
463 if(obsolete_arguments_element == null) {
464 other_element.appendChild(our_arguments_element);
465 }
466 else {
467 other_element.replaceChild(our_arguments_element, obsolete_arguments_element);
468 }
469 our_arguments_element = null;
470 obsolete_arguments_element = null;
471 filename = null;
472 arguments_name_element = null;
473 other_element = null;
474 document_element = null;
475 }
476 catch (Exception error) {
477 Gatherer.println("Error in Configuration.setArguments(): " + error);
478 Gatherer.printStackTrace(error);
479 }
480 }
481
482 /** Set the collection configuration. */
483 public void setCollectionConfiguration(Document collection_config) {
484 this.collection_config = collection_config;
485 updateUI();
486 ///atherer.println("Collection configuration set.");
487 }
488
489 /** Set the named property, from the specified configuration, using the given Rectangle value. */
490 public void setBounds(String property, boolean general, Rectangle value) {
491 StringBuffer text = new StringBuffer("");
492 text.append(value.x);
493 text.append(", ");
494 text.append(value.y);
495 text.append(", ");
496 text.append(value.width);
497 text.append(", ");
498 text.append(value.height);
499 setString(property, general, text.toString());
500 }
501
502 /** Set the named property, from the specified configuration, using the given Color value. */
503 public void setColor(String property, boolean general, Color value) {
504 StringBuffer text = new StringBuffer("");
505 text.append(value.getRed());
506 text.append(", ");
507 text.append(value.getGreen());
508 text.append(", ");
509 text.append(value.getBlue());
510 setString(property, general, text.toString());
511 }
512
513 /** Set the named property, from the specified configuration, using the given Dimension value. */
514 /* private void setDimension(String property, boolean general, Dimension value) {
515 StringBuffer text = new StringBuffer("");
516 text.append(value.width);
517 text.append(", ");
518 text.append(value.height);
519 setString(property, general, text.toString());
520 } */
521
522 /** Set the named property, from the specified configuration, using the given Font value. */
523 public void setFont(String property, boolean general, Font value) {
524 StringBuffer text = new StringBuffer("");
525 text.append(value.getName());
526 text.append(", ");
527 switch(value.getStyle()) {
528 case Font.BOLD:
529 text.append("BOLD");
530 break;
531 case Font.ITALIC:
532 text.append("ITALIC");
533 break;
534 default:
535 text.append("PLAIN");
536 }
537 text.append(", ");
538 text.append(value.getSize());
539 setString(property, general, text.toString());
540 }
541
542 /** Set the named property, from the specified configuration, using the given integer value. */
543 /* private void setInt(String property, boolean general, int value) {
544 setString(property, general, String.valueOf(value));
545 } */
546
547 /** Set the named property, from the specified configuration, using the given Locale value. */
548 public void setLocale(String property, boolean general, Locale value) {
549 StringBuffer text = new StringBuffer("");
550 text.append(value.getLanguage());
551 String country = value.getCountry();
552 if(country != null && country.length() > 0) {
553 text.append("_");
554 text.append(country);
555 }
556 country = null;
557 setString(property, general, text.toString());
558 }
559
560 /** Sets the value of the named property argument using the given string. */
561 public void setString(String property, boolean general, String value) {
562 Gatherer.println("Set configuration property: " + property + " = " + value + (general ? "" : " [Collection]"));
563 try {
564 Document document = null;
565 if(general) {
566 document = general_config;
567 }
568 else if(collection_config != null) {
569 document = collection_config;
570 }
571 if(document != null) {
572 Element argument_element = null;
573 // Try to retrieve from cache
574 SoftReference reference = (SoftReference) get(property + general);
575 if(reference != null) {
576 argument_element = (Element) reference.get();
577 }
578 if(argument_element == null) {
579 Element document_element = document.getDocumentElement();
580 Element gatherer_element = (Element) MSMUtils.getNodeFromNamed(document_element, GATHERER_CONFIG);
581 NodeList arguments = document_element.getElementsByTagName(GATHERER_CONFIG_ARGUMENT);
582 boolean found = false;
583 for(int i = 0; argument_element == null && i < arguments.getLength(); i++) {
584 Element possible_element = (Element) arguments.item(i);
585 if(possible_element.getAttribute(ARGUMENT_NAME).equalsIgnoreCase(property)) {
586 argument_element = possible_element;
587 }
588 }
589 // If argument element is still null, create it in the target document.
590 if(argument_element == null) {
591 argument_element = document.createElement(GATHERER_CONFIG_ARGUMENT);
592 argument_element.setAttribute(ARGUMENT_NAME, property);
593 gatherer_element.appendChild(argument_element);
594 }
595 // Update cache
596 put(property + general, new SoftReference(argument_element));
597
598 }
599 if(value == null) {
600 value = "";
601 }
602 // Now remove any current text node children.
603 NodeList children = argument_element.getChildNodes();
604 for(int i = 0; i < children.getLength(); i++) {
605 argument_element.removeChild(children.item(i));
606 }
607 // Add a new text node child with the new value
608 argument_element.appendChild(document.createTextNode(value));
609 }
610 }
611 catch (Exception error) {
612 }
613 }
614
615 private void updateUI() {
616 // Buttons
617 UIManager.put("Button.select", new ColorUIResource(getColor("coloring.button_selected_background", false)));
618 UIManager.put("Button.background", new ColorUIResource(getColor("coloring.button_background", false)));
619 UIManager.put("Button.foreground", new ColorUIResource(getColor("coloring.button_foreground", false)));
620
621 UIManager.put("ToggleButton.background", new ColorUIResource(getColor("coloring.button_background", false)));
622 UIManager.put("ToggleButton.foreground", new ColorUIResource(getColor("coloring.button_foreground", false)));
623 UIManager.put("ToggleButton.select", new ColorUIResource(getColor("coloring.button_selected_background", false)));
624
625 // All the things with a lovely Collection green background
626 UIManager.put("OptionPane.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
627 UIManager.put("Panel.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
628 UIManager.put("Label.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
629 UIManager.put("TabbedPane.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
630 UIManager.put("SplitPane.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
631 UIManager.put("CheckBox.background", new ColorUIResource(getColor("coloring.collection_heading_background", false)));
632
633
634 // Editable coloring
635 UIManager.put("ComboBox.background", new ColorUIResource(getColor("coloring.collection_tree_background", false))); // Indicate clickable
636 UIManager.put("Tree.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
637 UIManager.put("Tree.textBackground", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
638 UIManager.put("ProgressBar.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
639 UIManager.put("TextArea.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
640 UIManager.put("TextField.background", new ColorUIResource(getColor("coloring.editable_background", false)));
641 UIManager.put("Table.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
642 UIManager.put("List.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
643 UIManager.put("RadioButton.background", new ColorUIResource(getColor("coloring.collection_tree_background", false)));
644
645 // Selection color
646 UIManager.put("TabbedPane.selected", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
647 UIManager.put("Tree.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
648 UIManager.put("ComboBox.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
649 UIManager.put("ProgressBar.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
650 UIManager.put("TextArea.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
651 UIManager.put("TextField.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
652 UIManager.put("List.selectionBackground", new ColorUIResource(getColor("coloring.collection_selection_background", false)));
653
654 // Scroll bar stuff
655 UIManager.put("ScrollBar.background", new ColorUIResource(getColor("coloring.scrollbar_background", false)));
656 UIManager.put("ScrollBar.thumb", new ColorUIResource(getColor("coloring.scrollbar_foreground", false)));
657 if (Gatherer.g_man != null) {
658 JPanel pane = (JPanel) Gatherer.g_man.getContentPane();
659 pane.updateUI();
660 // Also update all of the tabs according to workflow.
661 Gatherer.g_man.workflowUpdate("Hunt", get("workflow.browse", false));
662 Gatherer.g_man.workflowUpdate("Mirror", get("workflow.mirror", false));
663 Gatherer.g_man.workflowUpdate("Gather", get("workflow.gather", false));
664 Gatherer.g_man.workflowUpdate("Enrich", get("workflow.enrich", false));
665 Gatherer.g_man.workflowUpdate("Design", get("workflow.design", false));
666 Gatherer.g_man.workflowUpdate("Export", get("workflow.export", false));
667 Gatherer.g_man.workflowUpdate("Create", get("workflow.create", false));
668 Gatherer.g_man.workflowUpdate("Preview", get("workflow.preview", false));
669 }
670 }
671}
Note: See TracBrowser for help on using the repository browser.