|
@@ -1,27 +1,28 @@
|
|
package urgrip.installation;
|
|
package urgrip.installation;
|
|
|
|
|
|
import com.ur.urcap.api.contribution.installation.swing.SwingInstallationNodeView;
|
|
import com.ur.urcap.api.contribution.installation.swing.SwingInstallationNodeView;
|
|
|
|
+import com.ur.urcap.api.domain.io.IO;
|
|
import com.ur.urcap.api.domain.userinteraction.keyboard.KeyboardTextInput;
|
|
import com.ur.urcap.api.domain.userinteraction.keyboard.KeyboardTextInput;
|
|
import urgrip.programnodes.Style;
|
|
import urgrip.programnodes.Style;
|
|
|
|
|
|
-import javax.swing.BorderFactory;
|
|
|
|
-import javax.swing.Box;
|
|
|
|
-import javax.swing.BoxLayout;
|
|
|
|
-import javax.swing.JLabel;
|
|
|
|
-import javax.swing.JPanel;
|
|
|
|
-import javax.swing.JTextField;
|
|
|
|
-import javax.swing.JTextPane;
|
|
|
|
|
|
+import javax.swing.*;
|
|
import javax.swing.text.SimpleAttributeSet;
|
|
import javax.swing.text.SimpleAttributeSet;
|
|
import javax.swing.text.StyleConstants;
|
|
import javax.swing.text.StyleConstants;
|
|
import java.awt.Component;
|
|
import java.awt.Component;
|
|
import java.awt.Dimension;
|
|
import java.awt.Dimension;
|
|
-import java.awt.event.MouseAdapter;
|
|
|
|
-import java.awt.event.MouseEvent;
|
|
|
|
|
|
+import java.awt.event.ActionEvent;
|
|
|
|
+import java.awt.event.ActionListener;
|
|
|
|
+import java.util.Collection;
|
|
|
|
+import java.util.Vector;
|
|
|
|
+
|
|
|
|
+import static urgrip.installation.HelloWorldInstallationNodeContribution.*;
|
|
|
|
|
|
public class HelloWorldInstallationNodeView implements SwingInstallationNodeView<HelloWorldInstallationNodeContribution> {
|
|
public class HelloWorldInstallationNodeView implements SwingInstallationNodeView<HelloWorldInstallationNodeContribution> {
|
|
|
|
|
|
private final Style style;
|
|
private final Style style;
|
|
- private JTextField jTextField;
|
|
|
|
|
|
+ private JComboBox ddGrip;
|
|
|
|
+ private JComboBox ddBlow;
|
|
|
|
+ private JComboBox ddWaitFor;
|
|
|
|
|
|
public HelloWorldInstallationNodeView(Style style) {
|
|
public HelloWorldInstallationNodeView(Style style) {
|
|
this.style = style;
|
|
this.style = style;
|
|
@@ -30,10 +31,32 @@ public class HelloWorldInstallationNodeView implements SwingInstallationNodeView
|
|
@Override
|
|
@Override
|
|
public void buildUI(JPanel jPanel, final HelloWorldInstallationNodeContribution installationNode) {
|
|
public void buildUI(JPanel jPanel, final HelloWorldInstallationNodeContribution installationNode) {
|
|
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
|
|
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
|
|
-
|
|
|
|
jPanel.add(createInfo());
|
|
jPanel.add(createInfo());
|
|
jPanel.add(createVerticalSpacing());
|
|
jPanel.add(createVerticalSpacing());
|
|
- jPanel.add(createInput(installationNode));
|
|
|
|
|
|
+ // jPanel.add(createInput(installationNode));
|
|
|
|
+ ddGrip = createDropdown(KEY_GRIP);
|
|
|
|
+ jPanel.add(ddGrip);
|
|
|
|
+ ddBlow = createDropdown(KEY_BLOWOUT);
|
|
|
|
+ jPanel.add(ddBlow);
|
|
|
|
+ ddWaitFor = createDropdown(KEY_WAITFOR);
|
|
|
|
+ jPanel.add(ddWaitFor);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private JComboBox createDropdown(String key) {
|
|
|
|
+ Box section = Box.createHorizontalBox();
|
|
|
|
+ section.setAlignmentX(Component.LEFT_ALIGNMENT);
|
|
|
|
+ JComboBox jcb = new JComboBox();
|
|
|
|
+ jcb.setPreferredSize(style.getInputfieldSize());
|
|
|
|
+ jcb.setMaximumSize(style.getInputfieldSize());
|
|
|
|
+ jcb.setMinimumSize(style.getInputfieldSize());
|
|
|
|
+ jcb.addActionListener(new ActionListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void actionPerformed(ActionEvent actionEvent) {
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ section.add(new JLabel(key));
|
|
|
|
+ section.add(jcb);
|
|
|
|
+ return jcb;
|
|
}
|
|
}
|
|
|
|
|
|
private Box createInfo() {
|
|
private Box createInfo() {
|
|
@@ -53,28 +76,6 @@ public class HelloWorldInstallationNodeView implements SwingInstallationNodeView
|
|
return infoBox;
|
|
return infoBox;
|
|
}
|
|
}
|
|
|
|
|
|
- private Box createInput(final HelloWorldInstallationNodeContribution installationNode) {
|
|
|
|
- Box inputBox = Box.createHorizontalBox();
|
|
|
|
- inputBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
|
|
|
-
|
|
|
|
- inputBox.add(new JLabel("Popup title:"));
|
|
|
|
- inputBox.add(createHorizontalSpacing());
|
|
|
|
-
|
|
|
|
- jTextField = new JTextField();
|
|
|
|
- jTextField.setFocusable(false);
|
|
|
|
- jTextField.setPreferredSize(style.getInputfieldSize());
|
|
|
|
- jTextField.setMaximumSize(jTextField.getPreferredSize());
|
|
|
|
- jTextField.addMouseListener(new MouseAdapter() {
|
|
|
|
- @Override
|
|
|
|
- public void mousePressed(MouseEvent e) {
|
|
|
|
- KeyboardTextInput keyboardInput = installationNode.getInputForTextField();
|
|
|
|
- keyboardInput.show(jTextField, installationNode.getCallbackForTextField());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- inputBox.add(jTextField);
|
|
|
|
-
|
|
|
|
- return inputBox;
|
|
|
|
- }
|
|
|
|
|
|
|
|
private Component createHorizontalSpacing() {
|
|
private Component createHorizontalSpacing() {
|
|
return Box.createRigidArea(new Dimension(style.getHorizontalSpacing(), 0));
|
|
return Box.createRigidArea(new Dimension(style.getHorizontalSpacing(), 0));
|
|
@@ -84,7 +85,11 @@ public class HelloWorldInstallationNodeView implements SwingInstallationNodeView
|
|
return Box.createRigidArea(new Dimension(0, style.getVerticalSpacing()));
|
|
return Box.createRigidArea(new Dimension(0, style.getVerticalSpacing()));
|
|
}
|
|
}
|
|
|
|
|
|
- public void setPopupText(String t) {
|
|
|
|
- jTextField.setText(t);
|
|
|
|
|
|
+ public void setIO(Collection<IO> ios) {
|
|
|
|
+ Vector<IO> iov=new Vector<>();
|
|
|
|
+ iov.addAll(ios);
|
|
|
|
+ ddGrip.setModel(new DefaultComboBoxModel(iov));
|
|
|
|
+ ddBlow.setModel(new DefaultComboBoxModel(iov));
|
|
|
|
+ ddWaitFor.setModel(new DefaultComboBoxModel(iov));
|
|
}
|
|
}
|
|
}
|
|
}
|