mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 14:56:29 -04:00
allows to disable buttons to show up in the measurement graph, see #349
This commit is contained in:
parent
8718bb9a65
commit
7a2bc323a5
@ -27,12 +27,14 @@ public class Button implements Element {
|
|||||||
.addAttribute(Keys.ROTATE)
|
.addAttribute(Keys.ROTATE)
|
||||||
.addAttribute(Keys.LABEL)
|
.addAttribute(Keys.LABEL)
|
||||||
.addAttribute(Keys.ACTIVE_LOW)
|
.addAttribute(Keys.ACTIVE_LOW)
|
||||||
.addAttribute(Keys.MAP_TO_KEY);
|
.addAttribute(Keys.MAP_TO_KEY)
|
||||||
|
.addAttribute(Keys.ADD_VALUE_TO_GRAPH);
|
||||||
|
|
||||||
private final ObservableValue output;
|
private final ObservableValue output;
|
||||||
private final String label;
|
private final String label;
|
||||||
private final boolean invert;
|
private final boolean invert;
|
||||||
private final boolean mapToKey;
|
private final boolean mapToKey;
|
||||||
|
private final boolean showInGraph;
|
||||||
private boolean pressed;
|
private boolean pressed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +48,7 @@ public class Button implements Element {
|
|||||||
invert = attributes.get(Keys.ACTIVE_LOW);
|
invert = attributes.get(Keys.ACTIVE_LOW);
|
||||||
mapToKey = attributes.get(Keys.MAP_TO_KEY);
|
mapToKey = attributes.get(Keys.MAP_TO_KEY);
|
||||||
output.setValue(invert ? 1 : 0);
|
output.setValue(invert ? 1 : 0);
|
||||||
|
showInGraph = attributes.get(Keys.ADD_VALUE_TO_GRAPH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,7 +63,8 @@ public class Button implements Element {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerNodes(Model model) {
|
public void registerNodes(Model model) {
|
||||||
model.addSignal(new Signal(label, output));
|
model.addSignal(new Signal(label, output)
|
||||||
|
.setShowInGraph(showInGraph));
|
||||||
if (mapToKey) {
|
if (mapToKey) {
|
||||||
final KeyStroke keyStroke = KeyStroke.getKeyStroke(label.trim());
|
final KeyStroke keyStroke = KeyStroke.getKeyStroke(label.trim());
|
||||||
if (keyStroke != null && keyStroke.getKeyCode() != KeyEvent.VK_UNDEFINED)
|
if (keyStroke != null && keyStroke.getKeyCode() != KeyEvent.VK_UNDEFINED)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user