|
@@ -13,6 +13,7 @@ public class GripperGripNodeView implements SwingProgramNodeView<GripperGripNode
|
|
|
|
|
|
private final Style style;
|
|
private final Style style;
|
|
private JTextField jtfPosition, jtfSpeed;
|
|
private JTextField jtfPosition, jtfSpeed;
|
|
|
|
+ private JRadioButton gripButton, ungripButton;
|
|
|
|
|
|
public GripperGripNodeView(Style style) {
|
|
public GripperGripNodeView(Style style) {
|
|
this.style = style;
|
|
this.style = style;
|
|
@@ -31,19 +32,13 @@ public class GripperGripNodeView implements SwingProgramNodeView<GripperGripNode
|
|
inputBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
|
inputBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
|
inputBox.add(new JLabel("Speed %:"));
|
|
inputBox.add(new JLabel("Speed %:"));
|
|
inputBox.add(createHorizontalSpacing());
|
|
inputBox.add(createHorizontalSpacing());
|
|
-
|
|
+ gripButton = new JRadioButton("Grip");
|
|
- jtfSpeed = new JTextField();
|
|
+ ungripButton = new JRadioButton("Ungrip");
|
|
- jtfSpeed.setFocusable(false);
|
|
+ ButtonGroup group = new ButtonGroup();
|
|
- jtfSpeed.setPreferredSize(style.getInputfieldSize());
|
|
+ group.add(gripButton);
|
|
- jtfSpeed.setMaximumSize(jtfSpeed.getPreferredSize());
|
|
+ group.add(ungripButton);
|
|
- jtfSpeed.addMouseListener(new MouseAdapter() {
|
|
+ inputBox.add(gripButton);
|
|
- @Override
|
|
+ inputBox.add(ungripButton);
|
|
- public void mousePressed(MouseEvent e) {
|
|
|
|
- KeyboardNumberInput keyboardInput = provider.get().getKeyboardForSpeedField();
|
|
|
|
- keyboardInput.show(jtfSpeed, provider.get().getCallbackForSpeedField());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- inputBox.add(jtfSpeed);
|
|
|
|
return inputBox;
|
|
return inputBox;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -55,20 +50,16 @@ public class GripperGripNodeView implements SwingProgramNodeView<GripperGripNode
|
|
return Box.createRigidArea(new Dimension(style.getHorizontalSpacing(), 0));
|
|
return Box.createRigidArea(new Dimension(style.getHorizontalSpacing(), 0));
|
|
}
|
|
}
|
|
|
|
|
|
- public void setPosition(Integer value) {
|
|
+ public void setAction(String which) {
|
|
- jtfPosition.setText(value.toString());
|
|
+ if(which.equals("COUPLE"))
|
|
|
|
+ gripButton.setSelected(true);
|
|
|
|
+ else
|
|
|
|
+ ungripButton.setSelected(true);
|
|
}
|
|
}
|
|
|
|
|
|
- public void setSpeed(Integer value) {
|
|
|
|
- jtfSpeed.setText(value.toString());
|
|
|
|
- }
|
|
|
|
|
|
|
|
- public Integer getPosition() {
|
|
+ public String getAction() {
|
|
- return Integer.parseInt(jtfPosition.getText());
|
|
+ if(gripButton.isSelected()) return "COUPLE";
|
|
- }
|
|
+ return "DECOUPLE";
|
|
- public Integer getSpeed() {
|
|
|
|
- return Integer.parseInt(jtfSpeed.getText());
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|