Show jack type in the BOM

This commit is contained in:
Bane Stojkovic
2022-12-13 18:39:16 +01:00
parent b6f3020072
commit b89a851513
9 changed files with 68 additions and 104 deletions
@@ -4258,6 +4258,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Escape comma in BOM CSV files to avoid component names being split into separate columns</description> <description>Escape comma in BOM CSV files to avoid component names being split into separate columns</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Show jack type in the BOM</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Improved find tool usability, make the screen pan to the selected components</description> <description>Improved find tool usability, make the screen pan to the selected components</description>
Binary file not shown.
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
description = "Cliff-style closed panel mount 1/4\" phono jack", description = "Cliff-style closed panel mount 1/4\" phono jack",
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = CliffJackTransformer.class, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = CliffJackTransformer.class,
enableCache = true) enableCache = true)
public class CliffJack1_4 extends AbstractMultiPartComponent<String> { public class CliffJack1_4 extends AbstractMultiPartComponent<JackType> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -76,7 +76,9 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
private JackType type = JackType.MONO; private JackType type = JackType.MONO;
private Orientation orientation = Orientation.DEFAULT; private Orientation orientation = Orientation.DEFAULT;
transient private Area[] body; transient private Area[] body;
private String value = ""; @SuppressWarnings("unused")
@Deprecated
private transient String value = "";
public CliffJack1_4() { public CliffJack1_4() {
super(); super();
@@ -316,23 +318,12 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
return VisibilityPolicy.NEVER; return VisibilityPolicy.NEVER;
} }
@EditableProperty @EditableProperty(name = "Type")
@Override public JackType getValue() {
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty
public JackType getType() {
return type; return type;
} }
public void setType(JackType type) { public void setValue(JackType type) {
this.type = type; this.type = type;
updateControlPoints(); updateControlPoints();
} }
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Closed 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic", @ComponentDescriptor(name = "Closed 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
description = "Enclosed panel mount 1/4\" phono jack", zOrder = IDIYComponent.COMPONENT, description = "Enclosed panel mount 1/4\" phono jack", zOrder = IDIYComponent.COMPONENT,
instanceNamePrefix = "J", autoEdit = false, transformer = ClosedJackTransformer.class, enableCache = true) instanceNamePrefix = "J", autoEdit = false, transformer = ClosedJackTransformer.class, enableCache = true)
public class ClosedJack1_4 extends AbstractMultiPartComponent<String> { public class ClosedJack1_4 extends AbstractMultiPartComponent<JackType> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -78,7 +78,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
private JackType type = JackType.MONO; private JackType type = JackType.MONO;
private Orientation orientation = Orientation.DEFAULT; private Orientation orientation = Orientation.DEFAULT;
transient private Shape[] body; transient private Shape[] body;
private String value = ""; @SuppressWarnings("unused")
@Deprecated
private transient String value = "";
public ClosedJack1_4() { public ClosedJack1_4() {
super(); super();
@@ -327,23 +329,12 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
return VisibilityPolicy.NEVER; return VisibilityPolicy.NEVER;
} }
@EditableProperty @EditableProperty(name = "Type")
@Override public JackType getValue() {
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty
public JackType getType() {
return type; return type;
} }
public void setType(JackType type) { public void setValue(JackType type) {
this.type = type; this.type = type;
updateControlPoints(); updateControlPoints();
} }
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
description = "1/4\" mono/stereo phono jack based on Neutrik NMJx series, PCB or Panel-mount", description = "1/4\" mono/stereo phono jack based on Neutrik NMJx series, PCB or Panel-mount",
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = NeutrikJack1_4Transformer.class, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = NeutrikJack1_4Transformer.class,
enableCache = true) enableCache = true)
public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> { public class NeutrikJack1_4 extends AbstractMultiPartComponent<JackType> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -81,7 +81,10 @@ public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> {
private Mount mount = Mount.Panel; private Mount mount = Mount.Panel;
private Orientation orientation = Orientation.DEFAULT; private Orientation orientation = Orientation.DEFAULT;
transient private Area[] body; transient private Area[] body;
private String value = ""; @SuppressWarnings("unused")
@Deprecated
private transient String value = "";
public NeutrikJack1_4() { public NeutrikJack1_4() {
super(); super();
@@ -330,23 +333,12 @@ public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> {
return VisibilityPolicy.NEVER; return VisibilityPolicy.NEVER;
} }
@EditableProperty @EditableProperty(name = "Type")
@Override public JackType getValue() {
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty
public JackType getType() {
return type; return type;
} }
public void setType(JackType type) { public void setValue(JackType type) {
this.type = type; this.type = type;
updateControlPoints(); updateControlPoints();
} }
@@ -51,11 +51,12 @@ import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size; import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit; import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants; import org.diylc.utils.Constants;
import org.diylc.components.electromechanical.OpenJack1_4.OpenJackType;
@ComponentDescriptor(name = "Open 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic", @ComponentDescriptor(name = "Open 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
description = "Switchcraft-style open panel mount 1/4\" phono jack, stereo and mono", description = "Switchcraft-style open panel mount 1/4\" phono jack, stereo and mono",
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true) zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
public class OpenJack1_4 extends AbstractMultiPartComponent<String> { public class OpenJack1_4 extends AbstractMultiPartComponent<OpenJackType> {
private static final float FONT_SCALE = 0.8f; private static final float FONT_SCALE = 0.8f;
private static final double RING_THETA = Math.PI * 0.795; private static final double RING_THETA = Math.PI * 0.795;
@@ -76,7 +77,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
private static Size HOLE_DIAMETER = new Size(0.05d, SizeUnit.in); private static Size HOLE_DIAMETER = new Size(0.05d, SizeUnit.in);
private static Size HOLE_TO_EDGE = new Size(0.063d, SizeUnit.in); private static Size HOLE_TO_EDGE = new Size(0.063d, SizeUnit.in);
private String value = ""; @SuppressWarnings("unused")
@Deprecated
private transient String value = "";
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)}; private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
transient Area[] body; transient Area[] body;
@Deprecated @Deprecated
@@ -163,8 +166,8 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels(); int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
double centerY = controlPoints[0].getY() + springLength - holeToEdge; double centerY = controlPoints[0].getY() + springLength - holeToEdge;
Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25)); Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25));
AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY); AffineTransform ringTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY); AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
Point2D ringOrSwitchLabel = new Point2D.Double(0, 0); Point2D ringOrSwitchLabel = new Point2D.Double(0, 0);
Point2D sleeveLabel = new Point2D.Double(0, 0); Point2D sleeveLabel = new Point2D.Double(0, 0);
ringTransform.transform(tipLabel, ringOrSwitchLabel); ringTransform.transform(tipLabel, ringOrSwitchLabel);
@@ -178,9 +181,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
} }
StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
if (getType() == OpenJackType.STEREO) if (getValue() == OpenJackType.STEREO)
StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
if (getType() == OpenJackType.SWITCHED) if (getValue() == OpenJackType.SWITCHED)
StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
} }
@@ -225,7 +228,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
springWidth, springWidth)); springWidth, springWidth));
sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
holeDiameter))); holeDiameter)));
sleeve.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY)); sleeve.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter, sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
ringDiameter))); ringDiameter)));
sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter, sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter,
@@ -233,13 +236,13 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
body[2] = sleeve; body[2] = sleeve;
if (getType() != OpenJackType.MONO) { if (getValue() != OpenJackType.MONO) {
Area ringOrSwitch = Area ringOrSwitch =
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength, new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
springWidth, springWidth)); springWidth, springWidth));
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
holeDiameter))); holeDiameter)));
ringOrSwitch.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY)); ringOrSwitch.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter, ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
outerDiameter))); outerDiameter)));
@@ -272,8 +275,8 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
double centerY = y + springLength - holeToEdge; double centerY = y + springLength - holeToEdge;
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]); AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]); AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
// Rotate if needed // Rotate if needed
if (getTheta() != 0) { if (getTheta() != 0) {
@@ -337,7 +340,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
@Override @Override
public boolean isControlPointSticky(int index) { public boolean isControlPointSticky(int index) {
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED); return index < 2 || (getValue() == OpenJackType.STEREO || getValue() == OpenJackType.SWITCHED);
} }
@Override @Override
@@ -351,16 +354,6 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
// Invalidate the body // Invalidate the body
body = null; body = null;
} }
@Override
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty @EditableProperty
public Integer getAngle() { public Integer getAngle() {
@@ -384,12 +377,12 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
return Math.toRadians(getAngle()); return Math.toRadians(getAngle());
} }
@EditableProperty @EditableProperty(name = "Type")
public OpenJackType getType() { public OpenJackType getValue() {
return type; return type;
} }
public void setType(OpenJackType type) { public void setValue(OpenJackType type) {
this.type = type; this.type = type;
updateControlPoints(); updateControlPoints();
// Invalidate the body // Invalidate the body
@@ -411,9 +404,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
return "Tip"; return "Tip";
if (index == 1) if (index == 1)
return "Sleeve"; return "Sleeve";
if (index == 2 && getType() == OpenJackType.STEREO) if (index == 2 && getValue() == OpenJackType.STEREO)
return "Ring"; return "Ring";
if (index == 2 && getType() == OpenJackType.SWITCHED) if (index == 2 && getValue() == OpenJackType.SWITCHED)
return "Shunt"; return "Shunt";
return null; return null;
} }
@@ -423,7 +416,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
return false; return false;
} }
public enum OpenJackType { public static enum OpenJackType {
MONO, STEREO, SWITCHED; MONO, STEREO, SWITCHED;
@@ -51,11 +51,12 @@ import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size; import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit; import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants; import org.diylc.utils.Constants;
import org.diylc.components.electromechanical.OpenJack1_8.OpenJackType;
@ComponentDescriptor(name = "Open 1/8\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic", @ComponentDescriptor(name = "Open 1/8\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
description = "Switchcraft-style open panel mount 1/8\" phono jack, stereo and mono", description = "Switchcraft-style open panel mount 1/8\" phono jack, stereo and mono",
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true) zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
public class OpenJack1_8 extends AbstractMultiPartComponent<String> { public class OpenJack1_8 extends AbstractMultiPartComponent<OpenJackType> {
private static final float FONT_SCALE = 0.6f; private static final float FONT_SCALE = 0.6f;
private static final double RING_THETA = Math.PI * 0.795; private static final double RING_THETA = Math.PI * 0.795;
@@ -76,7 +77,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
private static Size HOLE_DIAMETER = new Size(0.025d, SizeUnit.in); private static Size HOLE_DIAMETER = new Size(0.025d, SizeUnit.in);
private static Size HOLE_TO_EDGE = new Size(0.0315d, SizeUnit.in); private static Size HOLE_TO_EDGE = new Size(0.0315d, SizeUnit.in);
private String value = ""; @SuppressWarnings("unused")
@Deprecated
private transient String value = "";
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)}; private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
transient Area[] body; transient Area[] body;
@Deprecated @Deprecated
@@ -163,8 +166,8 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels(); int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
double centerY = controlPoints[0].getY() + springLength - holeToEdge; double centerY = controlPoints[0].getY() + springLength - holeToEdge;
Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25)); Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25));
AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY); AffineTransform ringTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY); AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
Point2D ringOrSwitchLabel = new Point2D.Double(0, 0); Point2D ringOrSwitchLabel = new Point2D.Double(0, 0);
Point2D sleeveLabel = new Point2D.Double(0, 0); Point2D sleeveLabel = new Point2D.Double(0, 0);
ringTransform.transform(tipLabel, ringOrSwitchLabel); ringTransform.transform(tipLabel, ringOrSwitchLabel);
@@ -178,9 +181,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
} }
StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
if (getType() == OpenJackType.STEREO) if (getValue() == OpenJackType.STEREO)
StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
if (getType() == OpenJackType.SWITCHED) if (getValue() == OpenJackType.SWITCHED)
StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
} }
@@ -225,7 +228,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
springWidth, springWidth)); springWidth, springWidth));
sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
holeDiameter))); holeDiameter)));
sleeve.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY)); sleeve.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter, sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
ringDiameter))); ringDiameter)));
sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter, sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter,
@@ -233,13 +236,13 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
body[2] = sleeve; body[2] = sleeve;
if (getType() != OpenJackType.MONO) { if (getValue() != OpenJackType.MONO) {
Area ringOrSwitch = Area ringOrSwitch =
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength, new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
springWidth, springWidth)); springWidth, springWidth));
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
holeDiameter))); holeDiameter)));
ringOrSwitch.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY)); ringOrSwitch.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter, ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
outerDiameter))); outerDiameter)));
@@ -272,8 +275,8 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
double centerY = y + springLength - holeToEdge; double centerY = y + springLength - holeToEdge;
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]); AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]); AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
// Rotate if needed // Rotate if needed
if (getTheta() != 0) { if (getTheta() != 0) {
@@ -337,7 +340,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
@Override @Override
public boolean isControlPointSticky(int index) { public boolean isControlPointSticky(int index) {
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED); return index < 2 || (getValue() == OpenJackType.STEREO || getValue() == OpenJackType.SWITCHED);
} }
@Override @Override
@@ -352,16 +355,6 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
body = null; body = null;
} }
@Override
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty @EditableProperty
public Integer getAngle() { public Integer getAngle() {
if (angle == null || (orientation != null && orientation != Orientation.DEFAULT)) { if (angle == null || (orientation != null && orientation != Orientation.DEFAULT)) {
@@ -384,12 +377,12 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
return Math.toRadians(getAngle()); return Math.toRadians(getAngle());
} }
@EditableProperty @EditableProperty(name = "Type")
public OpenJackType getType() { public OpenJackType getValue() {
return type; return type;
} }
public void setType(OpenJackType type) { public void setValue(OpenJackType type) {
this.type = type; this.type = type;
updateControlPoints(); updateControlPoints();
// Invalidate the body // Invalidate the body
@@ -411,9 +404,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
return "Tip"; return "Tip";
if (index == 1) if (index == 1)
return "Sleeve"; return "Sleeve";
if (index == 2 && getType() == OpenJackType.STEREO) if (index == 2 && getValue() == OpenJackType.STEREO)
return "Ring"; return "Ring";
if (index == 2 && getType() == OpenJackType.SWITCHED) if (index == 2 && getValue() == OpenJackType.SWITCHED)
return "Shunt"; return "Shunt";
return null; return null;
} }
@@ -423,7 +416,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
return false; return false;
} }
public enum OpenJackType { static enum OpenJackType {
MONO, STEREO, SWITCHED; MONO, STEREO, SWITCHED;
Binary file not shown.
Binary file not shown.