Manage {config} token in -setp option

This commit is contained in:
2018-08-23 09:53:19 +02:00
parent 52a8daf5c0
commit 810740ddca
12 changed files with 624 additions and 534 deletions

View File

@@ -3,6 +3,7 @@
*/
package ch.psi.mxsc;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.State;
import java.awt.Dimension;
@@ -17,6 +18,7 @@ public class PuckPanel extends DevicePanel {
/**
* Creates new form BasePlatePanel
*/
PuckGraphics puckGraphics;
public PuckPanel() {
initComponents();
}
@@ -26,6 +28,12 @@ public class PuckPanel extends DevicePanel {
return (Puck) super.getDevice();
}
@Override
public void setDevice(Device device){
super.setDevice(device);
puckGraphics = new PuckGraphics((Puck)device, null);
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT
* modify this code. The content of this method is always regenerated by the Form Editor.
@@ -55,13 +63,13 @@ public class PuckPanel extends DevicePanel {
@Override
public void paint(Graphics g) {
super.paint(g);
if (getDevice()!=null){
if (puckGraphics!=null){
Graphics2D g2d = (Graphics2D) g;
Dimension size = getSize();
if ((size.width > 10) && (size.height > 10)) {
int border = 5;
Rectangle plotRect = new Rectangle(border, border, size.width - 2*border, size.height - 2*border);
getDevice().draw(g2d, plotRect, true, false, true, null);
puckGraphics.draw(g2d, plotRect, true, false, true);
}
}
}