01: /**
02: * Miroslav Popov, Nov 29, 2005 miroslav.popov@gmail.com
03: */package org.enhydra.jawe.components.xpdlview;
04:
05: import java.awt.Color;
06: import java.net.URL;
07: import java.util.Properties;
08:
09: import javax.swing.ImageIcon;
10:
11: import org.enhydra.jawe.AdditionalResourceManager;
12: import org.enhydra.jawe.JaWE;
13: import org.enhydra.jawe.JaWEComponent;
14: import org.enhydra.jawe.JaWEComponentSettings;
15: import org.enhydra.jawe.ResourceManager;
16: import org.enhydra.jawe.Utils;
17:
18: /**
19: * @author Miroslav Popov
20: */
21: public class XPDLViewSettings extends JaWEComponentSettings {
22:
23: public void init(JaWEComponent comp) {
24: PROPERTYFILE_PATH = "org/enhydra/jawe/components/xpdlview/properties/";
25: PROPERTYFILE_NAME = "togwexpdlview.properties";
26: super .init(comp);
27: }
28:
29: public void loadDefault(JaWEComponent comp, Properties properties) {
30: // defaults
31: arm = new AdditionalResourceManager(properties);
32:
33: componentSettings.put("ShowHighlight", new Boolean(properties
34: .getProperty("ShowHighlight", "false").equals("true")));
35: componentSettings.put("ShowXPDLDetails",
36: new Boolean(properties.getProperty("ShowXPDLDetails",
37: "false").equals("true")));
38:
39: ImageIcon findNext;
40: URL iconURL = ResourceManager.getResource(properties,
41: "Image.FindNext");
42: if (iconURL != null)
43: findNext = new ImageIcon(iconURL);
44: else
45: findNext = new ImageIcon(ResourceManager.class
46: .getClassLoader().getResource(
47: "org/enhydra/jawe/images/findnext.png"));
48: componentSettings.put("FindNext", findNext);
49:
50: Color color = null;
51: try {
52: color = Utils.getColor(ResourceManager.getResourceString(
53: properties, "BackgroundColor"));
54: } catch (Exception e) {
55: color = Utils.getColor("R=245,G=245,B=245");
56: }
57: componentSettings.put("BackgroundColor", color);
58:
59: componentSettings.putAll(Utils
60: .loadAllMenusAndToolbars(properties));
61: componentAction.putAll(Utils.loadActions(properties, comp,
62: componentAction));
63: }
64:
65: public boolean showHighlight() {
66: if (JaWE.getJaWEVersion() == JaWE.COMMUNITY_VERSION
67: && !JaWE.addOnsAvailable()) {
68: return false;
69: }
70: return ((Boolean) componentSettings.get("ShowHighlight"))
71: .booleanValue();
72: }
73:
74: public boolean showXPDLDetails() {
75: if (JaWE.getJaWEVersion() == JaWE.COMMUNITY_VERSION
76: && !JaWE.addOnsAvailable()) {
77: return false;
78: }
79: return ((Boolean) componentSettings.get("ShowXPDLDetails"))
80: .booleanValue();
81: }
82:
83: public ImageIcon getFindNextIcon() {
84: return (ImageIcon) componentSettings.get("FindNext");
85: }
86:
87: public Color getBackgroundColor() {
88: return (Color) componentSettings.get("BackgroundColor");
89: }
90:
91: }
|