X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2Fnodes%2FBorderDecoratorNode.java;h=16846d5b1a67d467afbab3b7a0e5b5a974684261;hb=a9513be166b1fd5c369b013fedfdd39f07685a2c;hp=d79ae61aeddb42aff6b9e5ed0ef8e1aba2eb22be;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/BorderDecoratorNode.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/BorderDecoratorNode.java index d79ae61ae..16846d5b1 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/BorderDecoratorNode.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/BorderDecoratorNode.java @@ -1,81 +1,81 @@ -/******************************************************************************* - * 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.scenegraph.g2d.nodes; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Composite; -import java.awt.Graphics2D; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; - -public class BorderDecoratorNode extends TransformNode { - /** - * - */ - private static final long serialVersionUID = -4982578347433716440L; - - protected Composite composite; - protected Boolean visible = Boolean.TRUE; - protected Rectangle2D bounds = null; - protected float border = 1.0f; - - @SyncField("composite") - public void setComposite(Composite composite) { - this.composite = composite; - } - - @SyncField("visible") - public void setVisible(Boolean visible) { - this.visible = visible; - } - - @PropertySetter("Stroke Width") - @SyncField("border") - public void setBorderWidth(Float borderWidth) { - this.border = borderWidth != null ? borderWidth : 1.0f; - } - - public boolean isVisible() { - return visible; - } - - @PropertySetter("Bounds") - @SyncField("bounds") - public void setBounds(Rectangle2D bounds) { - this.bounds = bounds; - } - - @Override - public Rectangle2D getBoundsInLocal() { - return bounds; - } - - @Override - public void render(Graphics2D g) { - if(!visible) return; - if(composite != null) { - g.setComposite(composite); - } - - if(this.border > 0.0f && bounds != null) { - AffineTransform ot = g.getTransform(); - g.transform(transform); - g.setStroke(new BasicStroke(this.border)); - g.setColor(Color.BLACK); - g.draw(bounds); - - g.setTransform(ot); - } - super.render(g); - } -} +/******************************************************************************* + * 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.scenegraph.g2d.nodes; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; + +public class BorderDecoratorNode extends TransformNode { + /** + * + */ + private static final long serialVersionUID = -4982578347433716440L; + + protected Composite composite; + protected Boolean visible = Boolean.TRUE; + protected Rectangle2D bounds = null; + protected float border = 1.0f; + + @SyncField("composite") + public void setComposite(Composite composite) { + this.composite = composite; + } + + @SyncField("visible") + public void setVisible(Boolean visible) { + this.visible = visible; + } + + @PropertySetter("Stroke Width") + @SyncField("border") + public void setBorderWidth(Float borderWidth) { + this.border = borderWidth != null ? borderWidth : 1.0f; + } + + public boolean isVisible() { + return visible; + } + + @PropertySetter("Bounds") + @SyncField("bounds") + public void setBounds(Rectangle2D bounds) { + this.bounds = bounds; + } + + @Override + public Rectangle2D getBoundsInLocal() { + return bounds; + } + + @Override + public void render(Graphics2D g) { + if(!visible) return; + if(composite != null) { + g.setComposite(composite); + } + + if(this.border > 0.0f && bounds != null) { + AffineTransform ot = g.getTransform(); + g.transform(transform); + g.setStroke(new BasicStroke(this.border)); + g.setColor(Color.BLACK); + g.draw(bounds); + + g.setTransform(ot); + } + super.render(g); + } +}