001: /**
002: * Miroslav Popov, Dec 7, 2005
003: * miroslav.popov@gmail.com
004: */package org.enhydra.jawe.base.editor;
005:
006: import java.awt.Color;
007: import java.net.URL;
008: import java.util.Properties;
009:
010: import javax.swing.Action;
011: import javax.swing.ImageIcon;
012:
013: import org.enhydra.jawe.ActionBase;
014: import org.enhydra.jawe.AdditionalResourceManager;
015: import org.enhydra.jawe.JaWEAction;
016: import org.enhydra.jawe.JaWEComponent;
017: import org.enhydra.jawe.ResourceManager;
018: import org.enhydra.jawe.Utils;
019: import org.enhydra.jawe.base.controller.JaWEActions;
020: import org.enhydra.jawe.base.editor.actions.ApplyChanges;
021: import org.enhydra.jawe.base.editor.actions.DisplayParentElementPanel;
022: import org.enhydra.jawe.base.panel.PanelSettings;
023:
024: /**
025: * @author Miroslav Popov
026: *
027: */
028: public class NewStandardXPDLEditorSettings extends PanelSettings {
029:
030: public void init(JaWEComponent comp) {
031: loadDefault(comp, new Properties());
032: }
033:
034: public void loadDefault(JaWEComponent comp, Properties properties) {
035: arm = new AdditionalResourceManager(properties);
036:
037: componentSettings.put("UseScrollBar", new Boolean(properties
038: .getProperty("InlinePanel.UseScrollBar", "false")
039: .equals("true")));
040: componentSettings.put("ShowModifiedWarning", new Boolean(
041: properties.getProperty(
042: "InlinePanel.ShowModifiedWarning", "true")
043: .equals("true")));
044: componentSettings.put("DisplayTitle", new Boolean(properties
045: .getProperty("InlinePanel.DisplayTitle", "false")
046: .equals("true")));
047: componentSettings.put("XMLBasicPanel.RightAllignment",
048: new Boolean(properties.getProperty(
049: "XMLBasicPanel.RightAllignment", "false")
050: .equals("true")));
051: componentSettings.put("XMLDataTypesPanel.HasBorder",
052: new Boolean(properties.getProperty(
053: "XMLDataTypesPanel.HasBorder", "false").equals(
054: "true")));
055:
056: componentSettings.put("EmptyBorder.TOP", new Integer(properties
057: .getProperty("XMLBasicPanel.EmptyBorder.TOP", "0")));
058: componentSettings.put("EmptyBorder.LEFT", new Integer(
059: properties.getProperty(
060: "XMLBasicPanel.EmptyBorder.LEFT", "3")));
061: componentSettings.put("EmptyBorder.BOTTOM", new Integer(
062: properties.getProperty(
063: "XMLBasicPanel.EmptyBorder.BOTTOM", "4")));
064: componentSettings.put("EmptyBorder.RIGHT", new Integer(
065: properties.getProperty(
066: "XMLBasicPanel.EmptyBorder.RIGHT", "3")));
067: componentSettings.put("SimplePanelTextWidth", new Integer(
068: properties.getProperty(
069: "XMLBasicPanel.SimplePanelTextWidth", "250")));
070: componentSettings.put("SimplePanelTextHeight", new Integer(
071: properties.getProperty(
072: "XMLBasicPanel.SimplePanelTextHeight", "20")));
073: componentSettings.put("XMLDataTypesPanel.Dimension.WIDTH",
074: new Integer(properties.getProperty(
075: "XMLDataTypesPanel.Dimension.WIDTH", "400")));
076: componentSettings.put("XMLDataTypesPanel.Dimension.HEIGHT",
077: new Integer(properties.getProperty(
078: "XMLDataTypesPanel.Dimension.HEIGHT", "125")));
079:
080: componentSettings.put("XMLComboPanel.DisableCombo", properties
081: .getProperty("XMLComboPanel.DisableCombo", ""));
082:
083: componentSettings
084: .put("HideElements.XMLTablePanel.ExtendedAttributes",
085: "Name");
086: componentSettings
087: .put(
088: "HideElements.XMLTablePanel.ExtendedAttributes.Name",
089: "JaWE_CONFIGURATION JaWE_TYPE EDITING_TOOL EDITING_TOOL_VERSION JaWE_GRAPH_WORKFLOW_PARTICIPANT_ORIENTATION JaWE_GRAPH_BLOCK_PARTICIPANT_ORIENTATION JaWE_GRAPH_WORKFLOW_PARTICIPANT_ORDER JaWE_GRAPH_BLOCK_PARTICIPANT_ORDER JaWE_GRAPH_START_OF_WORKFLOW JaWE_GRAPH_END_OF_WORKFLOW JaWE_GRAPH_START_OF_BLOCK JaWE_GRAPH_END_OF_BLOCK JaWE_GRAPH_PARTICIPANT_ID JaWE_GRAPH_OFFSET JaWE_GRAPH_BREAK_POINTS JaWE_GRAPH_TRANSITION_STYLE");
090:
091: componentSettings
092: .put("ShowColumns.XMLTablePanel.Activities",
093: "Id Name Performer Type StartMode FinishMode Deadlines");
094: componentSettings.put("ShowColumns.XMLTablePanel.ActivitySets",
095: "Id Activities Transitions");
096: componentSettings.put("ShowColumns.XMLTablePanel.Applications",
097: "Id Name");
098: componentSettings.put("ShowColumns.XMLTablePanel.DataFields",
099: "Id Name DataType");
100: componentSettings.put(
101: "ShowColumns.XMLTablePanel.ExtendedAttributes",
102: "Name Value");
103: componentSettings.put(
104: "ShowColumns.XMLTablePanel.FormalParameters",
105: "Id Mode DataType");
106: componentSettings.put("ShowColumns.XMLTablePanel.Namespaces",
107: "Name location");
108: componentSettings.put("ShowColumns.XMLTablePanel.Participants",
109: "Id Name ParticipantType");
110: componentSettings.put("ShowColumns.XMLTablePanel.Tools",
111: "Id Type");
112: componentSettings.put("ShowColumns.XMLTablePanel.Transitions",
113: "Id From To Condition");
114: componentSettings.put(
115: "ShowColumns.XMLTablePanel.TypeDeclarations",
116: "Id Name DataTypes");
117: componentSettings.put(
118: "ShowColumns.XMLTablePanel.WorkflowProcesses",
119: "Id Name AccessLevel");
120:
121: componentSettings.put("defaultToolbarToolbar", "Apply");
122:
123: Color color = null;
124: try {
125: color = Utils.getColor(ResourceManager.getResourceString(
126: properties, "BackgroundColor"));
127: } catch (Exception e) {
128: color = Utils.getColor("R=245,G=245,B=245");
129: }
130: componentSettings.put("BackgroundColor", color);
131:
132: ImageIcon hicon;
133: URL iconURL = ResourceManager.getResource(properties,
134: "ArrowRightImage");
135: if (iconURL != null)
136: hicon = new ImageIcon(iconURL);
137: else
138: hicon = new ImageIcon(
139: ResourceManager.class
140: .getClassLoader()
141: .getResource(
142: "org/enhydra/jawe/images/navigate_right.png"));
143: componentSettings.put("ArrowRightImage", hicon);
144:
145: iconURL = ResourceManager.getResource(properties,
146: "ArrowUpImage");
147: if (iconURL != null)
148: hicon = new ImageIcon(iconURL);
149: else
150: hicon = new ImageIcon(ResourceManager.class
151: .getClassLoader().getResource(
152: "org/enhydra/jawe/images/arrowup.gif"));
153: componentSettings.put("ArrowUpImage", hicon);
154:
155: iconURL = ResourceManager.getResource(properties,
156: "ArrowDownImage");
157: if (iconURL != null)
158: hicon = new ImageIcon(iconURL);
159: else
160: hicon = new ImageIcon(ResourceManager.class
161: .getClassLoader().getResource(
162: "org/enhydra/jawe/images/arrowdown.gif"));
163: componentSettings.put("ArrowDownImage", hicon);
164:
165: iconURL = ResourceManager.getResource(properties,
166: "InsertVariableDefault.Icon");
167: if (iconURL != null)
168: hicon = new ImageIcon(iconURL);
169: else
170: hicon = new ImageIcon(
171: ResourceManager.class
172: .getClassLoader()
173: .getResource(
174: "org/enhydra/jawe/images/navigate_right2.png"));
175: componentSettings.put("InsertVariableDefault", hicon);
176:
177: iconURL = ResourceManager.getResource(properties,
178: "InsertVariablePressed.Icon");
179: if (iconURL != null)
180: hicon = new ImageIcon(iconURL);
181: else
182: hicon = new ImageIcon(
183: ResourceManager.class
184: .getClassLoader()
185: .getResource(
186: "org/enhydra/jawe/images/navigate_down2.png"));
187: componentSettings.put("InsertVariablePressed", hicon);
188:
189: iconURL = ResourceManager.getResource(properties,
190: "DefaultAction.Image.New");
191: if (iconURL != null)
192: hicon = new ImageIcon(iconURL);
193: else
194: hicon = new ImageIcon(ResourceManager.class
195: .getClassLoader().getResource(
196: "org/enhydra/jawe/images/new_small.gif"));
197: componentSettings.put("DefaultAction.Icon."
198: + JaWEActions.NEW_ACTION, hicon);
199:
200: iconURL = ResourceManager.getResource(properties,
201: "DefaultAction.Image.EditProperties");
202: if (iconURL != null)
203: hicon = new ImageIcon(iconURL);
204: else
205: hicon = new ImageIcon(ResourceManager.class
206: .getClassLoader().getResource(
207: "org/enhydra/jawe/images/edit_small.gif"));
208: componentSettings.put("DefaultAction.Icon."
209: + JaWEActions.EDIT_PROPERTIES_ACTION, hicon);
210:
211: iconURL = ResourceManager.getResource(properties,
212: "DefaultAction.Image.Delete");
213: if (iconURL != null)
214: hicon = new ImageIcon(iconURL);
215: else
216: hicon = new ImageIcon(ResourceManager.class
217: .getClassLoader().getResource(
218: "org/enhydra/jawe/images/delete_small.gif"));
219: componentSettings.put("DefaultAction.Icon."
220: + JaWEActions.DELETE_ACTION, hicon);
221:
222: iconURL = ResourceManager.getResource(properties,
223: "DefaultAction.Image.Duplicate");
224: if (iconURL != null)
225: hicon = new ImageIcon(iconURL);
226: else
227: hicon = new ImageIcon(
228: ResourceManager.class
229: .getClassLoader()
230: .getResource(
231: "org/enhydra/jawe/images/duplicate_small.gif"));
232: componentSettings.put("DefaultAction.Icon."
233: + JaWEActions.DUPLICATE_ACTION, hicon);
234:
235: iconURL = ResourceManager.getResource(properties,
236: "DefaultAction.Image.References");
237: if (iconURL != null)
238: hicon = new ImageIcon(iconURL);
239: else
240: hicon = new ImageIcon(
241: ResourceManager.class
242: .getClassLoader()
243: .getResource(
244: "org/enhydra/jawe/images/references_small.gif"));
245: componentSettings.put("DefaultAction.Icon."
246: + JaWEActions.REFERENCES, hicon);
247:
248: loadDefaultMenusToolbarsAndActions(comp);
249:
250: }
251:
252: protected void loadDefaultMenusToolbarsAndActions(JaWEComponent comp) {
253: // toolbar
254: componentSettings.put("defaultToolbarToolbar",
255: "ApplyChanges - DisplayParentElementPanel");
256: // actions
257: ActionBase action;
258: ImageIcon icon;
259: String langDepName;
260: JaWEAction ja;
261:
262: // ApplyChanges
263: action = new ApplyChanges(comp);
264: icon = new ImageIcon(ResourceManager.class.getClassLoader()
265: .getResource("org/enhydra/jawe/images/check.gif"));
266: langDepName = "Apply";
267: ja = new JaWEAction(action, icon, langDepName);
268: componentAction.put(action.getValue(Action.NAME), ja);
269:
270: // DisplayParentElementPanel
271: action = new DisplayParentElementPanel(comp);
272: icon = new ImageIcon(
273: ResourceManager.class
274: .getClassLoader()
275: .getResource(
276: "org/enhydra/jawe/images/parentelementpanel.gif"));
277: langDepName = "ParentElementPanel";
278: ja = new JaWEAction(action, icon, langDepName);
279: componentAction.put(action.getValue(Action.NAME), ja);
280: }
281:
282: public String getToolbarActionOrder(String toolbarName) {
283: return (String) componentSettings.get(toolbarName + "Toolbar");
284: }
285:
286: }
|