-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.element.handler.impl;\r
-\r
-import java.awt.Stroke;\r
-\r
-import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.element.handler.EdgeVisuals;\r
-\r
-/**\r
- * Edge visuals that are the same for all edges of the class.\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class StaticEdgeVisuals implements EdgeVisuals {\r
-\r
- private static final long serialVersionUID = -2263869759801224096L;\r
-\r
- public static final StaticEdgeVisuals DEFAULT_EDGE_VISUALS =\r
- new StaticEdgeVisuals(ArrowType.None, ArrowType.Stroke, ConfigurableEdgeVisuals.DEFAULT_STROKE, 3.0, 3.0);\r
-\r
- ArrowType beginArrow, endArrow;\r
- Stroke stroke;\r
- StrokeType strokeType;\r
- double beginArrowSize, endArrowSize;\r
-\r
- public StaticEdgeVisuals(ArrowType beginArrow, ArrowType endArrow, Stroke stroke, double beginArrowSize, double endArrowSize)\r
- {\r
- this.beginArrow = beginArrow;\r
- this.endArrow = endArrow;\r
- this.stroke = stroke;\r
- this.strokeType = StrokeType.Relative;\r
- this.beginArrowSize = beginArrowSize;\r
- this.endArrowSize = endArrowSize;\r
- }\r
-\r
- @Override\r
- public ArrowType getArrowType(IElement e, EdgeEnd end) {\r
- if (end==EdgeEnd.Begin)\r
- return beginArrow;\r
- if (end==EdgeEnd.End)\r
- return beginArrow;\r
- throw new RuntimeException();\r
- }\r
-\r
- @Override\r
- public StrokeType getStrokeType(IElement e) {\r
- return strokeType;\r
- }\r
-\r
- @Override\r
- public Stroke getStroke(IElement e) {\r
- return stroke;\r
- }\r
-\r
- @Override\r
- public void setArrowType(IElement e, EdgeEnd end, ArrowType arrowType) {\r
- throw new RuntimeException("Cannot modify static edge visuals");\r
- }\r
-\r
- @Override\r
- public void setStroke(IElement e, Stroke s) {\r
- throw new RuntimeException("Cannot modify static edge visuals");\r
- }\r
-\r
- @Override\r
- public void setStrokeType(IElement e, StrokeType t) {\r
- throw new RuntimeException("Cannot modify static edge visuals");\r
- }\r
-\r
- @Override\r
- public double getArrowSize(IElement e, EdgeEnd end) {\r
- if (end == EdgeEnd.Begin)\r
- return beginArrowSize;\r
- if (end==EdgeEnd.End)\r
- return endArrowSize;\r
- return 0;\r
- }\r
-\r
- @Override\r
- public void setArrowSize(IElement e, EdgeEnd end, double size) {\r
- throw new RuntimeException("Cannot modify arrow size");\r
- }\r
-\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.element.handler.impl;
+
+import java.awt.Stroke;
+
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.element.handler.EdgeVisuals;
+
+/**
+ * Edge visuals that are the same for all edges of the class.
+ *
+ * @author Toni Kalajainen
+ */
+public class StaticEdgeVisuals implements EdgeVisuals {
+
+ private static final long serialVersionUID = -2263869759801224096L;
+
+ public static final StaticEdgeVisuals DEFAULT_EDGE_VISUALS =
+ new StaticEdgeVisuals(ArrowType.None, ArrowType.Stroke, ConfigurableEdgeVisuals.DEFAULT_STROKE, 3.0, 3.0);
+
+ ArrowType beginArrow, endArrow;
+ Stroke stroke;
+ StrokeType strokeType;
+ double beginArrowSize, endArrowSize;
+
+ public StaticEdgeVisuals(ArrowType beginArrow, ArrowType endArrow, Stroke stroke, double beginArrowSize, double endArrowSize)
+ {
+ this.beginArrow = beginArrow;
+ this.endArrow = endArrow;
+ this.stroke = stroke;
+ this.strokeType = StrokeType.Relative;
+ this.beginArrowSize = beginArrowSize;
+ this.endArrowSize = endArrowSize;
+ }
+
+ @Override
+ public ArrowType getArrowType(IElement e, EdgeEnd end) {
+ if (end==EdgeEnd.Begin)
+ return beginArrow;
+ if (end==EdgeEnd.End)
+ return beginArrow;
+ throw new RuntimeException();
+ }
+
+ @Override
+ public StrokeType getStrokeType(IElement e) {
+ return strokeType;
+ }
+
+ @Override
+ public Stroke getStroke(IElement e) {
+ return stroke;
+ }
+
+ @Override
+ public void setArrowType(IElement e, EdgeEnd end, ArrowType arrowType) {
+ throw new RuntimeException("Cannot modify static edge visuals");
+ }
+
+ @Override
+ public void setStroke(IElement e, Stroke s) {
+ throw new RuntimeException("Cannot modify static edge visuals");
+ }
+
+ @Override
+ public void setStrokeType(IElement e, StrokeType t) {
+ throw new RuntimeException("Cannot modify static edge visuals");
+ }
+
+ @Override
+ public double getArrowSize(IElement e, EdgeEnd end) {
+ if (end == EdgeEnd.Begin)
+ return beginArrowSize;
+ if (end==EdgeEnd.End)
+ return endArrowSize;
+ return 0;
+ }
+
+ @Override
+ public void setArrowSize(IElement e, EdgeEnd end, double size) {
+ throw new RuntimeException("Cannot modify arrow size");
+ }
+
+
+}