X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Felement%2Fhandler%2Fimpl%2FStaticEdgeVisuals.java;h=115540c2e50db578fcf5ab0f98bdb674369bd780;hb=f29c665f426c5d85d11ce1467b158f10c633728b;hp=c10c635f62a81321450553c6ec64cae7400df338;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/StaticEdgeVisuals.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/StaticEdgeVisuals.java index c10c635f6..115540c2e 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/StaticEdgeVisuals.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/StaticEdgeVisuals.java @@ -1,95 +1,95 @@ -/******************************************************************************* - * 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"); - } - - -} +/******************************************************************************* + * 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"); + } + + +}