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

Last change on this file since 4928 was 4928, checked in by jmt12, 21 years ago

Major CDM rewrite so it uses DOM.

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