mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Add rotary switch timing
This commit is contained in:
+10
@@ -78,6 +78,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
private boolean showLabels = true;
|
||||
private RotaryPositionCount positionCount = RotaryPositionCount.THREE;
|
||||
private SwitchTiming timing = SwitchTiming.SHORTING;
|
||||
|
||||
public RotarySelectorSwitch() {
|
||||
super();
|
||||
@@ -337,6 +338,15 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public SwitchTiming getTiming() {
|
||||
return timing;
|
||||
}
|
||||
|
||||
public void setTiming(SwitchTiming timing) {
|
||||
this.timing = timing;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Orientation getOrientation() {
|
||||
|
||||
+10
@@ -79,6 +79,7 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchType
|
||||
private RotarySwitchType configuration = RotarySwitchType._4P3T;
|
||||
private Color color = BODY_COLOR;
|
||||
private Mount mount = Mount.CHASSIS;
|
||||
private SwitchTiming timing = SwitchTiming.NON_SHORTING;
|
||||
private Color labelColor = LABEL_COLOR;
|
||||
|
||||
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0)};
|
||||
@@ -332,6 +333,15 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchType
|
||||
body = null;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public SwitchTiming getTiming() {
|
||||
return timing;
|
||||
}
|
||||
|
||||
public void setTiming(SwitchTiming timing) {
|
||||
this.timing = timing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getCachingBounds() {
|
||||
Rectangle2D rect = getBody()[0].getBounds2D();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.components.electromechanical;
|
||||
|
||||
public enum SwitchTiming {
|
||||
|
||||
SHORTING("Shorting"), NON_SHORTING("Non-shorting");
|
||||
|
||||
private String label;
|
||||
|
||||
private SwitchTiming(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user