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

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

Tried to change button colours

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