Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.epics.pvmanager.sample.ScaleFrame Maven / Gradle / Ivy
/**
* Copyright (C) 2010-12 Brookhaven National Laboratory
* All rights reserved. Use is subject to license terms.
*/
/*
* ScaleFrame.java
*
* Created on Dec 9, 2010, 9:33:00 AM
*/
package org.epics.pvmanager.sample;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.swing.JTextField;
import org.epics.pvmanager.CompositeDataSource;
import org.epics.pvmanager.PVReader;
import org.epics.pvmanager.PVManager;
import org.epics.pvmanager.PVReaderListener;
import org.epics.vtype.SimpleValueFormat;
import org.epics.vtype.ValueFormat;
import org.epics.pvmanager.jca.JCADataSource;
import org.epics.pvmanager.sim.SimulationDataSource;
import org.epics.pvmanager.util.NumberFormats;
import static org.epics.pvmanager.ExpressionLanguage.*;
import org.epics.pvmanager.PVReaderEvent;
import static org.epics.pvmanager.util.Executors.*;
import static org.epics.util.time.TimeDuration.*;
/**
*
* @author carcassi
*/
public class ScaleFrame extends javax.swing.JFrame {
/** Creates new form ScaleFrame */
public ScaleFrame() {
initComponents();
System.out.println(pvNames.size());
long startTime = System.currentTimeMillis();
for (int i = 0; i < pvNames.size(); i++) {
addPV("epics://" + pvNames.get(i));
}
System.out.println(System.currentTimeMillis() - startTime);
format = new SimpleValueFormat(3);
format.setNumberFormat(NumberFormats.format(6));
}
ValueFormat format;
List> pvs = new ArrayList>();
private void addPV(final String name) {
final JTextField field = new JTextField();
getContentPane().add(field);
final PVReader pv = PVManager.read(channel(name))
.readListener(new PVReaderListener() {
@Override
public void pvChanged(PVReaderEvent event) {
field.setText(format.format(event.getPvReader().getValue()));
}
})
.maxRate(ofHertz(50));
pvs.add(pv);
}
/** 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.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new java.awt.FlowLayout());
pack();
}// //GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
PVManager.setDefaultNotificationExecutor(swingEDT());
CompositeDataSource dataSource = new CompositeDataSource();
dataSource.putDataSource("sim", SimulationDataSource.simulatedData());
dataSource.putDataSource("epics", new JCADataSource());
dataSource.setDefaultDataSource("sim");
PVManager.setDefaultDataSource(dataSource);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ScaleFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
List pvNames = Arrays.asList("SR:C30-MG:G01AFld-RB",
"SR:C30-MG:G01AFld-RB",
"SR:C30-MG:G01AFld-RB",
"SR:C30-MG:G01AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-BI:G02APos-X",
"SR:C30-BI:G02APos-Y",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-BI:G02APos-X",
"SR:C30-BI:G02APos-Y",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G02AFld-RB",
"SR:C30-MG:G03AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04AFld-RB",
"SR:C30-BI:G04APos-X",
"SR:C30-BI:G04APos-Y",
"SR:C30-MG:G04AFld-RB",
"SR:C30-MG:G04BFld-RB",
"SR:C30-MG:G04BFld-RB",
"SR:C30-MG:G04BFld-RB",
"SR:C30-BI:G04BPos-X",
"SR:C30-BI:G04BPos-Y",
"SR:C30-MG:G04BFld-RB",
"SR:C30-MG:G04BFld-RB",
"SR:C30-MG:G04BFld-RB",
"SR:C30-MG:G05BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-BI:G06BPos-X",
"SR:C30-BI:G06BPos-Y",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-MG:G06BFld-RB",
"SR:C30-BI:G06BPos-X",
"SR:C30-BI:G06BPos-Y",
"SR:C30-MG:G06BFld-RB",
"SR:C01-MG:G01AFld-RB",
"SR:C01-MG:G01AFld-RB",
"SR:C01-MG:G01AFld-RB",
"SR:C01-MG:G01AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-BI:G02APos-X",
"SR:C01-BI:G02APos-Y",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G02AFld-RB",
"SR:C01-BI:G02APos-X",
"SR:C01-BI:G02APos-Y",
"SR:C01-MG:G02AFld-RB",
"SR:C01-MG:G03AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04AFld-RB",
"SR:C01-BI:G04APos-X",
"SR:C01-BI:G04APos-Y",
"SR:C01-MG:G04AFld-RB",
"SR:C01-MG:G04BFld-RB",
"SR:C01-MG:G04BFld-RB",
"SR:C01-MG:G04BFld-RB",
"SR:C01-BI:G04BPos-X",
"SR:C01-BI:G04BPos-Y",
"SR:C01-MG:G04BFld-RB",
"SR:C01-MG:G04BFld-RB",
"SR:C01-MG:G04BFld-RB",
"SR:C01-MG:G05BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-BI:G06BPos-X",
"SR:C01-BI:G06BPos-Y",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-MG:G06BFld-RB",
"SR:C01-BI:G06BPos-X",
"SR:C01-BI:G06BPos-Y",
"SR:C01-MG:G06BFld-RB",
"SR:C02-MG:G01AFld-RB",
"SR:C02-MG:G01AFld-RB",
"SR:C02-MG:G01AFld-RB",
"SR:C02-MG:G01AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-BI:G02APos-X",
"SR:C02-BI:G02APos-Y",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-BI:G02APos-X",
"SR:C02-BI:G02APos-Y",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G02AFld-RB",
"SR:C02-MG:G03AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04AFld-RB",
"SR:C02-BI:G04APos-X",
"SR:C02-BI:G04APos-Y",
"SR:C02-MG:G04AFld-RB",
"SR:C02-MG:G04BFld-RB",
"SR:C02-MG:G04BFld-RB",
"SR:C02-MG:G04BFld-RB",
"SR:C02-BI:G04BPos-X",
"SR:C02-BI:G04BPos-Y",
"SR:C02-MG:G04BFld-RB",
"SR:C02-MG:G04BFld-RB",
"SR:C02-MG:G04BFld-RB",
"SR:C02-MG:G05BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-BI:G06BPos-X",
"SR:C02-BI:G06BPos-Y",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-MG:G06BFld-RB",
"SR:C02-BI:G06BPos-X",
"SR:C02-BI:G06BPos-Y",
"SR:C02-MG:G06BFld-RB",
"SR:C03-MG:G01AFld-RB",
"SR:C03-MG:G01AFld-RB",
"SR:C03-MG:G01AFld-RB",
"SR:C03-MG:G01AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-BI:G02APos-X",
"SR:C03-BI:G02APos-Y",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G02AFld-RB",
"SR:C03-BI:G02APos-X",
"SR:C03-BI:G02APos-Y",
"SR:C03-MG:G02AFld-RB",
"SR:C03-MG:G03AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04AFld-RB",
"SR:C03-BI:G04APos-X",
"SR:C03-BI:G04APos-Y",
"SR:C03-MG:G04AFld-RB",
"SR:C03-MG:G04BFld-RB",
"SR:C03-MG:G04BFld-RB",
"SR:C03-MG:G04BFld-RB",
"SR:C03-BI:G04BPos-X",
"SR:C03-BI:G04BPos-Y",
"SR:C03-MG:G04BFld-RB",
"SR:C03-MG:G04BFld-RB",
"SR:C03-MG:G04BFld-RB",
"SR:C03-MG:G05BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-BI:G06BPos-X",
"SR:C03-BI:G06BPos-Y",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-MG:G06BFld-RB",
"SR:C03-BI:G06BPos-X",
"SR:C03-BI:G06BPos-Y",
"SR:C03-MG:G06BFld-RB",
"SR:C04-MG:G01AFld-RB",
"SR:C04-MG:G01AFld-RB",
"SR:C04-MG:G01AFld-RB",
"SR:C04-MG:G01AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-BI:G02APos-X",
"SR:C04-BI:G02APos-Y",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-BI:G02APos-X",
"SR:C04-BI:G02APos-Y",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G02AFld-RB",
"SR:C04-MG:G03AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04AFld-RB",
"SR:C04-BI:G04APos-X",
"SR:C04-BI:G04APos-Y",
"SR:C04-MG:G04AFld-RB",
"SR:C04-MG:G04BFld-RB",
"SR:C04-MG:G04BFld-RB",
"SR:C04-MG:G04BFld-RB",
"SR:C04-BI:G04BPos-X",
"SR:C04-BI:G04BPos-Y",
"SR:C04-MG:G04BFld-RB",
"SR:C04-MG:G04BFld-RB",
"SR:C04-MG:G04BFld-RB",
"SR:C04-MG:G05B