/* * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved. */ import ch.psi.pshell.dev.Motor; import ch.psi.pshell.plot.LinePlotBase; import ch.psi.pshell.plot.LinePlotJFree; import ch.psi.pshell.plot.LinePlotSeries; import ch.psi.pshell.plot.Plot; import ch.psi.pshell.swing.MotorPanel; import ch.psi.pshell.ui.App; import ch.psi.utils.swing.MonitoredPanel; import ch.psi.pshell.ui.Panel; import ch.psi.utils.swing.SwingUtils; import ch.psi.wsaf.ApplicationStateException; import ch.psi.wsaf.Task; import ch.psi.wsaf.TaskRunMode; import ch.psi.wsaf.TaskRunningException; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JPanel; /** * */ public class TestingList extends Panel { MotorPanel motorPanel; LinePlotBase plot ; LinePlotSeries series; Motor motor; Task task = new Task() { @Override protected Object execute() throws Exception { series.clear(); for (int i=0;i<1000;i++){ double pos = motor.read(); Thread.sleep(2); plot.getAxis(Plot.AxisId.X).setRange(0, 1000); series.appendData(i, pos); } return true; } }; @Override protected JPanel create() { getApp().addTask(task); return new NetbeansPluginPanel(); } @Override protected void onInitialize(int runCount){ motor = (Motor) TestingList.this.getDevice("motor"); motorPanel.setDevice(motor); } public class NetbeansPluginPanel extends MonitoredPanel { @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jButton1.setText("jButton1"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jButton1) .addContainerGap(708, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(42, 42, 42) .addComponent(jButton1) .addContainerGap(606, Short.MAX_VALUE)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; // End of variables declaration//GEN-END:variables } }