mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
redo shape class hierarchy
This commit is contained in:
+108
@@ -0,0 +1,108 @@
|
|||||||
|
package org.diylc.components.shapes;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import org.diylc.common.ObjectCache;
|
||||||
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IDrawingObserver;
|
||||||
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.VisibilityPolicy;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
|
public abstract class AbstractShape extends AbstractTransparentComponent<Void> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static Color COLOR = Color.white;
|
||||||
|
public static Color BORDER_COLOR = Color.black;
|
||||||
|
public static Size DEFAULT_WIDTH = new Size(0.6d, SizeUnit.in);
|
||||||
|
public static Size DEFAULT_HEIGHT = new Size(0.4d, SizeUnit.in);
|
||||||
|
|
||||||
|
protected String value = "";
|
||||||
|
protected Point[] controlPoints = new Point[] {
|
||||||
|
new Point(0, 0),
|
||||||
|
new Point((int) DEFAULT_WIDTH.convertToPixels(),
|
||||||
|
(int) DEFAULT_HEIGHT.convertToPixels()) };
|
||||||
|
protected Point firstPoint = new Point();
|
||||||
|
protected Point secondPoint = new Point();
|
||||||
|
|
||||||
|
protected Color color = COLOR;
|
||||||
|
protected Color borderColor = BORDER_COLOR;
|
||||||
|
protected Size borderThickness = new Size(0.2d, SizeUnit.mm);
|
||||||
|
|
||||||
|
@EditableProperty(name = "Color")
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Border")
|
||||||
|
public Color getBorderColor() {
|
||||||
|
return borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorderColor(Color borderColor) {
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Border thickness")
|
||||||
|
public Size getBorderThickness() {
|
||||||
|
return borderThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorderThickness(Size borderThickness) {
|
||||||
|
this.borderThickness = borderThickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getControlPointCount() {
|
||||||
|
return controlPoints.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getControlPoint(int index) {
|
||||||
|
return controlPoints[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isControlPointSticky(int index) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
return VisibilityPolicy.WHEN_SELECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point point, int index) {
|
||||||
|
controlPoints[index].setLocation(point);
|
||||||
|
firstPoint.setLocation(
|
||||||
|
Math.min(controlPoints[0].x, controlPoints[1].x), Math.min(
|
||||||
|
controlPoints[0].y, controlPoints[1].y));
|
||||||
|
secondPoint.setLocation(Math
|
||||||
|
.max(controlPoints[0].x, controlPoints[1].x), Math.max(
|
||||||
|
controlPoints[0].y, controlPoints[1].y));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public Void getValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public void setValue(Void value) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-94
@@ -1,46 +1,22 @@
|
|||||||
package org.diylc.components.shapes;
|
package org.diylc.components.shapes;
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
|
||||||
import org.diylc.core.measures.Size;
|
|
||||||
import org.diylc.core.measures.SizeUnit;
|
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Ellipse", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "ELL", description = "Elliptical area", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
@ComponentDescriptor(name = "Ellipse", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "ELL", description = "Elliptical area", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||||
public class Ellipse extends AbstractTransparentComponent<Void> {
|
public class Ellipse extends AbstractShape {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color COLOR = Color.white;
|
|
||||||
public static Color BORDER_COLOR = Color.black;
|
|
||||||
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
|
||||||
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
|
|
||||||
|
|
||||||
protected String value = "";
|
|
||||||
protected Point[] controlPoints = new Point[] {
|
|
||||||
new Point(0, 0),
|
|
||||||
new Point((int) DEFAULT_WIDTH.convertToPixels(),
|
|
||||||
(int) DEFAULT_HEIGHT.convertToPixels()) };
|
|
||||||
protected Point firstPoint = new Point();
|
|
||||||
protected Point secondPoint = new Point();
|
|
||||||
|
|
||||||
protected Color color = COLOR;
|
|
||||||
protected Color borderColor = BORDER_COLOR;
|
|
||||||
protected Size borderThickness = new Size(0.2d, SizeUnit.mm);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||||
boolean outlineMode, Project project,
|
boolean outlineMode, Project project,
|
||||||
@@ -68,64 +44,6 @@ public class Ellipse extends AbstractTransparentComponent<Void> {
|
|||||||
secondPoint.y - firstPoint.y);
|
secondPoint.y - firstPoint.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Color")
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border thickness")
|
|
||||||
public Size getBorderThickness() {
|
|
||||||
return borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderThickness(Size borderThickness) {
|
|
||||||
this.borderThickness = borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getControlPointCount() {
|
|
||||||
return controlPoints.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Point getControlPoint(int index) {
|
|
||||||
return controlPoints[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isControlPointSticky(int index) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
|
||||||
return VisibilityPolicy.WHEN_SELECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setControlPoint(Point point, int index) {
|
|
||||||
controlPoints[index].setLocation(point);
|
|
||||||
firstPoint.setLocation(
|
|
||||||
Math.min(controlPoints[0].x, controlPoints[1].x), Math.min(
|
|
||||||
controlPoints[0].y, controlPoints[1].y));
|
|
||||||
secondPoint.setLocation(Math
|
|
||||||
.max(controlPoints[0].x, controlPoints[1].x), Math.max(
|
|
||||||
controlPoints[0].y, controlPoints[1].y));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
@@ -136,15 +54,4 @@ public class Ellipse extends AbstractTransparentComponent<Void> {
|
|||||||
g2d.drawOval(2 / factor, 2 / factor, width - 4 / factor, height - 4
|
g2d.drawOval(2 / factor, 2 / factor, width - 4 / factor, height - 4
|
||||||
/ factor);
|
/ factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public Void getValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public void setValue(Void value) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-83
@@ -8,40 +8,31 @@ import java.awt.Point;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
|
||||||
import org.diylc.core.measures.SizeUnit;
|
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Polygon", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "POLY", description = "Polygonal area", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
@ComponentDescriptor(name = "Polygon", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "POLY", description = "Polygonal area", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||||
public class Polygon extends AbstractTransparentComponent<Void> {
|
public class Polygon extends AbstractShape {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color COLOR = Color.white;
|
|
||||||
public static Color BORDER_COLOR = Color.black;
|
|
||||||
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
|
||||||
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
|
|
||||||
|
|
||||||
protected Point[] controlPoints = new Point[] {
|
|
||||||
new Point(0, 0),
|
|
||||||
new Point(0, (int) DEFAULT_HEIGHT.convertToPixels()),
|
|
||||||
new Point((int) DEFAULT_WIDTH.convertToPixels(),
|
|
||||||
(int) DEFAULT_HEIGHT.convertToPixels()),
|
|
||||||
new Point((int) DEFAULT_WIDTH.convertToPixels(), 0) };
|
|
||||||
|
|
||||||
protected Color color = COLOR;
|
|
||||||
protected Color borderColor = BORDER_COLOR;
|
|
||||||
protected Size borderThickness = new Size(0.2d, SizeUnit.mm);
|
|
||||||
protected PointCount pointCount = PointCount._4;
|
protected PointCount pointCount = PointCount._4;
|
||||||
|
|
||||||
|
public Polygon() {
|
||||||
|
super();
|
||||||
|
this.controlPoints = new Point[] {
|
||||||
|
new Point(0, 0),
|
||||||
|
new Point(0, (int) DEFAULT_HEIGHT.convertToPixels()),
|
||||||
|
new Point((int) DEFAULT_WIDTH.convertToPixels(),
|
||||||
|
(int) DEFAULT_HEIGHT.convertToPixels()),
|
||||||
|
new Point((int) DEFAULT_WIDTH.convertToPixels(), 0) };
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||||
boolean outlineMode, Project project,
|
boolean outlineMode, Project project,
|
||||||
@@ -73,58 +64,6 @@ public class Polygon extends AbstractTransparentComponent<Void> {
|
|||||||
g2d.drawPolygon(xPoints, yPoints, controlPoints.length);
|
g2d.drawPolygon(xPoints, yPoints, controlPoints.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Color")
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border thickness")
|
|
||||||
public Size getBorderThickness() {
|
|
||||||
return borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderThickness(Size borderThickness) {
|
|
||||||
this.borderThickness = borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getControlPointCount() {
|
|
||||||
return controlPoints.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Point getControlPoint(int index) {
|
|
||||||
return controlPoints[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isControlPointSticky(int index) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
|
||||||
return VisibilityPolicy.WHEN_SELECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setControlPoint(Point point, int index) {
|
|
||||||
controlPoints[index].setLocation(point);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Edges")
|
@EditableProperty(name = "Edges")
|
||||||
public PointCount getPointCount() {
|
public PointCount getPointCount() {
|
||||||
return pointCount;
|
return pointCount;
|
||||||
@@ -147,17 +86,6 @@ public class Polygon extends AbstractTransparentComponent<Void> {
|
|||||||
this.pointCount = pointCount;
|
this.pointCount = pointCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public Void getValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public void setValue(Void value) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
|
|||||||
+1
-90
@@ -1,18 +1,14 @@
|
|||||||
package org.diylc.components.shapes;
|
package org.diylc.components.shapes;
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -20,27 +16,11 @@ import org.diylc.core.measures.Size;
|
|||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Rectangle", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "RECT", description = "Ractangular area, with or withouth rounded edges", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
@ComponentDescriptor(name = "Rectangle", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "RECT", description = "Ractangular area, with or withouth rounded edges", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||||
public class Rectangle extends AbstractTransparentComponent<Void> {
|
public class Rectangle extends AbstractShape {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color COLOR = Color.white;
|
|
||||||
public static Color BORDER_COLOR = Color.black;
|
|
||||||
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
|
||||||
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
|
|
||||||
|
|
||||||
protected String value = "";
|
|
||||||
protected Point[] controlPoints = new Point[] {
|
|
||||||
new Point(0, 0),
|
|
||||||
new Point((int) DEFAULT_WIDTH.convertToPixels(),
|
|
||||||
(int) DEFAULT_HEIGHT.convertToPixels()) };
|
|
||||||
protected Point firstPoint = new Point();
|
|
||||||
protected Point secondPoint = new Point();
|
|
||||||
|
|
||||||
protected Color color = COLOR;
|
|
||||||
protected Color borderColor = BORDER_COLOR;
|
|
||||||
protected Size edgeRadius = new Size(0d, SizeUnit.mm);
|
protected Size edgeRadius = new Size(0d, SizeUnit.mm);
|
||||||
protected Size borderThickness = new Size(0.2d, SizeUnit.mm);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||||
@@ -70,33 +50,6 @@ public class Rectangle extends AbstractTransparentComponent<Void> {
|
|||||||
- firstPoint.x, secondPoint.y - firstPoint.y, radius, radius);
|
- firstPoint.x, secondPoint.y - firstPoint.y, radius, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Color")
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border thickness")
|
|
||||||
public Size getBorderThickness() {
|
|
||||||
return borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderThickness(Size borderThickness) {
|
|
||||||
this.borderThickness = borderThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Radius")
|
@EditableProperty(name = "Radius")
|
||||||
public Size getEdgeRadius() {
|
public Size getEdgeRadius() {
|
||||||
return edgeRadius;
|
return edgeRadius;
|
||||||
@@ -106,37 +59,6 @@ public class Rectangle extends AbstractTransparentComponent<Void> {
|
|||||||
this.edgeRadius = edgeRadius;
|
this.edgeRadius = edgeRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getControlPointCount() {
|
|
||||||
return controlPoints.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Point getControlPoint(int index) {
|
|
||||||
return controlPoints[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isControlPointSticky(int index) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
|
||||||
return VisibilityPolicy.WHEN_SELECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setControlPoint(Point point, int index) {
|
|
||||||
controlPoints[index].setLocation(point);
|
|
||||||
firstPoint.setLocation(
|
|
||||||
Math.min(controlPoints[0].x, controlPoints[1].x), Math.min(
|
|
||||||
controlPoints[0].y, controlPoints[1].y));
|
|
||||||
secondPoint.setLocation(Math
|
|
||||||
.max(controlPoints[0].x, controlPoints[1].x), Math.max(
|
|
||||||
controlPoints[0].y, controlPoints[1].y));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
@@ -147,15 +69,4 @@ public class Rectangle extends AbstractTransparentComponent<Void> {
|
|||||||
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4
|
||||||
/ factor);
|
/ factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public Void getValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public void setValue(Void value) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user