mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Added ability to set board size explicitly by typing in dimensions,
instead of dragging two control points
This commit is contained in:
@@ -65,11 +65,17 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
protected CoordinateOrigin coordinateOrigin = CoordinateOrigin.Top_Left;
|
||||
protected CoordinateDisplay coordinateDisplay = CoordinateDisplay.One_Side;
|
||||
protected CoordinateType yType = CoordinateType.Letters;
|
||||
|
||||
protected Size length;
|
||||
protected Size width;
|
||||
protected BoardSizingMode mode = BoardSizingMode.TwoPoints;
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
// render as transparent when dragging
|
||||
@@ -78,7 +84,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(boardColor);
|
||||
g2d.fillRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.fillRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
// Do not track any changes that follow because the whole board has been
|
||||
@@ -86,7 +92,17 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
drawingObserver.stopTracking();
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: borderColor);
|
||||
g2d.drawRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
}
|
||||
|
||||
protected Point getFinalSecondPoint() {
|
||||
Point finalSecondPoint;
|
||||
if (getMode() == BoardSizingMode.TwoPoints)
|
||||
finalSecondPoint = secondPoint;
|
||||
else
|
||||
finalSecondPoint = new Point((int)(firstPoint.x + getLength().convertToPixels()),
|
||||
(int)(firstPoint.y + getWidth().convertToPixels()));
|
||||
return finalSecondPoint;
|
||||
}
|
||||
|
||||
protected void drawCoordinates(Graphics2D g2d, int spacing, Project project) {
|
||||
@@ -97,6 +113,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
int halfSpace = spacing / 2;
|
||||
CoordinateOrigin origin = getCoordinateOrigin();
|
||||
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
if (getCoordinateDisplay() != CoordinateDisplay.None) {
|
||||
int range;
|
||||
int yOffset;
|
||||
@@ -104,12 +122,12 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
Point drawPoint = new Point(firstPoint);
|
||||
|
||||
if (origin == CoordinateOrigin.Top_Left || origin == CoordinateOrigin.Top_Right) {
|
||||
range = (int) ((secondPoint.y - firstPoint.y + halfSpace) / spacing);
|
||||
range = (int) ((finalSecondPoint.y - firstPoint.y + halfSpace) / spacing);
|
||||
yOffset = spacing;
|
||||
} else {
|
||||
range = (int) ((secondPoint.y - firstPoint.y + halfSpace) / spacing);
|
||||
range = (int) ((finalSecondPoint.y - firstPoint.y + halfSpace) / spacing);
|
||||
yOffset = -spacing;
|
||||
drawPoint.y = secondPoint.y;
|
||||
drawPoint.y = finalSecondPoint.y;
|
||||
}
|
||||
|
||||
for (int c = 1; c < range; c++) {
|
||||
@@ -122,7 +140,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
HorizontalAlignment.LEFT, VerticalAlignment.CENTER);
|
||||
if (getCoordinateDisplay() == CoordinateDisplay.Both_Sides) {
|
||||
StringUtils.drawCenteredText(g2d, label,
|
||||
secondPoint.x - xOffset, drawPoint.y,
|
||||
finalSecondPoint.x - xOffset, drawPoint.y,
|
||||
HorizontalAlignment.RIGHT, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
@@ -135,12 +153,12 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
Point drawPoint = new Point(firstPoint);
|
||||
|
||||
if (origin == CoordinateOrigin.Top_Left || origin == CoordinateOrigin.Bottom_Left) {
|
||||
range = (int) ((secondPoint.x - firstPoint.x + halfSpace) / spacing);
|
||||
range = (int) ((finalSecondPoint.x - firstPoint.x + halfSpace) / spacing);
|
||||
xOffset = spacing;
|
||||
} else {
|
||||
range = (int) ((secondPoint.x - firstPoint.x + halfSpace) / spacing);
|
||||
range = (int) ((finalSecondPoint.x - firstPoint.x + halfSpace) / spacing);
|
||||
xOffset = -spacing;
|
||||
drawPoint.x = secondPoint.x;
|
||||
drawPoint.x = finalSecondPoint.x;
|
||||
}
|
||||
|
||||
for (int c = 1; c < range; c++) {
|
||||
@@ -152,7 +170,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.TOP);
|
||||
if (getCoordinateDisplay() == CoordinateDisplay.Both_Sides) {
|
||||
StringUtils.drawCenteredText(g2d, label,
|
||||
drawPoint.x, (int) (secondPoint.y - COORDINATE_FONT_SIZE),
|
||||
drawPoint.x, (int) (finalSecondPoint.y - COORDINATE_FONT_SIZE),
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM);
|
||||
}
|
||||
}
|
||||
@@ -263,7 +281,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
|
||||
@Override
|
||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||
return VisibilityPolicy.WHEN_SELECTED;
|
||||
return getMode() == BoardSizingMode.TwoPoints ? VisibilityPolicy.WHEN_SELECTED : VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,7 +303,36 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Explicit Length", validatorClass = BoardModeValidator.class)
|
||||
public Size getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(Size length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Explicit Width", validatorClass = BoardModeValidator.class)
|
||||
public Size getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(Size width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Sizing Mode")
|
||||
public BoardSizingMode getMode() {
|
||||
if (mode == null)
|
||||
mode = BoardSizingMode.TwoPoints;
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(BoardSizingMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public static enum CoordinateType {
|
||||
Letters, Numbers
|
||||
}
|
||||
@@ -307,4 +354,19 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
return super.toString().replace('_', ' ');
|
||||
};
|
||||
}
|
||||
|
||||
public static enum BoardSizingMode {
|
||||
TwoPoints("Opposing Points"), Explicit("Explicit Dimensions");
|
||||
|
||||
private String label;
|
||||
|
||||
private BoardSizingMode(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
@@ -57,12 +58,14 @@ public class BlankBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
@@ -72,9 +75,9 @@ public class BlankBoard extends AbstractBoard {
|
||||
}
|
||||
g2d.setColor(boardColor);
|
||||
if (getType() == Type.SQUARE)
|
||||
g2d.fillRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.fillRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
else
|
||||
g2d.fillOval(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.fillOval(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
// Do not track any changes that follow because the whole board has been
|
||||
@@ -83,9 +86,9 @@ public class BlankBoard extends AbstractBoard {
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: borderColor);
|
||||
if (getType() == Type.SQUARE)
|
||||
g2d.drawRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
else
|
||||
g2d.drawOval(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y - firstPoint.y);
|
||||
g2d.drawOval(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.diylc.components.boards;
|
||||
|
||||
import org.diylc.components.boards.AbstractBoard.BoardSizingMode;
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
import org.diylc.core.ValidationException;
|
||||
import org.diylc.core.measures.Size;
|
||||
|
||||
public class BoardModeValidator implements IPropertyValidator {
|
||||
|
||||
public BoardModeValidator() {}
|
||||
|
||||
@Override
|
||||
public void validate(Object owner, Object value) throws ValidationException {
|
||||
AbstractBoard board = (AbstractBoard)owner;
|
||||
Size size = (Size)value;
|
||||
if (board.getMode() == BoardSizingMode.Explicit && (value == null || size.getValue() == null || size.getUnit() == null))
|
||||
throw new ValidationException("Dimensions are required when mode is set to " + BoardSizingMode.Explicit);
|
||||
}
|
||||
}
|
||||
@@ -68,10 +68,12 @@ public class EyeletBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
@@ -84,10 +86,10 @@ public class EyeletBoard extends AbstractBoard {
|
||||
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
int spacing = (int) this.spacing.convertToPixels();
|
||||
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
while (p.y < finalSecondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
while (p.x < secondPoint.x - spacing - diameter) {
|
||||
while (p.x < finalSecondPoint.x - spacing - diameter) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(eyeletColor);
|
||||
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
||||
|
||||
@@ -66,10 +66,12 @@ public class MarshallPerfBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
@@ -81,10 +83,10 @@ public class MarshallPerfBoard extends AbstractBoard {
|
||||
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
int spacing = (int) this.spacing.convertToPixels();
|
||||
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
while (p.y < finalSecondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
while (p.x < secondPoint.x - spacing - holeDiameter) {
|
||||
while (p.x < finalSecondPoint.x - spacing - holeDiameter) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
|
||||
|
||||
@@ -61,10 +61,12 @@ public class PerfBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
@@ -77,10 +79,10 @@ public class PerfBoard extends AbstractBoard {
|
||||
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
int spacing = (int) this.spacing.convertToPixels();
|
||||
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
while (p.y < finalSecondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
while (p.x < secondPoint.x - spacing - diameter) {
|
||||
while (p.x < finalSecondPoint.x - spacing - diameter) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(padColor);
|
||||
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
||||
|
||||
@@ -64,10 +64,12 @@ public class TriPadBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
@@ -82,13 +84,13 @@ public class TriPadBoard extends AbstractBoard {
|
||||
int spacing = (int) this.spacing.convertToPixels();
|
||||
|
||||
if (orientation == OrientationHV.HORIZONTAL) {
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
while (p.y < finalSecondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
|
||||
while (p.x + spacing < secondPoint.x) {
|
||||
while (p.x + spacing < finalSecondPoint.x) {
|
||||
|
||||
int remainingSpace = secondPoint.x - p.x;
|
||||
int remainingSpace = finalSecondPoint.x - p.x;
|
||||
int spacesToDraw = stripSpan;
|
||||
|
||||
if (remainingSpace < (stripSize + (stripSpan * spacing))) {
|
||||
@@ -111,7 +113,7 @@ public class TriPadBoard extends AbstractBoard {
|
||||
// draw holes
|
||||
p.x = firstPoint.x;
|
||||
|
||||
while (p.x < secondPoint.x - spacing - holeSize) {
|
||||
while (p.x < finalSecondPoint.x - spacing - holeSize) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||
@@ -120,13 +122,13 @@ public class TriPadBoard extends AbstractBoard {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (p.x < secondPoint.x - spacing) {
|
||||
while (p.x < finalSecondPoint.x - spacing) {
|
||||
p.x += spacing;
|
||||
p.y = firstPoint.y;
|
||||
|
||||
while (p.y + spacing < secondPoint.y) {
|
||||
while (p.y + spacing < finalSecondPoint.y) {
|
||||
|
||||
int remainingSpace = secondPoint.y - p.y;
|
||||
int remainingSpace = finalSecondPoint.y - p.y;
|
||||
int spacesToDraw = stripSpan;
|
||||
|
||||
if (remainingSpace < (stripSize + (stripSpan * spacing))) {
|
||||
@@ -148,7 +150,7 @@ public class TriPadBoard extends AbstractBoard {
|
||||
// draw holes
|
||||
p.y = firstPoint.y;
|
||||
|
||||
while (p.y < secondPoint.y - spacing - holeSize) {
|
||||
while (p.y < finalSecondPoint.y - spacing - holeSize) {
|
||||
p.y += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||
|
||||
@@ -64,10 +64,12 @@ public class VeroBoard extends AbstractBoard {
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
IDrawingObserver drawingObserver) {
|
||||
Point finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Shape clip = g2d.getClip();
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, finalSecondPoint.y)
|
||||
&& !clip.contains(finalSecondPoint.x, firstPoint.y)) {
|
||||
return;
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
@@ -82,16 +84,16 @@ public class VeroBoard extends AbstractBoard {
|
||||
int spacing = (int) this.spacing.convertToPixels();
|
||||
|
||||
if (orientation == OrientationHV.HORIZONTAL) {
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
while (p.y < finalSecondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x, stripSize);
|
||||
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, finalSecondPoint.x - spacing - p.x, stripSize);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x, stripSize);
|
||||
while (p.x < secondPoint.x - spacing - holeSize) {
|
||||
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, finalSecondPoint.x - spacing - p.x, stripSize);
|
||||
while (p.x < finalSecondPoint.x - spacing - holeSize) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||
@@ -100,16 +102,16 @@ public class VeroBoard extends AbstractBoard {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (p.x < secondPoint.x - spacing) {
|
||||
while (p.x < finalSecondPoint.x - spacing) {
|
||||
p.x += spacing;
|
||||
p.y = firstPoint.y;
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y - spacing - p.y);
|
||||
g2d.fillRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, finalSecondPoint.y - spacing - p.y);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
g2d.drawRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y - spacing - p.y);
|
||||
while (p.y < secondPoint.y - spacing - holeSize) {
|
||||
g2d.drawRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, finalSecondPoint.y - spacing - p.y);
|
||||
while (p.y < finalSecondPoint.y - spacing - holeSize) {
|
||||
p.y += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||
|
||||
@@ -193,7 +193,7 @@ public class DiodeSymbol extends AbstractTubeSymbol {
|
||||
public class HeaterValidator implements IPropertyValidator {
|
||||
|
||||
@Override
|
||||
public void validate(Object value) throws ValidationException {
|
||||
public void validate(Object owner, Object value) throws ValidationException {
|
||||
if (value != null && value instanceof Boolean) {
|
||||
boolean b = (Boolean) value;
|
||||
if (!b && getDirectlyHeated()) {
|
||||
|
||||
Reference in New Issue
Block a user