From 47102ff35923f922bbb71f902a459f105e980549 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Mon, 23 Nov 2015 15:03:03 +0100 Subject: [PATCH] Startup --- plugins/Marco.form | 82 +++++++++++++++++++++ plugins/Marco.java | 130 ++++++++++++++++++++++++++++++++++ script/tests/tests.properties | 2 +- 3 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 plugins/Marco.form create mode 100644 plugins/Marco.java diff --git a/plugins/Marco.form b/plugins/Marco.form new file mode 100644 index 0000000..37b461d --- /dev/null +++ b/plugins/Marco.form @@ -0,0 +1,82 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/Marco.java b/plugins/Marco.java new file mode 100644 index 0000000..bfa17c5 --- /dev/null +++ b/plugins/Marco.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved. + */ + +import ch.psi.jcae.Channel; +import ch.psi.jcae.ChannelException; +import ch.psi.pshell.device.Device; +import ch.psi.pshell.device.DeviceAdapter; +import ch.psi.pshell.device.DeviceListener; +import ch.psi.pshell.epics.ChannelDouble; +import ch.psi.pshell.epics.Epics; +import ch.psi.pshell.epics.EpicsRegister; +import ch.psi.pshell.ui.Panel; +import ch.psi.utils.State; +import java.util.concurrent.TimeoutException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + */ +public class Marco extends Panel { + + public Marco() { + initComponents(); + } + + ChannelDouble channel; + + //Overridable callbacks + @Override + public void onInitialize(int runCount) { + try { + ChannelDouble channel = new ChannelDouble("MyChannel", "TESTIOC:TESTSINUS:SinCalc", 3); + channel.setMonitored(true); + channel.initialize(); + + + + channel.addListener(new DeviceAdapter() { + @Override + public void onValueChanged(Device device, Object value, Object former) { + Double val = (Double )value; + valueText.setText(String.valueOf(val)); + } + + }); + + //channel.close(); + + + } catch (Exception ex) { + showException(ex); + } + } + + @Override + public void onStateChange(State state, State former) { + + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + + //Callback to perform update - in event thread + @Override + protected void doUpdate() { + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + valuePanel = new ch.psi.pshell.swing.DeviceValuePanel(); + jLabel2 = new javax.swing.JLabel(); + valueText = new javax.swing.JTextField(); + + jLabel1.setText("Value:"); + + valuePanel.setDeviceName("marco"); + + jLabel2.setText("Value:"); + + valueText.setEditable(false); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(valuePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(valueText, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(226, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(23, 23, 23) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(valuePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(valueText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(20, 20, 20)) + ); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private ch.psi.pshell.swing.DeviceValuePanel valuePanel; + private javax.swing.JTextField valueText; + // End of variables declaration//GEN-END:variables +} diff --git a/script/tests/tests.properties b/script/tests/tests.properties index 3a9bf4e..04be2df 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Mon Nov 23 10:43:24 CET 2015 +#Mon Nov 23 15:02:57 CET 2015 customPanel=Kollimators showEnabledTestsOnly=true listFilter=LabTests2