From 352b3aeb6f6fa3f0aec5e336a1f1a08a1380ff76 Mon Sep 17 00:00:00 2001 From: bancika Date: Tue, 9 Oct 2012 08:28:10 +0000 Subject: [PATCH] Clearer standing component (mainly diode) reversion --- .../components/AbstractLeadedComponent.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/components/AbstractLeadedComponent.java b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/components/AbstractLeadedComponent.java index 45b970c5..e9e199f8 100644 --- a/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/components/AbstractLeadedComponent.java +++ b/ diy-layout-creator --username bancika@gmail.com/diylc-core/src/org/diylc/components/AbstractLeadedComponent.java @@ -51,6 +51,7 @@ public abstract class AbstractLeadedComponent extends protected Color borderColor = Color.black; protected Color labelColor = LABEL_COLOR; protected Display display = Display.NAME; + private boolean flipStanding = false; protected AbstractLeadedComponent() { super(); @@ -78,8 +79,10 @@ public abstract class AbstractLeadedComponent extends // When ending points are too close draw the component in standing // mode. int width = getClosestOdd(this.width.convertToPixels()); - Shape body = new Ellipse2D.Double(points[0].x - width / 2, - points[0].y - width / 2, width, width); + Shape body = new Ellipse2D.Double((getFlipStanding() ? points[1] + : points[0]).x + - width / 2, (getFlipStanding() ? points[1] : points[0]).y + - width / 2, width, width); Composite oldComposite = g2d.getComposite(); if (alpha < MAX_ALPHA) { g2d.setComposite(AlphaComposite.getInstance( @@ -456,4 +459,18 @@ public abstract class AbstractLeadedComponent extends public void setLabelColor(Color labelColor) { this.labelColor = labelColor; } + + /** + * Override this method with @EditableProperty annotation in child classes + * where standing mode is supported + * + * @return + */ + public boolean getFlipStanding() { + return flipStanding; + } + + public void setFlipStanding(boolean flipStanding) { + this.flipStanding = flipStanding; + } }