0001: /**
0002: * Miroslav Popov, Dec 2, 2005 miroslav.popov@gmail.com
0003: */package org.enhydra.jawe.components.graph;
0004:
0005: import java.awt.BasicStroke;
0006: import java.awt.Color;
0007: import java.awt.Stroke;
0008: import java.net.URL;
0009: import java.util.Properties;
0010:
0011: import javax.swing.Action;
0012: import javax.swing.ImageIcon;
0013:
0014: import org.enhydra.jawe.ActionBase;
0015: import org.enhydra.jawe.AdditionalResourceManager;
0016: import org.enhydra.jawe.JaWEAction;
0017: import org.enhydra.jawe.JaWEComponent;
0018: import org.enhydra.jawe.JaWEComponentSettings;
0019: import org.enhydra.jawe.JaWEManager;
0020: import org.enhydra.jawe.ResourceManager;
0021: import org.enhydra.jawe.Utils;
0022: import org.enhydra.jawe.base.xpdlhandler.XPDLRepHandler;
0023: import org.enhydra.jawe.components.graph.actions.ActivityReferredDocument;
0024: import org.enhydra.jawe.components.graph.actions.ActualSize;
0025: import org.enhydra.jawe.components.graph.actions.AddPoint;
0026: import org.enhydra.jawe.components.graph.actions.DescendInto;
0027: import org.enhydra.jawe.components.graph.actions.GraphPaste;
0028: import org.enhydra.jawe.components.graph.actions.InsertActivitySet;
0029: import org.enhydra.jawe.components.graph.actions.InsertMissingStartAndEndBubbles;
0030: import org.enhydra.jawe.components.graph.actions.MoveDownParticipant;
0031: import org.enhydra.jawe.components.graph.actions.MoveUpParticipant;
0032: import org.enhydra.jawe.components.graph.actions.NextGraph;
0033: import org.enhydra.jawe.components.graph.actions.PreviousGraph;
0034: import org.enhydra.jawe.components.graph.actions.RemoveParticipant;
0035: import org.enhydra.jawe.components.graph.actions.RemovePoint;
0036: import org.enhydra.jawe.components.graph.actions.RemoveStartAndEndBubbles;
0037: import org.enhydra.jawe.components.graph.actions.SaveAsJPG;
0038: import org.enhydra.jawe.components.graph.actions.SaveAsSVG;
0039: import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingBezier;
0040: import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingOrthogonal;
0041: import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingSpline;
0042: import org.enhydra.jawe.components.graph.actions.SetTransitionStyleSimpleRoutingOrthogonal;
0043: import org.enhydra.jawe.components.graph.actions.SetTransitionStyleSimpleRoutingSpline;
0044: import org.enhydra.jawe.components.graph.actions.SimpleGraphLayout;
0045: import org.enhydra.jawe.components.graph.actions.ZoomIn;
0046: import org.enhydra.jawe.components.graph.actions.ZoomOut;
0047:
0048: /**
0049: * @author Miroslav Popov
0050: */
0051: public class GraphSettings extends JaWEComponentSettings {
0052:
0053: public static final Stroke DEPARTMENT_STROKE = new BasicStroke(2);
0054:
0055: public static final int UP = 1;
0056:
0057: public static final int DOWN = 2;
0058:
0059: public static final int LEFT = 3;
0060:
0061: public static final int RIGHT = 4;
0062:
0063: public void init(JaWEComponent comp) {
0064: PROPERTYFILE_PATH = "org/enhydra/jawe/components/graph/properties/";
0065: PROPERTYFILE_NAME = "togwegraphcontroller.properties";
0066: super .init(comp);
0067: }
0068:
0069: public void loadDefault(JaWEComponent comp, Properties properties) {
0070: arm = new AdditionalResourceManager(properties);
0071:
0072: componentSettings
0073: .put(
0074: "UseParticipantChoiceButton",
0075: new Boolean(
0076: properties
0077: .getProperty(
0078: "GraphPanel.UseParticipantChoiceButton",
0079: "true").equals("true")));
0080: componentSettings
0081: .put(
0082: "UseActivitySetChoiceButton",
0083: new Boolean(
0084: properties
0085: .getProperty(
0086: "GraphPanel.UseActivitySetChoiceButton",
0087: "true").equals("true")));
0088: componentSettings
0089: .put(
0090: "GraphOverview.Class",
0091: properties
0092: .getProperty("GraphOverview.Class",
0093: "org.enhydra.jawe.components.graph.overviewpanel.GraphOverviewPanel"));
0094: componentSettings.put("ShowGraphOverview", new Boolean(
0095: properties.getProperty("GraphOverview.Show", "true")
0096: .equals("true")));
0097: componentSettings.put("NameWrapping", new Boolean(properties
0098: .getProperty("Graph.NameWrapping", "true").equals(
0099: "true")));
0100: componentSettings.put("WordWrapping", new Boolean(properties
0101: .getProperty("Graph.WrappingStyleWordStatus", "true")
0102: .equals("true")));
0103: componentSettings
0104: .put("ShowGrid", new Boolean(properties.getProperty(
0105: "Graph.ShowGrid", "false").equals("true")));
0106: componentSettings.put("ShowIcons", new Boolean(properties
0107: .getProperty("Graph.ShowIcon", "true").equals("true")));
0108: componentSettings.put("ShowShadow",
0109: new Boolean(properties.getProperty("Graph.ShowShadow",
0110: "true").equals("true")));
0111: componentSettings.put("ShowTransitionCondition", new Boolean(
0112: properties.getProperty("Graph.ShowTransitionCondition",
0113: "false").equals("true")));
0114: componentSettings.put("ShowTransitionNameForCondition",
0115: new Boolean(properties
0116: .getProperty(
0117: "Graph.ShowTransitionNameForCondition",
0118: "false").equals("true")));
0119: componentSettings.put("UseBubbles",
0120: new Boolean(properties.getProperty("Graph.UseBubbles",
0121: "true").equals("true")));
0122: componentSettings.put("DrawBlockLines", new Boolean(properties
0123: .getProperty("Graph.DrawBlockLines", "true").equals(
0124: "true")));
0125: componentSettings.put("DrawSubflowLines", new Boolean(
0126: properties
0127: .getProperty("Graph.DrawSubflowLines", "true")
0128: .equals("true")));
0129:
0130: componentSettings.put("GraphClass", properties.getProperty(
0131: "Graph.Class",
0132: "org.enhydra.jawe.components.graph.Graph"));
0133: componentSettings
0134: .put(
0135: "GraphManagerClass",
0136: properties
0137: .getProperty("GraphManager.Class",
0138: "org.enhydra.jawe.components.graph.GraphManager"));
0139: componentSettings
0140: .put(
0141: "GraphMarqueeHandlerClass",
0142: properties
0143: .getProperty(
0144: "GraphMarqueeHandler.Class",
0145: "org.enhydra.jawe.components.graph.GraphMarqueeHandler"));
0146: componentSettings
0147: .put(
0148: "GraphModelClass",
0149: properties
0150: .getProperty("GraphModel.Class",
0151: "org.enhydra.jawe.components.graph.JaWEGraphModel"));
0152: componentSettings
0153: .put(
0154: "GraphObjectFactoryClass",
0155: properties
0156: .getProperty(
0157: "GraphObjectFactory.Class",
0158: "org.enhydra.jawe.components.graph.GraphObjectFactory"));
0159: componentSettings
0160: .put(
0161: "GraphObjectRendererFactoryClass",
0162: properties
0163: .getProperty(
0164: "GraphObjectRendererFactoryClass",
0165: "org.enhydra.jawe.components.graph.GraphObjectRendererFactory"));
0166: componentSettings.put("DefaultTransitionStyle", properties
0167: .getProperty("Graph.DefaultTransitionStyle",
0168: "NO_ROUTING_SPLINE"));
0169:
0170: componentSettings.put("GridSize", new Integer(properties
0171: .getProperty("Graph.GridSize", "10")));
0172: componentSettings.put("ShadowWidth", new Integer(properties
0173: .getProperty("Graph.ShadowWidth", "3")));
0174: componentSettings.put("GraphFontSize", new Integer(properties
0175: .getProperty("Graph.FontSize", "12")));
0176: componentSettings.put("ActivityHeight", new Integer(properties
0177: .getProperty("Graph.ActivityHeight", "55")));
0178: componentSettings.put("ActivityWidth", new Integer(properties
0179: .getProperty("Graph.ActivityWidth", "85")));
0180: componentSettings.put("ParticipantNameWidth", new Integer(
0181: properties.getProperty("Graph.ParticipantNameWidth",
0182: "50")));
0183: componentSettings.put("MinParWidth", new Integer(properties
0184: .getProperty("Graph.ParticipantMinWidth", "800")));
0185: componentSettings.put("MinParHeight", new Integer(properties
0186: .getProperty("Graph.ParticipantMinHeight", "150")));
0187: String textPos = properties.getProperty("Graph.TextPosition",
0188: "right");
0189: int tpv = RIGHT;
0190: if ("left".equalsIgnoreCase(textPos))
0191: tpv = LEFT;
0192: else if ("up".equalsIgnoreCase(textPos))
0193: tpv = UP;
0194: else if ("down".equalsIgnoreCase(textPos))
0195: tpv = DOWN;
0196: componentSettings.put("TextPosition", new Integer(tpv));
0197:
0198: componentSettings.put("Graph.HistoryManager.Class", properties
0199: .getProperty("Graph.HistoryManager.Class",
0200: "org.enhydra.jawe.HistoryMgr"));
0201: componentSettings.put("Graph.HistorySize", new Integer(
0202: properties.getProperty("Graph.HistorySize", "15")));
0203:
0204: Color color;
0205: try {
0206: color = Utils.getColor(ResourceManager.getResourceString(
0207: properties, "Graph.BubbleColor"));
0208: } catch (Exception e) {
0209: color = Utils.getColor("R=197,G=231,B=235");
0210: }
0211: componentSettings.put("BubbleColor", color);
0212:
0213: try {
0214: color = Utils.getColor(ResourceManager.getResourceString(
0215: properties, "Graph.BubbleConectionColor"));
0216: } catch (Exception e) {
0217: color = Utils.getColor("SystemColor.textHighlight");
0218: }
0219: componentSettings.put("BubbleConectionColor", color);
0220:
0221: try {
0222: color = Utils.getColor(ResourceManager.getResourceString(
0223: properties, "Graph.ActivitySelectedColor"));
0224: } catch (Exception e) {
0225: color = Utils.getColor("R=248,G=242,B=14");
0226: }
0227: componentSettings.put("ActivitySelectedColor", color);
0228:
0229: try {
0230: color = Utils.getColor(ResourceManager.getResourceString(
0231: properties, "Graph.StartActivityColor"));
0232: } catch (Exception e) {
0233: color = Utils.getColor("R=102, G=204, B=51");
0234: }
0235: componentSettings.put("StartActivityColor", color);
0236:
0237: try {
0238: color = Utils.getColor(ResourceManager.getResourceString(
0239: properties, "Graph.EndActivityColor"));
0240: } catch (Exception e) {
0241: color = Utils.getColor("R=236, G=120, B=98");
0242: }
0243: componentSettings.put("EndActivityColor", color);
0244:
0245: try {
0246: color = Utils.getColor(ResourceManager.getResourceString(
0247: properties, "Graph.StartEndActivityColor"));
0248: } catch (Exception e) {
0249: color = Utils.getColor("R=255, G=255, B=175");
0250: }
0251: componentSettings.put("StartEndActivityColor", color);
0252:
0253: try {
0254: color = Utils.getColor(ResourceManager.getResourceString(
0255: properties, "Graph.BackgroundColor"));
0256: } catch (Exception e) {
0257: color = Utils.getColor("R=245,G=245,B=245");
0258: }
0259: componentSettings.put("BackgroundColor", color);
0260: try {
0261: color = Utils.getColor(ResourceManager.getResourceString(
0262: properties, "Graph.GridColor"));
0263: } catch (Exception e) {
0264: color = Utils.getColor("R=187,G=247,B=190");
0265: }
0266: componentSettings.put("GridColor", color);
0267: try {
0268: color = Utils.getColor(ResourceManager.getResourceString(
0269: properties, "Graph.TextColor"));
0270: } catch (Exception e) {
0271: color = Utils.getColor("SystemColor.textText");
0272: }
0273: componentSettings.put("TextColor", color);
0274: try {
0275: color = Utils.getColor(ResourceManager.getResourceString(
0276: properties, "Graph.ParticipantBorderColor"));
0277: } catch (Exception e) {
0278: color = Utils.getColor("SystemColor.textText");
0279: }
0280: componentSettings.put("ParticipantBorderColor", color);
0281: try {
0282: color = Utils.getColor(ResourceManager.getResourceString(
0283: properties,
0284: "Graph.ParticipantFreeTextExpressionColor"));
0285: } catch (Exception e) {
0286: color = Utils.getColor("Color.white");
0287: }
0288: componentSettings.put("ParticipantFreeTextExpressionColor",
0289: color);
0290: try {
0291: color = Utils.getColor(ResourceManager.getResourceString(
0292: properties,
0293: "Graph.ParticipantCommonExpressionColor"));
0294: } catch (Exception e) {
0295: color = Utils.getColor("R=255,G=255,B=196");
0296: }
0297: componentSettings
0298: .put("ParticipantCommonExpressionColor", color);
0299:
0300: try {
0301: color = Utils.getColor(ResourceManager.getResourceString(
0302: properties, "Graph.HandleColor"));
0303: } catch (Exception e) {
0304: color = Utils.getColor("Color.pink");
0305: }
0306: componentSettings.put("HandleColor", color);
0307: try {
0308: color = Utils.getColor(ResourceManager.getResourceString(
0309: properties, "Graph.MarqueeColor"));
0310: } catch (Exception e) {
0311: color = Utils.getColor("SystemColor.textHighlight");
0312: }
0313: componentSettings.put("MarqueeColor", color);
0314:
0315: ImageIcon cicon;
0316: URL iconURL = ResourceManager.getResource(properties,
0317: "Graph.XPDLElement.Image.Defualt");
0318: if (iconURL != null)
0319: cicon = new ImageIcon(iconURL);
0320: else
0321: cicon = new ImageIcon(
0322: ResourceManager.class
0323: .getClassLoader()
0324: .getResource(
0325: "org/enhydra/jawe/images/genericactivity.gif"));
0326: componentSettings.put("DefaultActivityIcon", cicon);
0327:
0328: iconURL = ResourceManager.getResource(properties,
0329: "Graph.XPDLElement.Image.Start");
0330: if (iconURL != null)
0331: cicon = new ImageIcon(iconURL);
0332: else
0333: cicon = new ImageIcon(ResourceManager.class
0334: .getClassLoader().getResource(
0335: "org/enhydra/jawe/images/start.gif"));
0336: componentSettings.put("BubbleStart", cicon);
0337:
0338: iconURL = ResourceManager.getResource(properties,
0339: "Graph.XPDLElement.Image.End");
0340: if (iconURL != null)
0341: cicon = new ImageIcon(iconURL);
0342: else
0343: cicon = new ImageIcon(ResourceManager.class
0344: .getClassLoader().getResource(
0345: "org/enhydra/jawe/images/end.gif"));
0346: componentSettings.put("BubbleEnd", cicon);
0347:
0348: iconURL = ResourceManager.getResource(properties,
0349: "Graph.XPDLElement.Image.FreeTextParticipant");
0350: if (iconURL != null)
0351: cicon = new ImageIcon(iconURL);
0352: else
0353: cicon = new ImageIcon(
0354: ResourceManager.class
0355: .getClassLoader()
0356: .getResource(
0357: "org/enhydra/jawe/images/freetextparticipant.png"));
0358: componentSettings.put("FreeTextParticipant", cicon);
0359:
0360: iconURL = ResourceManager.getResource(properties,
0361: "Graph.XPDLElement.Image.CommonExpresionParticipant");
0362: if (iconURL != null)
0363: cicon = new ImageIcon(iconURL);
0364: else
0365: cicon = new ImageIcon(
0366: ResourceManager.class
0367: .getClassLoader()
0368: .getResource(
0369: "org/enhydra/jawe/images/commonexpparticipant.png"));
0370: componentSettings.put("CommonExpresionParticipant", cicon);
0371:
0372: iconURL = ResourceManager.getResource(properties,
0373: "GraphPanel.Image.Participants");
0374: if (iconURL != null)
0375: cicon = new ImageIcon(iconURL);
0376: else
0377: cicon = new ImageIcon(
0378: ResourceManager.class
0379: .getClassLoader()
0380: .getResource(
0381: "org/enhydra/jawe/images/participantsselect.gif"));
0382: componentSettings.put("Participants", cicon);
0383:
0384: iconURL = ResourceManager.getResource(properties,
0385: "GraphPanel.Image.ActivitySetSelect");
0386: if (iconURL != null)
0387: cicon = new ImageIcon(iconURL);
0388: else
0389: cicon = new ImageIcon(
0390: ResourceManager.class
0391: .getClassLoader()
0392: .getResource(
0393: "org/enhydra/jawe/images/activitysetselect.gif"));
0394: componentSettings.put("ActivitySetSelect", cicon);
0395:
0396: iconURL = ResourceManager.getResource(properties,
0397: "GraphPanel.Image.Selection");
0398: if (iconURL != null)
0399: cicon = new ImageIcon(iconURL);
0400: else
0401: cicon = new ImageIcon(ResourceManager.class
0402: .getClassLoader().getResource(
0403: "org/enhydra/jawe/images/select.gif"));
0404: componentSettings.put("Selection", cicon);
0405:
0406: // menus, toolbars and actions
0407: loadDefaultMenusToolbarsAndActions(comp);
0408: componentSettings.putAll(Utils
0409: .loadAllMenusAndToolbars(properties));
0410: componentAction.putAll(Utils.loadActions(properties, comp,
0411: componentAction));
0412: }
0413:
0414: protected void loadDefaultMenusToolbarsAndActions(JaWEComponent comp) {
0415: // menu
0416: componentSettings
0417: .put(
0418: "ACTIVITYMenu",
0419: "jaweAction_Cut jaweAction_Copy jaweAction_Delete jaweAction_EditProperties - ActivityReferredDocument SelectConnectingTransitionsForSelectedActivities");
0420: componentSettings.put("ACTIVITY_BLOCKMenu", "DescendInto");
0421: componentSettings.put("ACTIVITY_SUBFLOWMenu", "DescendInto");
0422: componentSettings.put("ENDMenu", "jaweAction_Delete");
0423: componentSettings
0424: .put(
0425: "PARTICIPANTMenu",
0426: "RemoveParticipant jaweAction_Delete jaweAction_EditProperties - MoveUpParticipant MoveDownParticipant");
0427: componentSettings.put("SELECTMenu", "GraphPaste");
0428: componentSettings.put("STARTMenu", "jaweAction_Delete");
0429: componentSettings
0430: .put(
0431: "TRANSITIONMenu",
0432: "AddPoint RemovePoint jaweAction_Delete *SetTransitionStyle jaweAction_EditProperties - SelectConnectingActivitiesForSelectedTransitions");
0433: componentSettings
0434: .put(
0435: "SetTransitionStyleMenu",
0436: "SetTransitionStyleNoRoutingBezier SetTransitionStyleNoRoutingOrthogonal SetTransitionStyleNoRoutingSpline - SetTransitionStyleSimpleRoutingBezier SetTransitionStyleSimpleRoutingOrthogonal SetTransitionStyleSimpleRoutingSpline");
0437: componentSettings.put("SetTransitionStyleLangName",
0438: "SetTransitionStyle");
0439:
0440: // toolbar
0441: componentSettings.put("defaultToolbarToolbar",
0442: "*graphEditToolbar");
0443: componentSettings
0444: .put(
0445: "toolboxToolbar",
0446: "SetSelectMode - SetParticipantModePARTICIPANT_ROLE SetParticipantModeFreeTextExpression SetParticipantModeCommonExpression - SetStartMode SetEndMode - SetActivityMode* - SetTransitionMode*");
0447: componentSettings
0448: .put(
0449: "graphEditToolbarToolbar",
0450: "SaveAsJPG SaveAsSVG - ZoomIn ActualSize ZoomOut - MoveUpParticipant MoveDownParticipant - PreviousGraph NextGraph - InsertMissingStartAndEndBubbles RemoveStartAndEndBubbles - RotateProcess SimpleGraphLayout - InsertActivitySet");
0451:
0452: // actions
0453: ActionBase action = null;
0454: ImageIcon icon;
0455: String langDepName;
0456: JaWEAction ja;
0457:
0458: // SetPerformerExpression
0459: try {
0460: String clsName = "org.enhydra.jawe.components.graph.actions.SetPerformerExpression";
0461: try {
0462: action = (ActionBase) Class.forName(clsName)
0463: .getConstructor(
0464: new Class[] { JaWEComponent.class })
0465: .newInstance(new Object[] { comp });
0466: } catch (Exception e) {
0467: }
0468: icon = new ImageIcon(
0469: ResourceManager.class
0470: .getClassLoader()
0471: .getResource(
0472: "org/enhydra/jawe/images/commonexpparticipantsetexp.png"));
0473: langDepName = "SetPerformerExpression";
0474: ja = new JaWEAction(action, icon, langDepName);
0475: componentAction.put(langDepName, ja);
0476: } catch (Exception ex) {
0477: }
0478: // ActualSize
0479: action = new ActualSize(comp);
0480: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0481: .getResource("org/enhydra/jawe/images/actualsize.gif"));
0482: langDepName = "ActualSize";
0483: ja = new JaWEAction(action, icon, langDepName);
0484: componentAction.put(action.getValue(Action.NAME), ja);
0485:
0486: // ActivityReferredDocument
0487: action = new ActivityReferredDocument(comp);
0488: icon = new ImageIcon(
0489: ResourceManager.class
0490: .getClassLoader()
0491: .getResource(
0492: "org/enhydra/jawe/images/referred_document.png"));
0493: langDepName = "ActivityReferredDocument";
0494: ja = new JaWEAction(action, icon, langDepName);
0495: componentAction.put(action.getValue(Action.NAME), ja);
0496:
0497: // SelectConnectingTransitionsForSelectedActivities
0498: try {
0499: String clsName = "org.enhydra.jawe.components.graph.actions.SelectConnectingTransitionsForSelectedActivities";
0500: try {
0501: action = (ActionBase) Class.forName(clsName)
0502: .getConstructor(
0503: new Class[] { JaWEComponent.class })
0504: .newInstance(new Object[] { comp });
0505: } catch (Exception e) {
0506: action = null;
0507: }
0508: icon = null;
0509: langDepName = "SelectConnectingTransitionsForSelectedActivities";
0510: ja = new JaWEAction(action, icon, langDepName);
0511: componentAction.put(langDepName, ja);
0512: } catch (Exception ex) {
0513: }
0514:
0515: // AddPoint
0516: action = new AddPoint(comp);
0517: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0518: .getResource("org/enhydra/jawe/images/addpoint.gif"));
0519: langDepName = "AddPoint";
0520: ja = new JaWEAction(action, icon, langDepName);
0521: componentAction.put(action.getValue(Action.NAME), ja);
0522:
0523: // DescendInto
0524: action = new DescendInto(comp);
0525: langDepName = "DescendInto";
0526: ja = new JaWEAction(action, langDepName);
0527: componentAction.put(action.getValue(Action.NAME), ja);
0528:
0529: // GraphPaste
0530: action = new GraphPaste(comp);
0531: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0532: .getResource("org/enhydra/jawe/images/paste.gif"));
0533: langDepName = "Paste";
0534: ja = new JaWEAction(action, icon, langDepName);
0535: componentAction.put(action.getValue(Action.NAME), ja);
0536:
0537: // InsertActivitySet
0538: action = new InsertActivitySet(comp);
0539: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0540: .getResource(
0541: "org/enhydra/jawe/images/activitysetnew.gif"));
0542: langDepName = "InsertActivitySet";
0543: ja = new JaWEAction(action, icon, langDepName);
0544: componentAction.put(action.getValue(Action.NAME), ja);
0545:
0546: // MoveDownParticipant
0547: action = new MoveDownParticipant(comp);
0548: icon = new ImageIcon(
0549: ResourceManager.class
0550: .getClassLoader()
0551: .getResource(
0552: "org/enhydra/jawe/images/participantdownright.gif"));
0553: langDepName = "MoveDownParticipant";
0554: ja = new JaWEAction(action, icon, langDepName);
0555: componentAction.put(action.getValue(Action.NAME), ja);
0556:
0557: // MoveUpParticipant
0558: action = new MoveUpParticipant(comp);
0559: icon = new ImageIcon(
0560: ResourceManager.class
0561: .getClassLoader()
0562: .getResource(
0563: "org/enhydra/jawe/images/participantupleft.gif"));
0564: langDepName = "MoveUpParticipant";
0565: ja = new JaWEAction(action, icon, langDepName);
0566: componentAction.put(action.getValue(Action.NAME), ja);
0567:
0568: // NextGraph
0569: action = new NextGraph(comp);
0570: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0571: .getResource(
0572: "org/enhydra/jawe/images/nav_right_red.png"));
0573: langDepName = "NextGraph";
0574: ja = new JaWEAction(action, icon, langDepName);
0575: componentAction.put(action.getValue(Action.NAME), ja);
0576:
0577: // PreviousGraph
0578: action = new PreviousGraph(comp);
0579: icon = new ImageIcon(
0580: ResourceManager.class.getClassLoader().getResource(
0581: "org/enhydra/jawe/images/nav_left_red.png"));
0582: langDepName = "PreviousGraph";
0583: ja = new JaWEAction(action, icon, langDepName);
0584: componentAction.put(action.getValue(Action.NAME), ja);
0585:
0586: // InsertMissingStartAndEndBubbles
0587: action = new InsertMissingStartAndEndBubbles(comp);
0588: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0589: .getResource("org/enhydra/jawe/images/startend.gif"));
0590: langDepName = "InsertMissingStartAndEndBubbles";
0591: ja = new JaWEAction(action, icon, langDepName);
0592: componentAction.put(action.getValue(Action.NAME), ja);
0593:
0594: // RemoveStartAndEndBubbles
0595: action = new RemoveStartAndEndBubbles(comp);
0596: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0597: .getResource(
0598: "org/enhydra/jawe/images/startend_remove.gif"));
0599: langDepName = "RemoveStartAndEndBubbles";
0600: ja = new JaWEAction(action, icon, langDepName);
0601: componentAction.put(action.getValue(Action.NAME), ja);
0602:
0603: // RemoveParticipant
0604: action = new RemoveParticipant(comp);
0605: icon = new ImageIcon(
0606: ResourceManager.class
0607: .getClassLoader()
0608: .getResource(
0609: "org/enhydra/jawe/images/participantremove.png"));
0610: langDepName = "RemoveParticipant";
0611: ja = new JaWEAction(action, icon, langDepName);
0612: componentAction.put(action.getValue(Action.NAME), ja);
0613:
0614: // RemovePoint
0615: action = new RemovePoint(comp);
0616: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0617: .getResource("org/enhydra/jawe/images/removepoint.gif"));
0618: langDepName = "RemovePoint";
0619: ja = new JaWEAction(action, icon, langDepName);
0620: componentAction.put(action.getValue(Action.NAME), ja);
0621:
0622: // RotateProcess
0623: try {
0624: String clsName = "org.enhydra.jawe.components.graph.actions.RotateProcess";
0625: try {
0626: action = (ActionBase) Class.forName(clsName)
0627: .getConstructor(
0628: new Class[] { JaWEComponent.class })
0629: .newInstance(new Object[] { comp });
0630: } catch (Exception e) {
0631: action = null;
0632: }
0633: icon = new ImageIcon(
0634: ResourceManager.class
0635: .getClassLoader()
0636: .getResource(
0637: "org/enhydra/jawe/images/process_rotate.gif"));
0638: langDepName = "RotateProcess";
0639: ja = new JaWEAction(action, icon, langDepName);
0640: componentAction.put(langDepName, ja);
0641: } catch (Exception ex) {
0642: }
0643:
0644: // SimpleGraphLayout
0645: action = new SimpleGraphLayout(comp);
0646: icon = new ImageIcon(
0647: ResourceManager.class.getClassLoader().getResource(
0648: "org/enhydra/jawe/images/graph_layout.png"));
0649: langDepName = "SimpleGraphLayout";
0650: ja = new JaWEAction(action, icon, langDepName);
0651: componentAction.put(action.getValue(Action.NAME), ja);
0652:
0653: // SaveAsJPG
0654: action = new SaveAsJPG(comp);
0655: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0656: .getResource("org/enhydra/jawe/images/saveasjpg.gif"));
0657: langDepName = "SaveAsJPG";
0658: ja = new JaWEAction(action, icon, langDepName);
0659: componentAction.put(action.getValue(Action.NAME), ja);
0660:
0661: // SaveAsSVG
0662: action = new SaveAsSVG(comp);
0663: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0664: .getResource("org/enhydra/jawe/images/saveassvg.gif"));
0665: langDepName = "SaveAsSVG";
0666: ja = new JaWEAction(action, icon, langDepName);
0667: componentAction.put(action.getValue(Action.NAME), ja);
0668:
0669: // SetTransitionStyleNoRoutingBezier
0670: action = new SetTransitionStyleNoRoutingBezier(comp);
0671: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0672: .getResource(
0673: "org/enhydra/jawe/images/transitionbezier.gif"));
0674: langDepName = "SetTransitionStyleNoRoutingBezier";
0675: ja = new JaWEAction(action, icon, langDepName);
0676: componentAction.put(action.getValue(Action.NAME), ja);
0677:
0678: // SetTransitionStyleNoRoutingOrthogonal
0679: action = new SetTransitionStyleNoRoutingOrthogonal(comp);
0680: icon = new ImageIcon(
0681: ResourceManager.class
0682: .getClassLoader()
0683: .getResource(
0684: "org/enhydra/jawe/images/transitionortogonal.gif"));
0685: langDepName = "SetTransitionStyleNoRoutingOrthogonal";
0686: ja = new JaWEAction(action, icon, langDepName);
0687: componentAction.put(action.getValue(Action.NAME), ja);
0688:
0689: // SetTransitionStyleNoRoutingSpline
0690: action = new SetTransitionStyleNoRoutingSpline(comp);
0691: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0692: .getResource(
0693: "org/enhydra/jawe/images/transitionspline.gif"));
0694: langDepName = "SetTransitionStyleNoRoutingSpline";
0695: ja = new JaWEAction(action, icon, langDepName);
0696: componentAction.put(action.getValue(Action.NAME), ja);
0697:
0698: // SetTransitionStyleSimpleRoutingBezier
0699: action = new SetTransitionStyleNoRoutingBezier(comp);
0700: icon = new ImageIcon(
0701: ResourceManager.class
0702: .getClassLoader()
0703: .getResource(
0704: "org/enhydra/jawe/images/transitionbeziersr.gif"));
0705: langDepName = "SetTransitionStyleSimpleRoutingBezier";
0706: ja = new JaWEAction(action, icon, langDepName);
0707: componentAction.put(action.getValue(Action.NAME), ja);
0708:
0709: // SetTransitionStyleSimpleRoutingOrthogonal
0710: action = new SetTransitionStyleSimpleRoutingOrthogonal(comp);
0711: icon = new ImageIcon(
0712: ResourceManager.class
0713: .getClassLoader()
0714: .getResource(
0715: "org/enhydra/jawe/images/transitionortogonalsr.gif"));
0716: langDepName = "SetTransitionStyleSimpleRoutingOrthogonal";
0717: ja = new JaWEAction(action, icon, langDepName);
0718: componentAction.put(action.getValue(Action.NAME), ja);
0719:
0720: // SetTransitionStyleSimpleRoutingSpline
0721: action = new SetTransitionStyleSimpleRoutingSpline(comp);
0722: icon = new ImageIcon(
0723: ResourceManager.class
0724: .getClassLoader()
0725: .getResource(
0726: "org/enhydra/jawe/images/transitionsplinesr.gif"));
0727: langDepName = "SetTransitionStyleSimpleRoutingSpline";
0728: ja = new JaWEAction(action, icon, langDepName);
0729: componentAction.put(action.getValue(Action.NAME), ja);
0730:
0731: // SelectConnectingActivitiesForSelectedTransitions
0732: try {
0733: String clsName = "org.enhydra.jawe.components.graph.actions.SelectConnectingActivitiesForSelectedTransitions";
0734: try {
0735: action = (ActionBase) Class.forName(clsName)
0736: .getConstructor(
0737: new Class[] { JaWEComponent.class })
0738: .newInstance(new Object[] { comp });
0739: } catch (Exception e) {
0740: action = null;
0741: }
0742: icon = null;
0743: langDepName = "SelectConnectingActivitiesForSelectedTransitions";
0744: ja = new JaWEAction(action, icon, langDepName);
0745: componentAction.put(langDepName, ja);
0746: } catch (Exception ex) {
0747: }
0748:
0749: // ZoomIn
0750: action = new ZoomIn(comp);
0751: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0752: .getResource("org/enhydra/jawe/images/zoomin.gif"));
0753: langDepName = "ZoomIn";
0754: ja = new JaWEAction(action, icon, langDepName);
0755: componentAction.put(action.getValue(Action.NAME), ja);
0756:
0757: // ZoomOut
0758: action = new ZoomOut(comp);
0759: icon = new ImageIcon(ResourceManager.class.getClassLoader()
0760: .getResource("org/enhydra/jawe/images/zoomout.gif"));
0761: langDepName = "ZoomOut";
0762: ja = new JaWEAction(action, icon, langDepName);
0763: componentAction.put(action.getValue(Action.NAME), ja);
0764: }
0765:
0766: public String getMenuActionOrder(String menuName) {
0767: return (String) componentSettings.get(menuName + "Menu");
0768: }
0769:
0770: public String getToolbarActionOrder(String toolbarName) {
0771: return (String) componentSettings.get(toolbarName + "Toolbar");
0772: }
0773:
0774: public boolean shouldDrawBlockLines() {
0775: return ((Boolean) componentSettings.get("DrawBlockLines"))
0776: .booleanValue();
0777: }
0778:
0779: public boolean shouldDrawSubflowLines() {
0780: return ((Boolean) componentSettings.get("DrawSubflowLines"))
0781: .booleanValue();
0782: }
0783:
0784: public boolean isNameWrappingEnabled() {
0785: return ((Boolean) componentSettings.get("NameWrapping"))
0786: .booleanValue();
0787: }
0788:
0789: public boolean isWordWrappingEnabled() {
0790: return ((Boolean) componentSettings.get("WordWrapping"))
0791: .booleanValue();
0792: }
0793:
0794: public boolean shouldShowGrid() {
0795: return ((Boolean) componentSettings.get("ShowGrid"))
0796: .booleanValue();
0797: }
0798:
0799: public boolean shouldShowIcons() {
0800: return ((Boolean) componentSettings.get("ShowIcons"))
0801: .booleanValue();
0802: }
0803:
0804: public boolean isShadowEnabled() {
0805: return ((Boolean) componentSettings.get("ShowShadow"))
0806: .booleanValue();
0807: }
0808:
0809: public boolean shouldShowTransitionCondition() {
0810: return ((Boolean) componentSettings
0811: .get("ShowTransitionCondition")).booleanValue();
0812: }
0813:
0814: public boolean shouldShowTransitionNameForCondition() {
0815: return ((Boolean) componentSettings
0816: .get("ShowTransitionNameForCondition")).booleanValue();
0817: }
0818:
0819: public boolean shouldUseBubbles() {
0820: return ((Boolean) componentSettings.get("UseBubbles"))
0821: .booleanValue();
0822: }
0823:
0824: public boolean useParticipantChoiceButton() {
0825: return ((Boolean) componentSettings
0826: .get("UseParticipantChoiceButton")).booleanValue();
0827: }
0828:
0829: public boolean useActivitySetChoiceButton() {
0830: return ((Boolean) componentSettings
0831: .get("UseActivitySetChoiceButton")).booleanValue();
0832: }
0833:
0834: public boolean shouldShowGraphOverview() {
0835: return ((Boolean) componentSettings.get("ShowGraphOverview"))
0836: .booleanValue();
0837: }
0838:
0839: public String getGraphObjectFactory() {
0840: return (String) componentSettings
0841: .get("GraphObjectFactoryClass");
0842: }
0843:
0844: public String getGraphObjectRendererFactory() {
0845: return (String) componentSettings
0846: .get("GraphObjectRendererFactoryClass");
0847: }
0848:
0849: public String getGraphMarqueeHandler() {
0850: return (String) componentSettings
0851: .get("GraphMarqueeHandlerClass");
0852: }
0853:
0854: public String getGraphClass() {
0855: return (String) componentSettings.get("GraphClass");
0856: }
0857:
0858: public String getGraphModelClass() {
0859: return (String) componentSettings.get("GraphModelClass");
0860: }
0861:
0862: public String getGraphManager() {
0863: return (String) componentSettings.get("GraphManagerClass");
0864: }
0865:
0866: public String getDefaultTransitionStyle() {
0867: return (String) componentSettings.get("DefaultTransitionStyle");
0868: }
0869:
0870: public ImageIcon getDefaultActivityIcon() {
0871: return (ImageIcon) componentSettings.get("DefaultActivityIcon");
0872: }
0873:
0874: public ImageIcon getBubbleStartIcon() {
0875: return (ImageIcon) componentSettings.get("BubbleStart");
0876: }
0877:
0878: public ImageIcon getBubbleEndIcon() {
0879: return (ImageIcon) componentSettings.get("BubbleEnd");
0880: }
0881:
0882: public ImageIcon getFreeTextParticipantIcon() {
0883: return (ImageIcon) componentSettings.get("FreeTextParticipant");
0884: }
0885:
0886: public ImageIcon getCommonExpresionParticipantIcon() {
0887: return (ImageIcon) componentSettings
0888: .get("CommonExpresionParticipant");
0889: }
0890:
0891: public ImageIcon getParticipantsIcon() {
0892: return (ImageIcon) componentSettings.get("Participants");
0893: }
0894:
0895: public ImageIcon getActivitySetSelectIcon() {
0896: return (ImageIcon) componentSettings.get("ActivitySetSelect");
0897: }
0898:
0899: public ImageIcon getSelectionIcon() {
0900: return (ImageIcon) componentSettings.get("Selection");
0901: }
0902:
0903: public int getGridSize() {
0904: return ((Integer) componentSettings.get("GridSize")).intValue();
0905: }
0906:
0907: public int getShadowWidth() {
0908: return ((Integer) componentSettings.get("ShadowWidth"))
0909: .intValue();
0910: }
0911:
0912: public int getTextPos() {
0913: return ((Integer) componentSettings.get("TextPosition"))
0914: .intValue();
0915: }
0916:
0917: public int getGraphFontSize() {
0918: return ((Integer) componentSettings.get("GraphFontSize"))
0919: .intValue();
0920: }
0921:
0922: public int getActivityHeight() {
0923: return ((Integer) componentSettings.get("ActivityHeight"))
0924: .intValue();
0925: }
0926:
0927: public int getActivityWidth() {
0928: return ((Integer) componentSettings.get("ActivityWidth"))
0929: .intValue();
0930: }
0931:
0932: public int getMinParWidth() {
0933: return ((Integer) componentSettings.get("MinParWidth"))
0934: .intValue();
0935: }
0936:
0937: public int getMinParHeight() {
0938: return ((Integer) componentSettings.get("MinParHeight"))
0939: .intValue();
0940: }
0941:
0942: public int getParticipantNameWidth() {
0943: return ((Integer) componentSettings.get("ParticipantNameWidth"))
0944: .intValue();
0945: }
0946:
0947: public Color getBubbleColor() {
0948: return (Color) componentSettings.get("BubbleColor");
0949: }
0950:
0951: public Color getBubbleConectionColor() {
0952: return (Color) componentSettings.get("BubbleConectionColor");
0953: }
0954:
0955: public Color getSelectedActivityColor() {
0956: return (Color) componentSettings.get("ActivitySelectedColor");
0957: }
0958:
0959: public Color getStartActivityColor() {
0960: return (Color) componentSettings.get("StartActivityColor");
0961: }
0962:
0963: public Color getEndActivityColor() {
0964: return (Color) componentSettings.get("EndActivityColor");
0965: }
0966:
0967: public Color getStartEndActivityColor() {
0968: return (Color) componentSettings.get("StartEndActivityColor");
0969: }
0970:
0971: public Color getBackgroundColor() {
0972: return (Color) componentSettings.get("BackgroundColor");
0973: }
0974:
0975: public Color getGridColor() {
0976: return (Color) componentSettings.get("GridColor");
0977: }
0978:
0979: public Color getTextColor() {
0980: return (Color) componentSettings.get("TextColor");
0981: }
0982:
0983: public Color getParticipantBorderColor() {
0984: return (Color) componentSettings.get("ParticipantBorderColor");
0985: }
0986:
0987: public Color getParticipantFreeTextExpressionColor() {
0988: return (Color) componentSettings
0989: .get("ParticipantFreeTextExpressionColor");
0990: }
0991:
0992: public Color getParticipantCommonExpressionColor() {
0993: return (Color) componentSettings
0994: .get("ParticipantCommonExpressionColor");
0995: }
0996:
0997: public Color getHandleColor() {
0998: return (Color) componentSettings.get("HandleColor");
0999: }
1000:
1001: public Color getMarqueeColor() {
1002: return (Color) componentSettings.get("MarqueeColor");
1003: }
1004:
1005: public String historyManagerClass() {
1006: return (String) componentSettings
1007: .get("Graph.HistoryManager.Class");
1008: }
1009:
1010: public int historySize() {
1011: return ((Integer) componentSettings.get("Graph.HistorySize"))
1012: .intValue();
1013: }
1014:
1015: public String overviewClass() {
1016: return (String) componentSettings.get("GraphOverview.Class");
1017: }
1018:
1019: public boolean performAutomaticLayoutOnInsertion() {
1020: return (JaWEManager.getInstance().getXPDLHandler()
1021: .getXPDLRepositoryHandler() instanceof XPDLRepHandler);
1022: }
1023: }
|