|
@@ -5,7 +5,6 @@ import com.ur.urcap.api.contribution.toolbar.ToolbarContext;
|
|
import com.ur.urcap.api.contribution.toolbar.swing.SwingToolbarContribution;
|
|
import com.ur.urcap.api.contribution.toolbar.swing.SwingToolbarContribution;
|
|
import com.ur.urcap.api.domain.io.DigitalIO;
|
|
import com.ur.urcap.api.domain.io.DigitalIO;
|
|
import urgrip.installation.URGripInstallationNodeContribution;
|
|
import urgrip.installation.URGripInstallationNodeContribution;
|
|
-import urgrip.installation.URGripInstallationNodeService;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.awt.*;
|
|
@@ -39,13 +38,10 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
@Override
|
|
@Override
|
|
public void openView() {
|
|
public void openView() {
|
|
initializeIO();
|
|
initializeIO();
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void closeView() {
|
|
public void closeView() {
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void initializeIO() {
|
|
private void initializeIO() {
|
|
@@ -58,6 +54,12 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void setIO(DigitalIO io, boolean b) {
|
|
|
|
+ if(io!=null) {
|
|
|
|
+ ioCoupleOpen.setValue(b);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public void buildUI(JPanel jPanel) {
|
|
public void buildUI(JPanel jPanel) {
|
|
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
|
|
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
|
|
jPanel.add(createHeader());
|
|
jPanel.add(createHeader());
|
|
@@ -83,8 +85,8 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
box.add(bGrip);
|
|
box.add(bGrip);
|
|
new MyButton(bGrip, new HandleButton() {
|
|
new MyButton(bGrip, new HandleButton() {
|
|
@Override public void action() {
|
|
@Override public void action() {
|
|
- ioGripOpen.setValue(true);
|
|
+ setIO(ioCoupleOpen,true);
|
|
- ioGripClose.setValue(false);
|
|
+ setIO(ioGripClose,false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -92,8 +94,8 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
box.add(bRelease);
|
|
box.add(bRelease);
|
|
new MyButton(bRelease, new HandleButton() {
|
|
new MyButton(bRelease, new HandleButton() {
|
|
@Override public void action() {
|
|
@Override public void action() {
|
|
- ioGripOpen.setValue(false);
|
|
+ setIO(ioGripOpen, false);
|
|
- ioGripClose.setValue(true);
|
|
+ setIO(ioGripClose, true);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -102,11 +104,11 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
new MyButton(bBlow, new HandleButton() {
|
|
new MyButton(bBlow, new HandleButton() {
|
|
@Override
|
|
@Override
|
|
public void down() {
|
|
public void down() {
|
|
- blowout.setValue(true);
|
|
+ setIO(blowout, true);
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public void up() {
|
|
public void up() {
|
|
- blowout.setValue(false);
|
|
+ setIO(blowout, false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -114,8 +116,8 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
box.add(bCouple);
|
|
box.add(bCouple);
|
|
new MyButton(bCouple, new HandleButton() {
|
|
new MyButton(bCouple, new HandleButton() {
|
|
@Override public void action() {
|
|
@Override public void action() {
|
|
- ioCoupleClose.setValue(false);
|
|
+ setIO(ioCoupleClose, false);
|
|
- ioCoupleOpen.setValue(true);
|
|
+ setIO(ioCoupleOpen, true);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -123,8 +125,8 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
box.add(bDecouple);
|
|
box.add(bDecouple);
|
|
new MyButton(bDecouple, new HandleButton() {
|
|
new MyButton(bDecouple, new HandleButton() {
|
|
@Override public void action() {
|
|
@Override public void action() {
|
|
- ioCoupleClose.setValue(true);
|
|
+ setIO(ioCoupleClose, true);
|
|
- ioCoupleOpen.setValue(false);
|
|
+ setIO(ioCoupleOpen, false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
return box;
|
|
return box;
|
|
@@ -147,7 +149,4 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
private void updateText(String text) {
|
|
private void updateText(String text) {
|
|
SwingUtilities.invokeLater(() -> demoToolStatus.setText("<HTML>" + text +"</HTML>"));
|
|
SwingUtilities.invokeLater(() -> demoToolStatus.setText("<HTML>" + text +"</HTML>"));
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|