Commit 9948e8c5 authored by Jean-Luc Pons's avatar Jean-Luc Pons
Browse files

Initial commit

parents
nbactions.xml
build/
dist/
test/
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="JSRBpmManager" default="default" basedir=".">
<description>Builds, tests, and runs the project JSRBpmManager.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="JSRBpmManager-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
This diff is collapsed.
build.xml.data.CRC32=06dc0623
build.xml.script.CRC32=17ee6cc4
build.xml.stylesheet.CRC32=f85dc8f2@1.94.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=06dc0623
nbproject/build-impl.xml.script.CRC32=0c189305
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.94.0.48
application.args=SRBPM_Brilliance
compile.on.save=true
do.depend=false
do.jar=true
do.jlink=false
javac.debug=true
javadoc.preview=true
jlink.strip=false
user.properties.file=/users/pons/.netbeans/12.0/build.properties
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=JSRBpmManager
application.vendor=pons
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/JSRBpmManager.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.atkpanel.jar=../../../../../segfs/tango/release/java/appli/atkpanel.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.atkpanel.jar}:\
${libs.Tango.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jlink.launcher=false
jlink.launcher.name=JSRBpmManager
main.class=SRBpmManager.MainPanel
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=-DTANGO_HOST=acs:10000
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>JSRBpmManager</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="upPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<Property name="alignment" type="int" value="2"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="resetCounterButton">
<Properties>
<Property name="text" type="java.lang.String" value="Reset TBT Counter"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="resetCounterButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="refreshButton">
<Properties>
<Property name="text" type="java.lang.String" value="Refresh"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JComboBox" name="nameCombo">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="chartPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="fr.esrf.tangoatk.widget.util.chart.JLChart" name="chart">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
package SRBpmManager;
import fr.esrf.Tango.DevFailed;
import fr.esrf.TangoApi.AttributeInfoEx;
import fr.esrf.TangoApi.Database;
import fr.esrf.TangoApi.DeviceAttribute;
import fr.esrf.TangoApi.DeviceProxy;
import fr.esrf.tangoatk.widget.util.ErrorPane;
import fr.esrf.tangoatk.widget.util.chart.IJLChartListener;
import fr.esrf.tangoatk.widget.util.chart.JLAxis;
import fr.esrf.tangoatk.widget.util.chart.JLChartEvent;
import fr.esrf.tangoatk.widget.util.chart.JLDataView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class AllSettings extends javax.swing.JPanel implements ActionListener,IJLChartListener {
class Item {
final static int INT_TYPE = 1;
final static int BOOLEAN_TYPE = 2;
final static int ENABLE_TYPE = 3;
final static int DOUBLE_TYPE = 4;
final static int ENUM_TYPE = 5;
String name;
int type;
Item(MainPanel mp,String def) {
String[] itemDef = def.split(",");
if(itemDef.length!=2) {
mp.splash.setVisible(false);
JOptionPane.showMessageDialog(null, "Wrong DetailedSettings configuration (2 field expected): " + def, "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
this.name = itemDef[0];
this.type = toType(mp,itemDef[1]);
}
private int toType(MainPanel mp,String typeStr) {
if( typeStr.equalsIgnoreCase("INT_TYPE") ) {
return INT_TYPE;
} else if ( typeStr.equalsIgnoreCase("BOOLEAN_TYPE") ) {
return BOOLEAN_TYPE;
} else if ( typeStr.equalsIgnoreCase("ENABLE_TYPE") ) {
return ENABLE_TYPE;
} else if ( typeStr.equalsIgnoreCase("DOUBLE_TYPE") ) {
return DOUBLE_TYPE;
} else if ( typeStr.equalsIgnoreCase("ENUM_TYPE") ) {
return ENUM_TYPE;
} else {
mp.splash.setVisible(false);
JOptionPane.showMessageDialog(null, "Wrong DetailedSettings configuration (Unexpected type): " + typeStr, "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
return 0;
}
}
MainPanel mp;
Item[] items;
DeviceProxy ds;
JLDataView v;
int selectedItem = -1;
public AllSettings(MainPanel mp) {
this.mp = mp;
items = parseItems(mp.appName,mp.db);
initComponents();
for(int i=0;i<items.length;i++)
nameCombo.addItem(items[i].name);
nameCombo.setSelectedIndex(selectedItem);
nameCombo.addActionListener(this);
chart.setJLChartListener(this);
try {
ds = new DeviceProxy(mp.BPMALL_DEVNAME);
} catch (DevFailed e) {
ErrorPane.showErrorMessage(null, mp.BPMALL_DEVNAME, e);
}
v = new JLDataView();
v.setMarker(JLDataView.MARKER_DOT);
chart.getY1Axis().addDataView(v);
chart.getY1Axis().setAutoScale(true);
chart.getXAxis().setAnnotation(JLAxis.VALUE_ANNO);
String[] cellNames = new String[MainPanel.NBCELL];
double[] cellPos = new double[MainPanel.NBCELL];
for(int i=0;i<cellNames.length;i++) {
cellNames[i] = new String("C" + Integer.toString((i+3)%MainPanel.NBCELL+1));
cellPos[i] = (double)i*mp.NBBPM;
}
chart.getXAxis().setLabels(cellNames, cellPos);
chart.getXAxis().setGridVisible(true);
chart.getXAxis().setAutoScale(true);
}
public void actionPerformed(ActionEvent e) {
refreshSelected();
}
public void refreshSelected() {
selectedItem = nameCombo.getSelectedIndex();
if(selectedItem>=0) {
double[] vals = read(items[selectedItem].name);
v.setName(items[selectedItem].name);
v.reset();
for(int i=0;i<mp.TOTALBPM;i++)
v.add(i,vals[i]);
chart.repaint();
}
}
public String[] clickOnChart(JLChartEvent jlce) {
String[] ret = new String[2];
int idx = (int)jlce.getXValue();
int cellIdx = (idx/mp.NBBPM + 3)%mp.NBCELL + 1;
int bpmIdx = mp.BPMIDX[idx%mp.NBBPM];
ret[0] = "BPM C" + cellIdx + "-" + bpmIdx + " [" + mp.BPMTYPE[idx%mp.NBBPM] + "]";
String name = items[selectedItem].name;
if(name.startsWith("All_"))
name = name.substring(4);
double val = jlce.getYValue();
switch(items[selectedItem].type) {
case Item.INT_TYPE:
ret[1] = name + "=" + Integer.toString((int)val);
break;
case Item.BOOLEAN_TYPE:
ret[1] = name + "=" + Boolean.toString(val!=0.0);
break;
case Item.ENABLE_TYPE:
ret[1] = name + "=" + ((val!=0.0)?"Enabled":"Disabled");
break;
case Item.ENUM_TYPE:
// We need to get the string from the source device
String bpmDevName = "srdiag/bpm/c" + String.format("%02d", cellIdx) +
"-" + String.format("%02d", bpmIdx);
try {
DeviceProxy ds = new DeviceProxy(bpmDevName);
AttributeInfoEx conf = ds.get_attribute_info_ex(name);
int eVal = (int)(val);
if(eVal>=0 && eVal<conf.enum_label.length) {
ret[1] = name + "=" + conf.enum_label[eVal];
} else {
ret[1] = name + "=" + Integer.toString(eVal);
}
} catch(DevFailed e) {
ErrorPane.showErrorMessage(null, bpmDevName, e);
}
break;
default:
ret[1] = name + "=" + Double.toString(val);
break;
}
return ret;
}
private double[] read(String name) {
double[] ret = new double[mp.TOTALBPM];
for(int i=0;i<mp.TOTALBPM;i++) ret[i] = Double.NaN;
try {
DeviceAttribute da = ds.read_attribute(name);
double[] values = da.extractDoubleArray();
for(int i=0;i<values.length && i<mp.TOTALBPM;i++) {
ret[i] = values[i];
}
} catch(DevFailed e) {
ErrorPane.showErrorMessage(null, mp.BPMALL_DEVNAME, e);
}
return ret;
}
private Item[] parseItems(String appName,Database db) {
Item[] ret = null;
try {
String[] itemList = db.get_property(appName, "DetailedSettings").extractStringArray();
ret = new Item[itemList.length];
for(int i=0;i<itemList.length;i++) {
ret[i] = new Item(mp,itemList[i]);
}
} catch( DevFailed e) {
mp.splash.setVisible(false);
ErrorPane.showErrorMessage(null, appName + " DetailedSettings error", e);
System.exit(0);
}
return ret;
}
/**
* 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
upPanel = new javax.swing.JPanel();
resetCounterButton = new javax.swing.JButton();
refreshButton = new javax.swing.JButton();
nameCombo = new javax.swing.JComboBox<>();
chartPanel = new javax.swing.JPanel();
chart = new fr.esrf.tangoatk.widget.util.chart.JLChart();
setLayout(new java.awt.BorderLayout());
upPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
resetCounterButton.setText("Reset TBT Counter");
resetCounterButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resetCounterButtonActionPerformed(evt);
}
});
upPanel.add(resetCounterButton);
refreshButton.setText("Refresh");
refreshButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
refreshButtonActionPerformed(evt);
}
});
upPanel.add(refreshButton);
upPanel.add(nameCombo);
add(upPanel, java.awt.BorderLayout.NORTH);
chartPanel.setLayout(new java.awt.BorderLayout());
chartPanel.add(chart, java.awt.BorderLayout.CENTER);
add(chartPanel, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
private void resetCounterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetCounterButtonActionPerformed
try {
ds.command_inout("ResetTriggerCounter");
} catch(DevFailed e) {
ErrorPane.showErrorMessage(null, mp.BPMALL_DEVNAME, e);
}
}//GEN-LAST:event_resetCounterButtonActionPerformed
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
refreshSelected();
}//GEN-LAST:event_refreshButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private fr.esrf.tangoatk.widget.util.chart.JLChart chart;
private javax.swing.JPanel chartPanel;
private javax.swing.JComboBox<String> nameCombo;
private javax.swing.JButton refreshButton;
private javax.swing.JButton resetCounterButton;
private javax.swing.JPanel upPanel;