📄 graphsettings.java
字号:
/** * Miroslav Popov, Dec 2, 2005 miroslav.popov@gmail.com */package org.enhydra.jawe.components.graph;import java.awt.BasicStroke;import java.awt.Color;import java.awt.Stroke;import java.net.URL;import java.util.Properties;import javax.swing.Action;import javax.swing.ImageIcon;import org.enhydra.jawe.ActionBase;import org.enhydra.jawe.AdditionalResourceManager;import org.enhydra.jawe.JaWEAction;import org.enhydra.jawe.JaWEComponent;import org.enhydra.jawe.JaWEComponentSettings;import org.enhydra.jawe.JaWEManager;import org.enhydra.jawe.ResourceManager;import org.enhydra.jawe.Utils;import org.enhydra.jawe.base.xpdlhandler.XPDLRepHandler;import org.enhydra.jawe.components.graph.actions.ActivityReferredDocument;import org.enhydra.jawe.components.graph.actions.ActualSize;import org.enhydra.jawe.components.graph.actions.AddPoint;import org.enhydra.jawe.components.graph.actions.DescendInto;import org.enhydra.jawe.components.graph.actions.GraphPaste;import org.enhydra.jawe.components.graph.actions.InsertActivitySet;import org.enhydra.jawe.components.graph.actions.InsertMissingStartAndEndBubbles;import org.enhydra.jawe.components.graph.actions.MoveDownParticipant;import org.enhydra.jawe.components.graph.actions.MoveUpParticipant;import org.enhydra.jawe.components.graph.actions.NextGraph;import org.enhydra.jawe.components.graph.actions.PreviousGraph;import org.enhydra.jawe.components.graph.actions.RemoveParticipant;import org.enhydra.jawe.components.graph.actions.RemovePoint;import org.enhydra.jawe.components.graph.actions.RemoveStartAndEndBubbles;import org.enhydra.jawe.components.graph.actions.SaveAsJPG;import org.enhydra.jawe.components.graph.actions.SaveAsSVG;import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingBezier;import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingOrthogonal;import org.enhydra.jawe.components.graph.actions.SetTransitionStyleNoRoutingSpline;import org.enhydra.jawe.components.graph.actions.SetTransitionStyleSimpleRoutingOrthogonal;import org.enhydra.jawe.components.graph.actions.SetTransitionStyleSimpleRoutingSpline;import org.enhydra.jawe.components.graph.actions.SimpleGraphLayout;import org.enhydra.jawe.components.graph.actions.ZoomIn;import org.enhydra.jawe.components.graph.actions.ZoomOut;/** * @author Miroslav Popov */public class GraphSettings extends JaWEComponentSettings { public static final Stroke DEPARTMENT_STROKE = new BasicStroke(2); public static final int UP = 1; public static final int DOWN = 2; public static final int LEFT = 3; public static final int RIGHT = 4; public void init(JaWEComponent comp) { PROPERTYFILE_PATH = "org/enhydra/jawe/components/graph/properties/"; PROPERTYFILE_NAME = "togwegraphcontroller.properties"; super.init(comp); } public void loadDefault(JaWEComponent comp, Properties properties) { arm = new AdditionalResourceManager(properties); componentSettings.put("UseParticipantChoiceButton", new Boolean(properties.getProperty("GraphPanel.UseParticipantChoiceButton", "true") .equals("true"))); componentSettings.put("UseActivitySetChoiceButton", new Boolean(properties.getProperty("GraphPanel.UseActivitySetChoiceButton", "true") .equals("true"))); componentSettings.put("GraphOverview.Class", properties.getProperty("GraphOverview.Class", "org.enhydra.jawe.components.graph.overviewpanel.GraphOverviewPanel")); componentSettings.put("ShowGraphOverview", new Boolean(properties.getProperty("GraphOverview.Show", "true").equals("true"))); componentSettings.put("NameWrapping", new Boolean(properties.getProperty("Graph.NameWrapping", "true").equals("true"))); componentSettings.put("WordWrapping", new Boolean(properties.getProperty("Graph.WrappingStyleWordStatus", "true") .equals("true"))); componentSettings.put("ShowGrid", new Boolean(properties.getProperty("Graph.ShowGrid", "false") .equals("true"))); componentSettings.put("ShowIcons", new Boolean(properties.getProperty("Graph.ShowIcon", "true") .equals("true"))); componentSettings.put("ShowShadow", new Boolean(properties.getProperty("Graph.ShowShadow", "true") .equals("true"))); componentSettings.put("ShowTransitionCondition", new Boolean(properties.getProperty("Graph.ShowTransitionCondition", "false") .equals("true"))); componentSettings.put("ShowTransitionNameForCondition", new Boolean(properties.getProperty("Graph.ShowTransitionNameForCondition", "false") .equals("true"))); componentSettings.put("UseBubbles", new Boolean(properties.getProperty("Graph.UseBubbles", "true") .equals("true"))); componentSettings.put("DrawBlockLines", new Boolean(properties.getProperty("Graph.DrawBlockLines", "true").equals("true"))); componentSettings.put("DrawSubflowLines", new Boolean(properties.getProperty("Graph.DrawSubflowLines", "true").equals("true"))); componentSettings.put("GraphClass", properties.getProperty("Graph.Class", "org.enhydra.jawe.components.graph.Graph")); componentSettings.put("GraphManagerClass", properties.getProperty("GraphManager.Class", "org.enhydra.jawe.components.graph.GraphManager")); componentSettings.put("GraphMarqueeHandlerClass", properties.getProperty("GraphMarqueeHandler.Class", "org.enhydra.jawe.components.graph.GraphMarqueeHandler")); componentSettings.put("GraphModelClass", properties.getProperty("GraphModel.Class", "org.enhydra.jawe.components.graph.JaWEGraphModel")); componentSettings.put("GraphObjectFactoryClass", properties.getProperty("GraphObjectFactory.Class", "org.enhydra.jawe.components.graph.GraphObjectFactory")); componentSettings.put("GraphObjectRendererFactoryClass", properties.getProperty("GraphObjectRendererFactoryClass", "org.enhydra.jawe.components.graph.GraphObjectRendererFactory")); componentSettings.put("DefaultTransitionStyle", properties.getProperty("Graph.DefaultTransitionStyle", "NO_ROUTING_SPLINE")); componentSettings.put("GridSize", new Integer(properties.getProperty("Graph.GridSize", "10"))); componentSettings.put("ShadowWidth", new Integer(properties.getProperty("Graph.ShadowWidth", "3"))); componentSettings.put("GraphFontSize", new Integer(properties.getProperty("Graph.FontSize", "12"))); componentSettings.put("ActivityHeight", new Integer(properties.getProperty("Graph.ActivityHeight", "55"))); componentSettings.put("ActivityWidth", new Integer(properties.getProperty("Graph.ActivityWidth", "85"))); componentSettings.put("ParticipantNameWidth", new Integer(properties.getProperty("Graph.ParticipantNameWidth", "50"))); componentSettings.put("MinParWidth", new Integer(properties.getProperty("Graph.ParticipantMinWidth", "800"))); componentSettings.put("MinParHeight", new Integer(properties.getProperty("Graph.ParticipantMinHeight", "150"))); String textPos = properties.getProperty("Graph.TextPosition", "right"); int tpv = RIGHT; if ("left".equalsIgnoreCase(textPos)) tpv = LEFT; else if ("up".equalsIgnoreCase(textPos)) tpv = UP; else if ("down".equalsIgnoreCase(textPos)) tpv = DOWN; componentSettings.put("TextPosition", new Integer(tpv)); componentSettings.put("Graph.HistoryManager.Class", properties.getProperty("Graph.HistoryManager.Class", "org.enhydra.jawe.HistoryMgr")); componentSettings.put("Graph.HistorySize", new Integer(properties.getProperty("Graph.HistorySize", "15"))); Color color; try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.BubbleColor")); } catch (Exception e) { color = Utils.getColor("R=197,G=231,B=235"); } componentSettings.put("BubbleColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.BubbleConectionColor")); } catch (Exception e) { color = Utils.getColor("SystemColor.textHighlight"); } componentSettings.put("BubbleConectionColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.ActivitySelectedColor")); } catch (Exception e) { color = Utils.getColor("R=248,G=242,B=14"); } componentSettings.put("ActivitySelectedColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.StartActivityColor")); } catch (Exception e) { color = Utils.getColor("R=102, G=204, B=51"); } componentSettings.put("StartActivityColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.EndActivityColor")); } catch (Exception e) { color = Utils.getColor("R=236, G=120, B=98"); } componentSettings.put("EndActivityColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.StartEndActivityColor")); } catch (Exception e) { color = Utils.getColor("R=255, G=255, B=175"); } componentSettings.put("StartEndActivityColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.BackgroundColor")); } catch (Exception e) { color = Utils.getColor("R=245,G=245,B=245"); } componentSettings.put("BackgroundColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.GridColor")); } catch (Exception e) { color = Utils.getColor("R=187,G=247,B=190"); } componentSettings.put("GridColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.TextColor")); } catch (Exception e) { color = Utils.getColor("SystemColor.textText"); } componentSettings.put("TextColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.ParticipantBorderColor")); } catch (Exception e) { color = Utils.getColor("SystemColor.textText"); } componentSettings.put("ParticipantBorderColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.ParticipantFreeTextExpressionColor")); } catch (Exception e) { color = Utils.getColor("Color.white"); } componentSettings.put("ParticipantFreeTextExpressionColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.ParticipantCommonExpressionColor")); } catch (Exception e) { color = Utils.getColor("R=255,G=255,B=196"); } componentSettings.put("ParticipantCommonExpressionColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.HandleColor")); } catch (Exception e) { color = Utils.getColor("Color.pink"); } componentSettings.put("HandleColor", color); try { color = Utils.getColor(ResourceManager.getResourceString(properties, "Graph.MarqueeColor")); } catch (Exception e) { color = Utils.getColor("SystemColor.textHighlight"); } componentSettings.put("MarqueeColor", color); ImageIcon cicon; URL iconURL = ResourceManager.getResource(properties, "Graph.XPDLElement.Image.Defualt"); if (iconURL != null) cicon = new ImageIcon(iconURL); else cicon = new ImageIcon(ResourceManager.class.getClassLoader() .getResource("org/enhydra/jawe/images/genericactivity.gif")); componentSettings.put("DefaultActivityIcon", cicon); iconURL = ResourceManager.getResource(properties, "Graph.XPDLElement.Image.Start"); if (iconURL != null) cicon = new ImageIcon(iconURL);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -