From 368bfd1c87354ae11c183d2f9cd6f52be06fb032 Mon Sep 17 00:00:00 2001 From: Arthur Coolen <coolen@astron.nl> Date: Mon, 12 Feb 2007 08:55:03 +0000 Subject: [PATCH] BugID: 1030 Userpanel for Observation configuration added. Removed OLAP user panel for now, untill new OLAP is finished. Also removed some (generic) tools from BBS to LofarUtils --- .../lofar/sas/otb/util/ConfigPanelHelper.java | 12 +- .../sas/otbcomponents/OLAPConfigPanel.form | 18 +- .../sas/otbcomponents/OLAPConfigPanel.java | 16 +- .../sas/otbcomponents/ParameterViewPanel.java | 32 +- .../otbcomponents/bbs/BBSStrategyPanel.java | 161 +-- .../userpanels/ObservationPanel.form | 720 ++++++++++ .../userpanels/ObservationPanel.java | 1198 +++++++++++++++++ 7 files changed, 1961 insertions(+), 196 deletions(-) create mode 100644 SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.form create mode 100644 SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.java diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java index e01b70b4b95..20836626863 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java @@ -77,11 +77,17 @@ public class ConfigPanelHelper { itsVector = new Vector<String>(); itsVector.add("nl.astron.lofar.sas.otbcomponents.bbs.BBSStrategyPanel"); itsPanelMap.put("Strategy",itsVector); - + + // for now taken out untill new OLAP params are known //OLAP +// itsVector = new Vector<String>(); +// itsVector.add("nl.astron.lofar.sas.otbcomponents.OLAPConfigPanel"); +// itsPanelMap.put("OLAP",itsVector); + + // Observation itsVector = new Vector<String>(); - itsVector.add("nl.astron.lofar.sas.otbcomponents.OLAPConfigPanel"); - itsPanelMap.put("OLAP",itsVector); + itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ObservationPanel"); + itsPanelMap.put("Observation",itsVector); } diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.form b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.form index 79728c40861..6b4b5cc8ce7 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.form +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.form @@ -6,7 +6,7 @@ <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,2,-24,0,0,7,79"/> + <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,2,-24,0,0,7,84"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> @@ -71,7 +71,7 @@ <Component id="MSNameText" alignment="1" max="32767" attributes="1"/> </Group> </Group> - <EmptySpace min="-2" pref="1281" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="1286" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -327,7 +327,7 @@ </Group> <Component id="SpecificRevertButton" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="1343" max="-2" attributes="0"/> + <EmptySpace pref="1348" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -504,7 +504,7 @@ <Group type="102" alignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0"> <Component id="jPanel5" max="32767" attributes="1"/> - <Component id="jPanel2" alignment="0" pref="408" max="32767" attributes="1"/> + <Component id="jPanel2" alignment="0" max="32767" attributes="1"/> <Component id="jPanel4" alignment="0" max="32767" attributes="1"/> <Component id="jPanel3" alignment="0" max="32767" attributes="1"/> <Component id="jPanel1" alignment="1" max="32767" attributes="1"/> @@ -575,7 +575,7 @@ <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel7" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="135" max="32767" attributes="0"/> + <EmptySpace pref="140" max="32767" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Component id="AMCServerHostText" min="-2" pref="215" max="-2" attributes="1"/> <Component id="AMCServerPortText" min="-2" pref="64" max="-2" attributes="1"/> @@ -652,7 +652,7 @@ <Component id="StellaFENText" max="32767" attributes="1"/> <Component id="partitionText" alignment="0" pref="212" max="32767" attributes="1"/> </Group> - <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -719,7 +719,7 @@ <Component id="jLabel2" min="-2" max="-2" attributes="0"/> <Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="134" max="32767" attributes="0"/> + <EmptySpace pref="139" max="32767" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Component id="DelayPorts" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="DelayCompensationHostText" alignment="0" min="-2" pref="213" max="-2" attributes="1"/> @@ -796,7 +796,7 @@ <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel9" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace pref="125" max="32767" attributes="0"/> + <EmptySpace pref="130" max="32767" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Component id="InputHosts" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="InputClusterFENText" alignment="0" min="-2" pref="217" max="-2" attributes="1"/> @@ -896,7 +896,7 @@ <EmptySpace max="-2" attributes="0"/> </Group> <Group type="102" alignment="0" attributes="0"> - <Component id="jLabel11" pref="159" max="32767" attributes="1"/> + <Component id="jLabel11" pref="164" max="32767" attributes="1"/> <EmptySpace max="-2" attributes="0"/> </Group> </Group> diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.java index 6cf41eefa48..df2e3dda8f7 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/OLAPConfigPanel.java @@ -873,7 +873,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(org.jdesktop.layout.GroupLayout.LEADING, nrSamplesPerSecondText) .add(org.jdesktop.layout.GroupLayout.LEADING, nrSamplesPerEthFrameText) .add(MSNameText))) - .add(1281, 1281, 1281)) + .add(1286, 1286, 1286)) ); OLAPGenericPanelLayout.setVerticalGroup( OLAPGenericPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -1011,7 +1011,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(subbandsPerCellText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE) .add(samplesToIntegrateText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 347, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(SpecificRevertButton)) - .addContainerGap(1343, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(1348, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ); OLAPSpecificPanelLayout.setVerticalGroup( OLAPSpecificPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -1071,7 +1071,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel1) .add(jLabel7)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 135, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 140, Short.MAX_VALUE) .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(AMCServerHostText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 215, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(AMCServerPortText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 64, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) @@ -1112,7 +1112,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(StellaFENText) .add(partitionText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)) - .add(14, 14, 14)) + .add(19, 19, 19)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -1151,7 +1151,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel2) .add(jLabel8)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 134, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 139, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(DelayPorts) .add(DelayCompensationHostText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 213, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) @@ -1203,7 +1203,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(jLabel3) .add(jLabel4) .add(jLabel9)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 125, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 130, Short.MAX_VALUE) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(InputHosts) .add(InputClusterFENText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 217, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) @@ -1262,7 +1262,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(jLabel10) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) .add(jPanel5Layout.createSequentialGroup() - .add(jLabel11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE) + .add(jLabel11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) @@ -1304,7 +1304,7 @@ public class OLAPConfigPanel extends javax.swing.JPanel implements IViewPanel{ .add(OLAPHardwarePanelLayout.createSequentialGroup() .add(OLAPHardwarePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE) + .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParameterViewPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParameterViewPanel.java index be5c1fd3613..823be1b8182 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParameterViewPanel.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParameterViewPanel.java @@ -199,27 +199,7 @@ public class ParameterViewPanel extends javax.swing.JPanel implements IViewPanel } } - /* Routine to strip all possible choices from a "popup" string like: - * "file|socket|ethernet" into it's different choices and make a combobox - * from it - */ - private void setComboChoices(String aS) { - this.ParamLimitsCombo.removeAllItems(); - if (aS.length() < 1) { - logger.debug("No choices provided for ParamLimits Combobox"); - return; - } - // first strip input on ; because after the ; a default choice has been given. - String[] stripped = aS.split("[;]"); - String[] choices = stripped[0].split("[|]"); - for (int i=0; i< choices.length;i++) { - if (!choices[i].equals("")) { - this.ParamLimitsCombo.addItem(choices[i]); - } - } - this.ParamLimitsCombo.validate(); - } - + private void getParam(jOTDBnode aNode) { itsParam=null; if (aNode == null) { @@ -296,13 +276,13 @@ public class ParameterViewPanel extends javax.swing.JPanel implements IViewPanel if (itsParam != null && LofarUtils.isReference(itsNode.limits)) { derefText.setVisible(true); derefLabel.setVisible(true); - setComboChoices(itsParam.limits); + LofarUtils.setPopupComboChoices(ParamLimitsCombo,itsParam.limits); setLimits(itsNode.limits); setDeref(itsParam.limits); } else { derefText.setVisible(false); derefLabel.setVisible(false); - setComboChoices(itsParam.limits); + LofarUtils.setPopupComboChoices(ParamLimitsCombo,itsParam.limits); setLimits(itsNode.limits); } setDescription(itsParam.description); @@ -546,9 +526,9 @@ public class ParameterViewPanel extends javax.swing.JPanel implements IViewPanel paramHasChanged=true; } - if (!itsNode.description.equals(getDescription())) { - itsNode.description=getDescription(); - nodeHasChanged=true; + if (!itsParam.description.equals(getDescription())) { + itsParam.description=getDescription(); + paramHasChanged=true; } if (!itsNode.limits.equals(getLimits())) { diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/bbs/BBSStrategyPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/bbs/BBSStrategyPanel.java index 4363fc837ea..11b6b7d2d8b 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/bbs/BBSStrategyPanel.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/bbs/BBSStrategyPanel.java @@ -251,13 +251,13 @@ public class BBSStrategyPanel extends javax.swing.JPanel implements IViewPanel{ integrationTimeText.setBackground(Color.WHITE); this.correlationSelectionBox.setSelectedItem(StrategyCorrelationSelection.limits); - this.fillSelectionListFromString(correlationTypeList,StrategyCorrelationType.limits,true); + LofarUtils.fillSelectionListFromString(correlationTypeList,StrategyCorrelationType.limits,true); if(StrategyStations.limits == null || StrategyStations.limits.equals("[]")){ this.stationsUseAllCheckbox.setSelected(true); stationsList.setModel(new DefaultListModel()); }else{ this.stationsUseAllCheckbox.setSelected(false); - this.fillList(stationsList,StrategyStations.limits,true); + LofarUtils.fillList(stationsList,StrategyStations.limits,true); } // addStationButton.setEnabled(false); @@ -348,10 +348,10 @@ public class BBSStrategyPanel extends javax.swing.JPanel implements IViewPanel{ TitledBorder aBorder = (TitledBorder)this.stationsPanel.getBorder(); if (isRef && aParam != null) { aBorder.setTitle("Station Names (Referenced)"); - this.fillList(stationsList,aParam.limits,false); + LofarUtils.fillList(stationsList,aParam.limits,false); } else { aBorder.setTitle("Station Names"); - this.fillList(stationsList,aNode.limits,true); + LofarUtils.fillList(stationsList,aNode.limits,true); } } } @@ -405,9 +405,9 @@ public class BBSStrategyPanel extends javax.swing.JPanel implements IViewPanel{ this.correlationTypeList.setToolTipText(aParam.description); this.StrategyCorrelationType=aNode; if (isRef && aParam != null) { - this.fillSelectionListFromString(correlationTypeList,aParam.limits,false); + LofarUtils.fillSelectionListFromString(correlationTypeList,aParam.limits,false); } else { - this.fillSelectionListFromString(correlationTypeList,aNode.limits,true); + LofarUtils.fillSelectionListFromString(correlationTypeList,aNode.limits,true); } } } @@ -481,8 +481,8 @@ public class BBSStrategyPanel extends javax.swing.JPanel implements IViewPanel{ logger.trace("Variable BBS Strategy ("+StrategyCorrelationSelection.name+"//"+StrategyCorrelationSelection.treeID()+"//"+StrategyCorrelationSelection.nodeID()+"//"+StrategyCorrelationSelection.parentID()+"//"+StrategyCorrelationSelection.paramDefID()+") updating to :"+StrategyCorrelationSelection.limits); saveNode(StrategyCorrelationSelection); } - if (this.StrategyCorrelationType != null && !this.createStringFromSelectionList(correlationTypeList,true).equals(StrategyCorrelationType.limits)) { - StrategyCorrelationType.limits = createStringFromSelectionList(correlationTypeList,true); + if (this.StrategyCorrelationType != null && !LofarUtils.createStringFromSelectionList(correlationTypeList,true).equals(StrategyCorrelationType.limits)) { + StrategyCorrelationType.limits = LofarUtils.createStringFromSelectionList(correlationTypeList,true); logger.trace("Variable BBS Strategy ("+StrategyCorrelationType.name+"//"+StrategyCorrelationType.treeID()+"//"+StrategyCorrelationType.nodeID()+"//"+StrategyCorrelationType.parentID()+"//"+StrategyCorrelationType.paramDefID()+") updating to :"+StrategyCorrelationType.limits); saveNode(StrategyCorrelationType); } @@ -490,153 +490,14 @@ public class BBSStrategyPanel extends javax.swing.JPanel implements IViewPanel{ if(this.stationsUseAllCheckbox.isSelected()){ stationsList.setModel(new DefaultListModel()); } - if (this.StrategyStations != null && !this.createList(stationsList,true).equals(StrategyStations.limits)) { - StrategyStations.limits = createList(stationsList,true); + if (this.StrategyStations != null && !LofarUtils.createList(stationsList,true).equals(StrategyStations.limits)) { + StrategyStations.limits = LofarUtils.createList(stationsList,true); logger.trace("Variable BBS Strategy ("+StrategyStations.name+"//"+StrategyStations.treeID()+"//"+StrategyStations.nodeID()+"//"+StrategyStations.parentID()+"//"+StrategyStations.paramDefID()+") updating to :"+StrategyStations.limits); saveNode(StrategyStations); } } - /** - * Creates a String representation of the contents of a JList component<br><br> - * Example of output with createQuotes : ["123","456","789"]<br> - * Example of output with !createQuotes: [123,456,789]<br> - * Returns '[]' when no items were detected in the JList. - * - * @param aListComponent the JList component of which the data has to be converted - * @param createQuotes add/do not add quotes to each individual value in the string output - * @return String representation of aListComponent - */ - private String createList(JList aListComponent,boolean createQuotes) { - String aList="["; - if (aListComponent.getModel().getSize() > 0) { - if(createQuotes){ - aList += "\""; - } - aList += (String)aListComponent.getModel().getElementAt(0); - if(createQuotes){ - aList += "\""; - } - for (int i=1; i < aListComponent.getModel().getSize();i++) { - aList+= ","; - if(createQuotes){ - aList += "\""; - } - aList += aListComponent.getModel().getElementAt(i); - if(createQuotes){ - aList += "\""; - } - } + - } - aList+="]"; - return aList; - } - /** - * Fills a JList component with a String representation of the to-be contents<br><br> - * Example of input argument theList with removeQuotes : ["123","456","789"]<br> - * Example of input argument theList with !removeQuotes: [123,456,789] - * - * @param aListComponent the JList component where the data has to be inserted in. - * @param theList the String representation of a JList component - * @param removeQuotes removes/does not remove quotes from each individual value in the theList input - */ - private void fillList(JList aListComponent,String theList,boolean removeQuotes) { - DefaultListModel itsModel = new DefaultListModel(); - aListComponent.setModel(itsModel); - String aList = theList; - if (aList.startsWith("[")) { - aList = aList.substring(1,aList.length()); - } - if (aList.endsWith("]")) { - aList = aList.substring(0,aList.length()-1); - } - if(!aList.equals("")){ - String[] aS=aList.split(","); - for (int i=0; i< aS.length;i++) { - if(removeQuotes){ - itsModel.addElement(aS[i].substring(1,aS[i].length()-1)); - }else{ - itsModel.addElement(aS[i]); - } - } - aListComponent.setModel(itsModel); - } - } - /** - * Creates a String representation of the <b><i>selected</i></b> items in a JList component<br><br> - * Example of output with createQuotes : ["123","456","789"]<br> - * Example of output with !createQuotes: [123,456,789]<br> - * Returns '[]' when no selected items were detected in the JList. - * - * @param aListComponent the JList component of which the selected items have to be in a String - * @param createQuotes add/do not add quotes to each individual value in the string output - * @return String representation of the selected items in a aListComponent - */ - private String createStringFromSelectionList(JList aListComponent,boolean createQuotes) { - String aList="["; - if (aListComponent.getModel().getSize() > 0) { - int[] selectedIndices = aListComponent.getSelectedIndices(); - for (int i=0; i < selectedIndices.length;i++) { - if(i>0) aList+= ","; - if(createQuotes){ - aList += "\""; - } - aList += aListComponent.getModel().getElementAt(selectedIndices[i]); - if(createQuotes){ - aList += "\""; - } - } - } - aList+="]"; - return aList; - } - /** - * Selects items in a JList component using a String representation of the to-be selected contents<br><br> - * Example of input argument theList with removeQuotes : ["123","456","789"]<br> - * Example of input argument theList with !removeQuotes: [123,456,789] - * - * @param aListComponent the JList component where the data has to be inserted in. - * @param theList the String representation of the selected items in a JList component - * @param removeQuotes removes/does not remove quotes from each individual value in the theList input - */ - private void fillSelectionListFromString(JList aListComponent,String theList,boolean removeQuotes) { - String aList = theList; - if (aList.startsWith("[")) { - aList = aList.substring(1,aList.length()); - } - if (aList.endsWith("]")) { - aList = aList.substring(0,aList.length()-1); - } - if(!aList.equals("")){ - String[] aS=aList.split(","); - String[] toBeSelectedValues = new String[aS.length]; - for (int i=0; i< aS.length;i++) { - if(removeQuotes){ - toBeSelectedValues[i] = aS[i].substring(1,aS[i].length()-1); - }else{ - toBeSelectedValues[i] = aS[i]; - } - } - int[] toBeSelectedIndices = new int[toBeSelectedValues.length]; - int aValueIndex = 0; - if(toBeSelectedValues.length>0){ - for(String aValue : toBeSelectedValues){ - - for(int in = 0; in < aListComponent.getModel().getSize();in++){ - String aCorrType = (String)aListComponent.getModel().getElementAt(in); - if(aValue.equals(aCorrType)){ - toBeSelectedIndices[aValueIndex] = in; - } - } - aValueIndex++; - } - aListComponent.setSelectedIndices(toBeSelectedIndices); - - }else{ - aListComponent.clearSelection(); - } - } - } /** * This helper method builds up the Step Tree that contains steps associated with the BBS Strategy * diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.form b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.form new file mode 100644 index 00000000000..edb593c3fe8 --- /dev/null +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.form @@ -0,0 +1,720 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <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,3,86,0,0,3,75"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel1"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder/> + </Border> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[100, 25]"/> + </Property> + </Properties> + <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.DesignBorderLayout"/> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Tahoma" size="11" style="1"/> + </Property> + <Property name="horizontalAlignment" type="int" value="0"/> + <Property name="text" type="java.lang.String" value="Observation Details"/> + </Properties> + <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> + <Container class="javax.swing.JPanel" name="jPanel2"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"> + <LineBorder/> + </Border> + </Property> + </Properties> + <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> + <Container class="javax.swing.JPanel" name="jPanel7"> + <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> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel3" pref="572" max="32767" attributes="1"/> + <Component id="jPanel10" alignment="1" pref="572" max="32767" attributes="1"/> + </Group> + <EmptySpace min="-2" pref="12" max="-2" attributes="0"/> + <Component id="jPanel5" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="jPanel3" min="-2" pref="125" max="-2" attributes="1"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jPanel10" max="32767" attributes="0"/> + </Group> + <Component id="jPanel5" alignment="0" max="32767" attributes="1"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel3"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Beam Input"/> + </Border> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[200, 125]"/> + </Property> + <Property name="requestFocusEnabled" type="boolean" value="false"/> + <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="labelAngleTimes" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> + <Component id="inputAngleTimes" min="-2" pref="159" max="-2" attributes="1"/> + </Group> + <Group type="102" alignment="0" attributes="1"> + <Component id="labelDirectionTypes" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="inputDirectionTypes" max="32767" attributes="1"/> + </Group> + </Group> + <EmptySpace pref="34" max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="labelAngle1" min="-2" pref="49" max="-2" attributes="1"/> + <Component id="labelAngle2" min="-2" max="-2" attributes="1"/> + </Group> + <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="inputAngle1" max="32767" attributes="1"/> + <Component id="inputAngle2" alignment="1" pref="190" max="32767" attributes="1"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="32767" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelAngleTimes" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputAngle1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputAngleTimes" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="labelAngle1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="15" pref="15" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelDirectionTypes" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputAngle2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputDirectionTypes" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="labelAngle2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="46" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="labelAngle1"> + <Properties> + <Property name="text" type="java.lang.String" value="Angle 1:"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputAngle1"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputAngle1FocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelAngle2"> + <Properties> + <Property name="text" type="java.lang.String" value="Angle 2 :"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputAngle2"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputAngle2FocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelAngleTimes"> + <Properties> + <Property name="text" type="java.lang.String" value="AngleTimes :"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputAngleTimes"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputAngleTimesFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelDirectionTypes"> + <Properties> + <Property name="text" type="java.lang.String" value="DirectionTypes:"/> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="inputDirectionTypes"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="1"> + <StringItem index="0" value="Item 1"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputDirectionTypesFocusGained"/> + </Events> + </Component> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="jPanel5"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Virtual Instrument Input"/> + </Border> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="stationsPanel" min="-2" pref="200" max="-2" attributes="0"/> + <EmptySpace pref="25" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="stationsPanel" pref="268" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="stationsPanel"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Station Names"/> + </Border> + </Property> + <Property name="toolTipText" type="java.lang.String" value="Identifiers of the participating stations."/> + </Properties> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="stationsScrollPane"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + <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.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JList" name="stationsList"> + <Properties> + <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> + <StringArray count="5"> + <StringItem index="0" value="1"/> + <StringItem index="1" value="2"/> + <StringItem index="2" value="3"/> + <StringItem index="3" value="4"/> + <StringItem index="4" value="5"/> + </StringArray> + </Property> + <Property name="toolTipText" type="java.lang.String" value="Names of the participating stations."/> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="stationsListFocusGained"/> + <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="stationsListValueChanged"/> + </Events> + </Component> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="stationsModPanel"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="South"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JPanel" name="stationsButtonPanel"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="South"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> + <SubComponents> + <Component class="javax.swing.JButton" name="deleteStationButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/nl/astron/lofar/sas/otbcomponents/bbs/icons/general/Delete16.gif"/> + </Property> + <Property name="toolTipText" type="java.lang.String" value="Remove the selected Station from the list"/> + <Property name="enabled" type="boolean" value="false"/> + <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteStationButtonActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JButton" name="addStationButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/nl/astron/lofar/sas/otbcomponents/bbs/icons/general/Add16.gif"/> + </Property> + <Property name="toolTipText" type="java.lang.String" value="Add the station entered to the list"/> + <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[30, 25]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addStationButtonActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JComboBox" name="modifyStationsCombobox"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <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> + </Container> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="jPanel10"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Generic Observation Input"/> + </Border> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="labelAntennaArray" alignment="0" max="32767" attributes="1"/> + <Component id="labelBandFilter" max="32767" attributes="1"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="inputAntennaArray" alignment="0" pref="143" max="32767" attributes="1"/> + <Component id="inputBandFilter" alignment="0" max="32767" attributes="1"/> + </Group> + <EmptySpace min="-2" pref="50" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="labelClockMode" alignment="0" pref="77" max="32767" attributes="1"/> + <Component id="labelNyquistZone" alignment="0" max="32767" attributes="1"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="inputNyquistZone" max="32767" attributes="1"/> + <Component id="inputClockMode" alignment="0" pref="183" max="32767" attributes="1"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="labelMSNameMask" min="-2" pref="80" max="-2" attributes="1"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="inputMSNameMask" min="-2" pref="331" max="-2" attributes="1"/> + </Group> + </Group> + <EmptySpace min="-2" pref="149" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelMSNameMask" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputMSNameMask" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelAntennaArray" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputAntennaArray" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="labelClockMode" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputClockMode" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="13" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelBandFilter" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputBandFilter" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="labelNyquistZone" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputNyquistZone" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace pref="47" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="labelMSNameMask"> + <Properties> + <Property name="text" type="java.lang.String" value="MSNameMask:"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputMSNameMask"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputMSNameMaskFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelAntennaArray"> + <Properties> + <Property name="text" type="java.lang.String" value="Antenna Array: "/> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="inputAntennaArray"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputAntennaArrayFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelBandFilter"> + <Properties> + <Property name="text" type="java.lang.String" value="BandFilter:"/> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="inputBandFilter"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputBandFilterFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JComboBox" name="inputClockMode"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputClockModeFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelNyquistZone"> + <Properties> + <Property name="text" type="java.lang.String" value="Nyquist Zone:"/> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="inputNyquistZone"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputNyquistZoneFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelClockMode"> + <Properties> + <Property name="text" type="java.lang.String" value="Clock Mode:"/> + </Properties> + </Component> + </SubComponents> + </Container> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="jPanel4"> + <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> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="labelStationList" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="labelStationList" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="labelStationList"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Generic Observation Lists"/> + </Border> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="descriptionScrollPane" pref="799" max="32767" attributes="1"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="labelSubbandList" pref="62" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + <Group type="102" attributes="0"> + <Component id="labelReceiverList" pref="59" max="32767" attributes="1"/> + <EmptySpace min="-2" pref="7" max="-2" attributes="0"/> + </Group> + <Group type="102" attributes="0"> + <Component id="labelBeamletList" pref="57" max="32767" attributes="1"/> + <EmptySpace min="-2" pref="9" max="-2" attributes="0"/> + </Group> + </Group> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="inputBeamletList" alignment="1" pref="733" max="32767" attributes="1"/> + <Component id="inputReceiverList" alignment="1" pref="733" max="32767" attributes="1"/> + <Component id="inputSubbandList" alignment="1" pref="733" max="32767" attributes="1"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelReceiverList" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputReceiverList" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="14" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelSubbandList" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputSubbandList" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="15" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="labelBeamletList" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="inputBeamletList" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="54" max="-2" attributes="0"/> + <Component id="descriptionScrollPane" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="177" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="labelBeamletList"> + <Properties> + <Property name="text" type="java.lang.String" value="Beamlets :"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputBeamletList"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputBeamletListFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelReceiverList"> + <Properties> + <Property name="text" type="java.lang.String" value="Receivers :"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputReceiverList"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputReceiverListFocusGained"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="labelSubbandList"> + <Properties> + <Property name="text" type="java.lang.String" value="Subbands :"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="inputSubbandList"> + <Events> + <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="inputSubbandListFocusGained"/> + </Events> + </Component> + <Container class="javax.swing.JScrollPane" name="descriptionScrollPane"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="Description"/> + </Border> + </Property> + </Properties> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTextArea" name="inputDescription"> + <Properties> + <Property name="columns" type="int" value="20"/> + <Property name="rows" type="int" value="5"/> + </Properties> + </Component> + </SubComponents> + </Container> + </SubComponents> + </Container> + </SubComponents> + </Container> + <Component class="nl.astron.lofar.sas.otbcomponents.ButtonPanel" name="buttonPanel1"> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPanel1ActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="South"/> + </Constraint> + </Constraints> + </Component> + </SubComponents> + </Container> + </SubComponents> +</Form> diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.java new file mode 100644 index 00000000000..17ff9b23361 --- /dev/null +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/userpanels/ObservationPanel.java @@ -0,0 +1,1198 @@ +/* + * ObservationPanel.java + * Copyright (C) 2002-2007 + * ASTRON (Netherlands Foundation for Research in Astronomy) + * P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package nl.astron.lofar.sas.otbcomponents.userpanels; + +import java.awt.Color; +import java.awt.Component; +import java.rmi.RemoteException; +import java.util.Enumeration; +import java.util.Vector; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.border.TitledBorder; +import nl.astron.lofar.lofarutils.LofarUtils; +import nl.astron.lofar.sas.otb.MainFrame; +import nl.astron.lofar.sas.otb.jotdb2.jOTDBnode; +import nl.astron.lofar.sas.otb.jotdb2.jOTDBparam; +import nl.astron.lofar.sas.otb.util.IViewPanel; +import nl.astron.lofar.sas.otb.util.UserAccount; +import nl.astron.lofar.sas.otbcomponents.OLAPConfigPanel; +import org.apache.log4j.Logger; + +/** + * Panel for Observation specific configuration + * + * @author Coolen + * + * @created 17-02-2007, 15:07 + * + * @version $Id$ + */ +public class ObservationPanel extends javax.swing.JPanel implements IViewPanel{ + + static Logger logger = Logger.getLogger(OLAPConfigPanel.class); + static String name = "OLAPConfig"; + + + /** Creates new form BeanForm based upon aNode + * + * @params aNode node to obtain the info from + * + */ + public ObservationPanel(MainFrame aMainFrame,jOTDBnode aNode) { + initComponents(); + itsMainFrame = aMainFrame; + itsNode=aNode; + initialize(); + initPanel(); + } + + /** Creates new form BeanForm */ + public ObservationPanel() { + initComponents(); + initialize(); + } + + public void setMainFrame(MainFrame aMainFrame) { + if (aMainFrame != null) { + itsMainFrame=aMainFrame; + } else { + logger.debug("No Mainframe supplied"); + } + } + + public String getShortName() { + return name; + } + + public void setContent(Object anObject) { + itsNode=(jOTDBnode)anObject; + jOTDBparam aParam=null; + try { + + //we need to get all the childs from this node. + Vector childs = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getItemList(itsNode.treeID(), itsNode.nodeID(), 1); + + // get all the params per child + Enumeration e = childs.elements(); + while( e.hasMoreElements() ) { + aParam=null; + + jOTDBnode aNode = (jOTDBnode)e.nextElement(); + + // We need to keep all the nodes needed by this panel + // if the node is a leaf we need to get the pointed to value via Param. + if (aNode.leaf) { + aParam = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getParam(aNode); + setField(aParam,aNode); + } else if (LofarUtils.keyName(aNode.name).equals("Beam")) { + //we need to get all the childs from this node also. + Vector beamChilds = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getItemList(aNode.treeID(), aNode.nodeID(), 1); + + // get all the params per child + Enumeration e1 = beamChilds.elements(); + while( e1.hasMoreElements() ) { + + jOTDBnode aBeamNode = (jOTDBnode)e1.nextElement(); + aParam=null; + // We need to keep all the params needed by this panel + if (aBeamNode.leaf) { + aParam = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getParam(aBeamNode); + } + setField(aParam,aBeamNode); + } + } else if (LofarUtils.keyName(aNode.name).equals("VirtualInstrument")) { + //we need to get all the childs from this node also. + Vector VIChilds = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getItemList(aNode.treeID(), aNode.nodeID(), 1); + + // get all the params per child + Enumeration e2 = VIChilds.elements(); + while( e2.hasMoreElements() ) { + + jOTDBnode aVINode = (jOTDBnode)e2.nextElement(); + aParam=null; + // We need to keep all the params needed by this panel + if (aVINode.leaf) { + aParam = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getParam(aVINode); + } + setField(aParam,aVINode); + } + } + } + } catch (RemoteException ex) { + logger.debug("Error during getComponentParam: "+ ex); + itsParamList=null; + return; + } + + initPanel(); + } + public boolean isSingleton() { + return false; + } + + public JPanel getInstance() { + return new ObservationPanel(); + } + public boolean hasPopupMenu() { + return false; + } + + + /** create popup menu for this panel + * + * // build up the menu + * aPopupMenu= new JPopupMenu(); + * aMenuItem=new JMenuItem("Choice 1"); + * aMenuItem.addActionListener(new java.awt.event.ActionListener() { + * public void actionPerformed(java.awt.event.ActionEvent evt) { + * popupMenuHandler(evt); + * } + * }); + * aMenuItem.setActionCommand("Choice 1"); + * aPopupMenu.add(aMenuItem); + * aPopupMenu.setOpaque(true); + * + * + * aPopupMenu.show(aComponent, x, y ); + */ + public void createPopupMenu(Component aComponent,int x, int y) { + JPopupMenu aPopupMenu=null; + JMenuItem aMenuItem=null; + + } + + /** handles the choice from the popupmenu + * + * depending on the choices that are possible for this panel perform the action for it + * + * if (evt.getActionCommand().equals("Choice 1")) { + * perform action + * } + */ + public void popupMenuHandler(java.awt.event.ActionEvent evt) { + } + + /* Set's the different fields in the GUI */ + private void setField(jOTDBparam aParam, jOTDBnode aNode) { + // Generic Observation + if (aNode==null) { + return; + } + logger.debug("setField for: "+ aNode.name); + boolean isRef = LofarUtils.isReference(aNode.limits); + String aKeyName = LofarUtils.keyName(aNode.name); + + // Observation Specific parameters + if (aKeyName.equals("MSNameMask")) { + inputMSNameMask.setToolTipText(aParam.description); + itsMSNameMask=aNode; + if (isRef && aParam != null) { + inputMSNameMask.setText(aNode.limits + " : " + aParam.limits); + } else { + inputMSNameMask.setText(aNode.limits); + } + } else if (aKeyName.equals("antennaArray")) { + inputAntennaArray.setToolTipText(aParam.description); + LofarUtils.setPopupComboChoices(inputAntennaArray,aParam.limits); + if (!aNode.limits.equals("")) { + inputAntennaArray.setSelectedItem(aNode.limits); + } + itsAntennaArray=aNode; + } else if (aKeyName.equals("bandFilter")) { + inputBandFilter.setToolTipText(aParam.description); + LofarUtils.setPopupComboChoices(inputBandFilter,aParam.limits); + if (!aNode.limits.equals("")) { + inputBandFilter.setSelectedItem(aNode.limits); + } + itsBandFilter=aNode; + } else if (aKeyName.equals("clockMode")) { + inputClockMode.setToolTipText(aParam.description); + LofarUtils.setPopupComboChoices(inputClockMode,aParam.limits); + if (!aNode.limits.equals("")) { + inputClockMode.setSelectedItem(aNode.limits); + } + itsClockMode=aNode; + } else if (aKeyName.equals("nyquistZone")) { + inputNyquistZone.setToolTipText(aParam.description); + LofarUtils.setPopupComboChoices(inputNyquistZone,aParam.limits); + if (!aNode.limits.equals("")) { + inputNyquistZone.setSelectedItem(aNode.limits); + } + itsNyquistZone=aNode; + } else if (aKeyName.equals("beamletList")) { + inputBeamletList.setToolTipText(aParam.description); + itsBeamletList=aNode; + if (isRef && aParam != null) { + inputBeamletList.setText(aNode.limits + " : " + aParam.limits); + } else { + inputBeamletList.setText(aNode.limits); + } + } else if (aKeyName.equals("receiverList")) { + inputReceiverList.setToolTipText(aParam.description); + itsReceiverList=aNode; + if (isRef && aParam != null) { + inputReceiverList.setText(aNode.limits + " : " + aParam.limits); + } else { + inputReceiverList.setText(aNode.limits); + } + } else if (aKeyName.equals("subbandList")) { + inputSubbandList.setToolTipText(aParam.description); + itsSubbandList=aNode; + if (isRef && aParam != null) { + inputSubbandList.setText(aNode.limits + " : " + aParam.limits); + } else { + inputSubbandList.setText(aNode.limits); + } + + // Observation Beam parameters + + + } else if (aKeyName.equals("angle1")) { + inputAngle1.setToolTipText(aParam.description); + itsAngle1=aNode; + if (isRef && aParam != null) { + inputAngle1.setText(aNode.limits + " : " + aParam.limits); + } else { + inputAngle1.setText(aNode.limits); + } + } else if (aKeyName.equals("angle2")) { + inputAngle2.setToolTipText(aParam.description); + itsAngle2=aNode; + if (isRef && aParam != null) { + inputAngle2.setText(aNode.limits + " : " + aParam.limits); + } else { + inputAngle2.setText(aNode.limits); + } + } else if (aKeyName.equals("angleTimes")) { + inputAngleTimes.setToolTipText(aParam.description); + itsAngleTimes=aNode; + if (isRef && aParam != null) { + inputAngleTimes.setText(aNode.limits + " : " + aParam.limits); + } else { + inputAngleTimes.setText(aNode.limits); + } + } else if (aKeyName.equals("directionTypes")) { + inputDirectionTypes.setToolTipText(aParam.description); + LofarUtils.setPopupComboChoices(inputDirectionTypes,aParam.limits); + if (!aNode.limits.equals("")) { + inputDirectionTypes.setSelectedItem(aNode.limits); + } + itsDirectionTypes=aNode; + + // Observation VirtualObservation parameters + + } else if (aKeyName.equals("stationList")) { + this.stationsList.setToolTipText(aParam.description); + this.itsStationList = aNode; + + //set the checkbox correctly when no stations are provided in the data + if(itsStationList.limits == null || itsStationList.limits.equals("[]")){ + stationsList.setModel(new DefaultListModel()); + }else{ + TitledBorder aBorder = (TitledBorder)this.stationsPanel.getBorder(); + if (isRef && aParam != null) { + aBorder.setTitle("Station Names (Referenced)"); + LofarUtils.fillList(stationsList,aParam.limits,false); + } else { + aBorder.setTitle("Station Names"); + LofarUtils.fillList(stationsList,aNode.limits,false); + } + } + } + } + + + /** Restore original Values in panel + */ + private void restore() { + // Observation Specific parameters + inputMSNameMask.setText(itsMSNameMask.limits); + inputAntennaArray.setSelectedItem(itsAntennaArray.limits); + inputBandFilter.setSelectedItem(itsBandFilter.limits); + inputClockMode.setSelectedItem(itsClockMode.limits); + inputNyquistZone.setSelectedItem(itsNyquistZone.limits); + inputBeamletList.setText(itsBeamletList.limits); + inputReceiverList.setText(itsReceiverList.limits); + inputSubbandList.setText(itsSubbandList.limits); + inputDescription.setText(""); + + // Observation Beam parameters + inputAngle1.setText(itsAngle1.limits); + inputAngle2.setText(itsAngle2.limits); + inputAngleTimes.setText(itsAngleTimes.limits); + inputDirectionTypes.setSelectedItem(itsDirectionTypes.limits); + + + // Observation VirtualObservation parameters + //set the checkbox correctly when no stations are provided in the data + if(itsStationList.limits == null || itsStationList.limits.equals("[]")){ + stationsList.setModel(new DefaultListModel()); + }else{ + TitledBorder aBorder = (TitledBorder)this.stationsPanel.getBorder(); + aBorder.setTitle("Station Names"); + LofarUtils.fillList(stationsList,itsStationList.limits,false); + } + } + + + private void initialize() { + buttonPanel1.addButton("Restore"); + buttonPanel1.addButton("Save"); + this.stationsList.setModel(new DefaultListModel()); + + // hardcoded for now. In a later stage they MUST be taken out of + // the param, or from a special class that contains all possible stations + this.modifyStationsCombobox.removeAllItems(); + this.modifyStationsCombobox.addItem("CS001"); + this.modifyStationsCombobox.addItem("CS008"); + this.modifyStationsCombobox.addItem("CS010"); + this.modifyStationsCombobox.addItem("CS016"); + } + + private void initPanel() { + // check access + UserAccount userAccount = itsMainFrame.getUserAccount(); + + // for now: + setAllEnabled(true); + + if(userAccount.isAdministrator()) { + // enable/disable certain controls + } + if(userAccount.isAstronomer()) { + // enable/disable certain controls + } + if(userAccount.isInstrumentScientist()) { + // enable/disable certain controls + } + + + + if (itsNode != null) { + // [TODO] + // Fill from existing cfg needed ???? + } else { + logger.debug("ERROR: no node given"); + } + } + + /** saves the given node back to the database + */ + private void saveNode(jOTDBnode aNode) { + if (aNode == null) { + return; + } + try { + itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().saveNode(aNode); + } catch (RemoteException ex) { + logger.debug("Error: saveNode failed : " + ex); + } + } + + /** Enables/disables the buttons + * + * @param enabled true/false enabled/disabled + */ + public void enableButtons(boolean enabled) { + } + + /** Sets the buttons visible/invisible + * + * @param visible true/false visible/invisible + */ + public void setButtonsVisible(boolean visible) { + } + + /** Enables/disables the complete form + * + * @param enabled true/false enabled/disabled + */ + public void setAllEnabled(boolean enabled) { + } + + private void saveInput() { + boolean hasChanged = false; + + // Beam + if (itsAngleTimes != null && !inputAngleTimes.equals(itsAngleTimes.limits)) { + itsAngleTimes.limits = inputAngleTimes.getText(); + saveNode(itsAngleTimes); + } + if (itsAngle1 != null && !inputAngle1.equals(itsAngle1.limits)) { + itsAngle1.limits = inputAngle1.getText(); + saveNode(itsAngle1); + } + if (itsAngle2 != null && !inputAngle2.equals(itsAngle2.limits)) { + itsAngle2.limits = inputAngle2.getText(); + saveNode(itsAngle2); + } + if (itsDirectionTypes != null && !inputDirectionTypes.getSelectedItem().toString().equals(itsDirectionTypes.limits)) { + itsDirectionTypes.limits = inputDirectionTypes.getSelectedItem().toString(); + saveNode(itsDirectionTypes); + } + + //VirtualInstrument + if (this.itsStationList != null && !LofarUtils.createList(stationsList,false).equals(itsStationList.limits)) { + itsStationList.limits = LofarUtils.createList(stationsList,false); + logger.trace("Variable VirtualInstrumenst ("+itsStationList.name+"//"+itsStationList.treeID()+"//"+itsStationList.nodeID()+"//"+itsStationList.parentID()+"//"+itsStationList.paramDefID()+") updating to :"+itsStationList.limits); + saveNode(itsStationList); + } + + // Generic Observation + if (itsMSNameMask != null && !inputMSNameMask.equals(itsMSNameMask.limits)) { + itsMSNameMask.limits = inputMSNameMask.getText(); + saveNode(itsMSNameMask); + } + if (itsBeamletList != null && !inputBeamletList.equals(itsBeamletList.limits)) { + itsBeamletList.limits = inputBeamletList.getText(); + saveNode(itsBeamletList); + } + if (itsReceiverList != null && !inputReceiverList.equals(itsReceiverList.limits)) { + itsReceiverList.limits = inputReceiverList.getText(); + saveNode(itsReceiverList); + } + if (itsSubbandList != null && !inputSubbandList.equals(itsSubbandList.limits)) { + itsSubbandList.limits = inputSubbandList.getText(); + saveNode(itsSubbandList); + } + if (itsAntennaArray != null && !inputAntennaArray.getSelectedItem().toString().equals(itsAntennaArray.limits)) { + itsAntennaArray.limits = inputAntennaArray.getSelectedItem().toString(); + saveNode(itsAntennaArray); + } + if (itsBandFilter != null && !inputBandFilter.getSelectedItem().toString().equals(itsBandFilter.limits)) { + itsBandFilter.limits = inputBandFilter.getSelectedItem().toString(); + saveNode(itsBandFilter); + } + if (itsClockMode != null && !inputClockMode.getSelectedItem().toString().equals(itsClockMode.limits)) { + itsClockMode.limits = inputClockMode.getSelectedItem().toString(); + saveNode(itsClockMode); + } + if (itsNyquistZone != null && !inputNyquistZone.getSelectedItem().toString().equals(itsNyquistZone.limits)) { + itsNyquistZone.limits = inputNyquistZone.getSelectedItem().toString(); + saveNode(itsNyquistZone); + } + + + } + + private void changeDescription(jOTDBnode aNode) { + if (aNode == null) { + return; + } + try { + jOTDBparam aParam = itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().getParam(aNode); + // check if the node changed, and if the description was changed, if so ask if the new description + // should be saved. + if (itsOldDescriptionParam == null | itsOldDescriptionParam !=aParam) { + if (itsOldDescriptionParam != null) { + if (!inputDescription.getText().equals(itsOldDescriptionParam.description) && !inputDescription.getText().equals("")) { + int answer=JOptionPane.showConfirmDialog(this,"The old description was altered, do you want to save the old one ?","alert",JOptionPane.YES_NO_OPTION); + if (answer == JOptionPane.YES_OPTION) { + if (!itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().saveParam(itsOldDescriptionParam)) { + logger.error("Saving param "+itsOldDescriptionParam.nodeID()+","+itsOldDescriptionParam.paramID()+"failed: "+ itsMainFrame.getSharedVars().getOTDBrmi().getRemoteMaintenance().errorMsg()); + } + } + } + } + } + itsOldDescriptionParam=aParam; + inputDescription.setText(aParam.description); + } catch (RemoteException ex) { + logger.debug("Error during getParam: "+ ex); + return; + } + } + + + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jPanel2 = new javax.swing.JPanel(); + jPanel7 = new javax.swing.JPanel(); + jPanel3 = new javax.swing.JPanel(); + labelAngle1 = new javax.swing.JLabel(); + inputAngle1 = new javax.swing.JTextField(); + labelAngle2 = new javax.swing.JLabel(); + inputAngle2 = new javax.swing.JTextField(); + labelAngleTimes = new javax.swing.JLabel(); + inputAngleTimes = new javax.swing.JTextField(); + labelDirectionTypes = new javax.swing.JLabel(); + inputDirectionTypes = new javax.swing.JComboBox(); + jPanel5 = new javax.swing.JPanel(); + stationsPanel = new javax.swing.JPanel(); + stationsScrollPane = new javax.swing.JScrollPane(); + stationsList = new javax.swing.JList(); + stationsModPanel = new javax.swing.JPanel(); + stationsButtonPanel = new javax.swing.JPanel(); + deleteStationButton = new javax.swing.JButton(); + addStationButton = new javax.swing.JButton(); + modifyStationsCombobox = new javax.swing.JComboBox(); + jPanel10 = new javax.swing.JPanel(); + labelMSNameMask = new javax.swing.JLabel(); + inputMSNameMask = new javax.swing.JTextField(); + labelAntennaArray = new javax.swing.JLabel(); + inputAntennaArray = new javax.swing.JComboBox(); + labelBandFilter = new javax.swing.JLabel(); + inputBandFilter = new javax.swing.JComboBox(); + inputClockMode = new javax.swing.JComboBox(); + labelNyquistZone = new javax.swing.JLabel(); + inputNyquistZone = new javax.swing.JComboBox(); + labelClockMode = new javax.swing.JLabel(); + jPanel4 = new javax.swing.JPanel(); + labelStationList = new javax.swing.JPanel(); + labelBeamletList = new javax.swing.JLabel(); + inputBeamletList = new javax.swing.JTextField(); + labelReceiverList = new javax.swing.JLabel(); + inputReceiverList = new javax.swing.JTextField(); + labelSubbandList = new javax.swing.JLabel(); + inputSubbandList = new javax.swing.JTextField(); + descriptionScrollPane = new javax.swing.JScrollPane(); + inputDescription = new javax.swing.JTextArea(); + buttonPanel1 = new nl.astron.lofar.sas.otbcomponents.ButtonPanel(); + + setLayout(new java.awt.BorderLayout()); + + jPanel1.setLayout(new java.awt.BorderLayout()); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("")); + jPanel1.setPreferredSize(new java.awt.Dimension(100, 25)); + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); + jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + jLabel1.setText("Observation Details"); + jPanel1.add(jLabel1, java.awt.BorderLayout.CENTER); + + add(jPanel1, java.awt.BorderLayout.NORTH); + + jPanel2.setLayout(new java.awt.BorderLayout()); + + jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Input")); + jPanel3.setPreferredSize(new java.awt.Dimension(200, 125)); + jPanel3.setRequestFocusEnabled(false); + jPanel3.setVerifyInputWhenFocusTarget(false); + labelAngle1.setText("Angle 1:"); + + inputAngle1.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputAngle1FocusGained(evt); + } + }); + + labelAngle2.setText("Angle 2 :"); + + inputAngle2.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputAngle2FocusGained(evt); + } + }); + + labelAngleTimes.setText("AngleTimes :"); + + inputAngleTimes.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputAngleTimesFocusGained(evt); + } + }); + + labelDirectionTypes.setText("DirectionTypes:"); + + inputDirectionTypes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1" })); + inputDirectionTypes.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputDirectionTypesFocusGained(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel3Layout.createSequentialGroup() + .add(labelAngleTimes) + .add(19, 19, 19) + .add(inputAngleTimes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 159, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel3Layout.createSequentialGroup() + .add(labelDirectionTypes) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(inputDirectionTypes, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 34, Short.MAX_VALUE) + .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(labelAngle1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(labelAngle2)) + .add(28, 28, 28) + .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(inputAngle1) + .add(inputAngle2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel3Layout.createSequentialGroup() + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelAngleTimes) + .add(inputAngle1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(inputAngleTimes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(labelAngle1)) + .add(15, 15, 15) + .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelDirectionTypes) + .add(inputAngle2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(inputDirectionTypes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(labelAngle2)) + .add(46, 46, 46)) + ); + + jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Virtual Instrument Input")); + stationsPanel.setLayout(new java.awt.BorderLayout()); + + stationsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Station Names")); + stationsPanel.setToolTipText("Identifiers of the participating stations."); + stationsList.setModel(new javax.swing.AbstractListModel() { + String[] strings = { "1", "2", "3", "4", "5" }; + public int getSize() { return strings.length; } + public Object getElementAt(int i) { return strings[i]; } + }); + stationsList.setToolTipText("Names of the participating stations."); + stationsList.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + stationsListFocusGained(evt); + } + }); + stationsList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { + stationsListValueChanged(evt); + } + }); + + stationsScrollPane.setViewportView(stationsList); + + stationsPanel.add(stationsScrollPane, java.awt.BorderLayout.CENTER); + + stationsModPanel.setLayout(new java.awt.BorderLayout()); + + stationsButtonPanel.setLayout(new java.awt.GridBagLayout()); + + deleteStationButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/nl/astron/lofar/sas/otbcomponents/bbs/icons/general/Delete16.gif"))); + deleteStationButton.setToolTipText("Remove the selected Station from the list"); + deleteStationButton.setEnabled(false); + deleteStationButton.setMaximumSize(new java.awt.Dimension(30, 25)); + deleteStationButton.setMinimumSize(new java.awt.Dimension(30, 25)); + deleteStationButton.setPreferredSize(new java.awt.Dimension(30, 25)); + deleteStationButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteStationButtonActionPerformed(evt); + } + }); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + stationsButtonPanel.add(deleteStationButton, gridBagConstraints); + + addStationButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/nl/astron/lofar/sas/otbcomponents/bbs/icons/general/Add16.gif"))); + addStationButton.setToolTipText("Add the station entered to the list"); + addStationButton.setMaximumSize(new java.awt.Dimension(30, 25)); + addStationButton.setMinimumSize(new java.awt.Dimension(30, 25)); + addStationButton.setPreferredSize(new java.awt.Dimension(30, 25)); + addStationButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addStationButtonActionPerformed(evt); + } + }); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + stationsButtonPanel.add(addStationButton, gridBagConstraints); + + stationsModPanel.add(stationsButtonPanel, java.awt.BorderLayout.SOUTH); + + modifyStationsCombobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + stationsModPanel.add(modifyStationsCombobox, java.awt.BorderLayout.CENTER); + + stationsPanel.add(stationsModPanel, java.awt.BorderLayout.SOUTH); + + org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .add(stationsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap(25, Short.MAX_VALUE)) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel5Layout.createSequentialGroup() + .add(stationsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE) + .addContainerGap()) + ); + + jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Generic Observation Input")); + labelMSNameMask.setText("MSNameMask:"); + + inputMSNameMask.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputMSNameMaskFocusGained(evt); + } + }); + + labelAntennaArray.setText("Antenna Array: "); + + inputAntennaArray.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + inputAntennaArray.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputAntennaArrayFocusGained(evt); + } + }); + + labelBandFilter.setText("BandFilter:"); + + inputBandFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + inputBandFilter.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputBandFilterFocusGained(evt); + } + }); + + inputClockMode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + inputClockMode.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputClockModeFocusGained(evt); + } + }); + + labelNyquistZone.setText("Nyquist Zone:"); + + inputNyquistZone.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + inputNyquistZone.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputNyquistZoneFocusGained(evt); + } + }); + + labelClockMode.setText("Clock Mode:"); + + org.jdesktop.layout.GroupLayout jPanel10Layout = new org.jdesktop.layout.GroupLayout(jPanel10); + jPanel10.setLayout(jPanel10Layout); + jPanel10Layout.setHorizontalGroup( + jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel10Layout.createSequentialGroup() + .addContainerGap() + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel10Layout.createSequentialGroup() + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(labelAntennaArray, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(labelBandFilter, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(inputAntennaArray, 0, 143, Short.MAX_VALUE) + .add(inputBandFilter, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .add(50, 50, 50) + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(labelClockMode, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) + .add(labelNyquistZone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(inputNyquistZone, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(inputClockMode, 0, 183, Short.MAX_VALUE))) + .add(jPanel10Layout.createSequentialGroup() + .add(labelMSNameMask, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(inputMSNameMask, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 331, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .add(149, 149, 149)) + ); + jPanel10Layout.setVerticalGroup( + jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel10Layout.createSequentialGroup() + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelMSNameMask) + .add(inputMSNameMask, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(24, 24, 24) + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelAntennaArray) + .add(inputAntennaArray, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(labelClockMode) + .add(inputClockMode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(13, 13, 13) + .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelBandFilter) + .add(inputBandFilter, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(labelNyquistZone) + .add(inputNyquistZone, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(47, Short.MAX_VALUE)) + ); + + org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7); + jPanel7.setLayout(jPanel7Layout); + jPanel7Layout.setHorizontalGroup( + jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel7Layout.createSequentialGroup() + .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 572, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 572, Short.MAX_VALUE)) + .add(12, 12, 12) + .add(jPanel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel7Layout.setVerticalGroup( + jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel7Layout.createSequentialGroup() + .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup() + .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 125, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jPanel10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2.add(jPanel7, java.awt.BorderLayout.NORTH); + + labelStationList.setBorder(javax.swing.BorderFactory.createTitledBorder("Generic Observation Lists")); + labelBeamletList.setText("Beamlets :"); + + inputBeamletList.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputBeamletListFocusGained(evt); + } + }); + + labelReceiverList.setText("Receivers :"); + + inputReceiverList.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputReceiverListFocusGained(evt); + } + }); + + labelSubbandList.setText("Subbands :"); + + inputSubbandList.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent evt) { + inputSubbandListFocusGained(evt); + } + }); + + descriptionScrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Description")); + inputDescription.setColumns(20); + inputDescription.setRows(5); + descriptionScrollPane.setViewportView(inputDescription); + + org.jdesktop.layout.GroupLayout labelStationListLayout = new org.jdesktop.layout.GroupLayout(labelStationList); + labelStationList.setLayout(labelStationListLayout); + labelStationListLayout.setHorizontalGroup( + labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(labelStationListLayout.createSequentialGroup() + .addContainerGap() + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(labelStationListLayout.createSequentialGroup() + .add(descriptionScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 799, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, labelStationListLayout.createSequentialGroup() + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(labelStationListLayout.createSequentialGroup() + .add(labelSubbandList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) + .add(labelStationListLayout.createSequentialGroup() + .add(labelReceiverList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE) + .add(7, 7, 7)) + .add(labelStationListLayout.createSequentialGroup() + .add(labelBeamletList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) + .add(9, 9, 9))) + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, inputBeamletList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 733, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, inputReceiverList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 733, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, inputSubbandList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 733, Short.MAX_VALUE)))) + .addContainerGap()) + ); + labelStationListLayout.setVerticalGroup( + labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(labelStationListLayout.createSequentialGroup() + .addContainerGap() + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelReceiverList) + .add(inputReceiverList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(14, 14, 14) + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelSubbandList) + .add(inputSubbandList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(15, 15, 15) + .add(labelStationListLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(labelBeamletList) + .add(inputBeamletList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(54, 54, 54) + .add(descriptionScrollPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap(177, Short.MAX_VALUE)) + ); + + org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel4Layout.createSequentialGroup() + .add(labelStationList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel4Layout.createSequentialGroup() + .add(labelStationList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + jPanel2.add(jPanel4, java.awt.BorderLayout.CENTER); + + buttonPanel1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonPanel1ActionPerformed(evt); + } + }); + + jPanel2.add(buttonPanel1, java.awt.BorderLayout.SOUTH); + + add(jPanel2, java.awt.BorderLayout.CENTER); + + }// </editor-fold>//GEN-END:initComponents + + private void inputSubbandListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputSubbandListFocusGained + changeDescription(itsSubbandList); + }//GEN-LAST:event_inputSubbandListFocusGained + + private void inputReceiverListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputReceiverListFocusGained + changeDescription(itsReceiverList); + }//GEN-LAST:event_inputReceiverListFocusGained + + private void inputBeamletListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputBeamletListFocusGained + changeDescription(itsBeamletList); + }//GEN-LAST:event_inputBeamletListFocusGained + + private void inputNyquistZoneFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputNyquistZoneFocusGained + changeDescription(itsNyquistZone); + }//GEN-LAST:event_inputNyquistZoneFocusGained + + private void inputClockModeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputClockModeFocusGained + changeDescription(itsClockMode); + }//GEN-LAST:event_inputClockModeFocusGained + + private void inputBandFilterFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputBandFilterFocusGained + changeDescription(itsBandFilter); + }//GEN-LAST:event_inputBandFilterFocusGained + + private void inputAntennaArrayFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputAntennaArrayFocusGained + changeDescription(itsAntennaArray); + }//GEN-LAST:event_inputAntennaArrayFocusGained + + private void inputMSNameMaskFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputMSNameMaskFocusGained + changeDescription(itsMSNameMask); + }//GEN-LAST:event_inputMSNameMaskFocusGained + + private void stationsListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stationsListFocusGained + changeDescription(itsStationList); + }//GEN-LAST:event_stationsListFocusGained + + private void inputAngle2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputAngle2FocusGained + changeDescription(itsAngle2); + }//GEN-LAST:event_inputAngle2FocusGained + + private void inputDirectionTypesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputDirectionTypesFocusGained + changeDescription(itsDirectionTypes); + }//GEN-LAST:event_inputDirectionTypesFocusGained + + private void inputAngleTimesFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputAngleTimesFocusGained + changeDescription(itsAngleTimes); + }//GEN-LAST:event_inputAngleTimesFocusGained + + private void buttonPanel1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPanel1ActionPerformed + if(evt.getActionCommand() == "Save") { + saveInput(); + } else if(evt.getActionCommand() == "Restore") { + restore(); + } + + }//GEN-LAST:event_buttonPanel1ActionPerformed + + private void addStationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addStationButtonActionPerformed + String toBeAddedStation = (String)this.modifyStationsCombobox.getSelectedItem(); + DefaultListModel theStationModel = (DefaultListModel)stationsList.getModel(); + if(!theStationModel.contains(toBeAddedStation)){ + theStationModel.addElement(toBeAddedStation); + } + }//GEN-LAST:event_addStationButtonActionPerformed + + private void deleteStationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteStationButtonActionPerformed + DefaultListModel theStationModel = (DefaultListModel)stationsList.getModel(); + int[] selectedIndices = stationsList.getSelectedIndices(); + while(selectedIndices.length>0){ + theStationModel.remove(selectedIndices[0]); + selectedIndices = stationsList.getSelectedIndices(); + } + if(theStationModel.size()==0){ + this.deleteStationButton.setEnabled(false); + } + }//GEN-LAST:event_deleteStationButtonActionPerformed + + private void stationsListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_stationsListValueChanged + int[] selectedIndices = ((JList)evt.getSource()).getSelectedIndices(); + if(selectedIndices.length>0){ + this.deleteStationButton.setEnabled(true); + }else{ + this.deleteStationButton.setEnabled(false); + } + }//GEN-LAST:event_stationsListValueChanged + + private void inputAngle1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputAngle1FocusGained + changeDescription(itsAngle1); + }//GEN-LAST:event_inputAngle1FocusGained + + private jOTDBnode itsNode = null; + private MainFrame itsMainFrame; + private Vector<jOTDBparam> itsParamList; + private jOTDBparam itsOldDescriptionParam; + + // Observation Specific parameters + private jOTDBnode itsMSNameMask; + private jOTDBnode itsAntennaArray; + private jOTDBnode itsBandFilter; + private jOTDBnode itsClockMode; + private jOTDBnode itsNyquistZone; + private jOTDBnode itsBeamletList; + private jOTDBnode itsReceiverList; + private jOTDBnode itsSubbandList; + + + // Observation Beam parameters + private jOTDBnode itsAngle1; + private jOTDBnode itsAngle2; + private jOTDBnode itsAngleTimes; + private jOTDBnode itsDirectionTypes; + + // Observation VirtualObservation parameters + private jOTDBnode itsStationList; + + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton addStationButton; + private nl.astron.lofar.sas.otbcomponents.ButtonPanel buttonPanel1; + private javax.swing.JButton deleteStationButton; + private javax.swing.JScrollPane descriptionScrollPane; + private javax.swing.JTextField inputAngle1; + private javax.swing.JTextField inputAngle2; + private javax.swing.JTextField inputAngleTimes; + private javax.swing.JComboBox inputAntennaArray; + private javax.swing.JComboBox inputBandFilter; + private javax.swing.JTextField inputBeamletList; + private javax.swing.JComboBox inputClockMode; + private javax.swing.JTextArea inputDescription; + private javax.swing.JComboBox inputDirectionTypes; + private javax.swing.JTextField inputMSNameMask; + private javax.swing.JComboBox inputNyquistZone; + private javax.swing.JTextField inputReceiverList; + private javax.swing.JTextField inputSubbandList; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel10; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel7; + private javax.swing.JLabel labelAngle1; + private javax.swing.JLabel labelAngle2; + private javax.swing.JLabel labelAngleTimes; + private javax.swing.JLabel labelAntennaArray; + private javax.swing.JLabel labelBandFilter; + private javax.swing.JLabel labelBeamletList; + private javax.swing.JLabel labelClockMode; + private javax.swing.JLabel labelDirectionTypes; + private javax.swing.JLabel labelMSNameMask; + private javax.swing.JLabel labelNyquistZone; + private javax.swing.JLabel labelReceiverList; + private javax.swing.JPanel labelStationList; + private javax.swing.JLabel labelSubbandList; + private javax.swing.JComboBox modifyStationsCombobox; + private javax.swing.JPanel stationsButtonPanel; + private javax.swing.JList stationsList; + private javax.swing.JPanel stationsModPanel; + private javax.swing.JPanel stationsPanel; + private javax.swing.JScrollPane stationsScrollPane; + // End of variables declaration//GEN-END:variables + + + + /** + * Utility field used by event firing mechanism. + */ + private javax.swing.event.EventListenerList listenerList = null; + + /** + * Registers ActionListener to receive events. + * @param listener The listener to register. + */ + public synchronized void addActionListener(java.awt.event.ActionListener listener) { + + if (listenerList == null ) { + listenerList = new javax.swing.event.EventListenerList(); + } + listenerList.add (java.awt.event.ActionListener.class, listener); + } + + /** + * Removes ActionListener from the list of listeners. + * @param listener The listener to remove. + */ + public synchronized void removeActionListener(java.awt.event.ActionListener listener) { + + listenerList.remove (java.awt.event.ActionListener.class, listener); + } + + /** + * Notifies all registered listeners about the event. + * + * @param event The event to be fired + */ + private void fireActionListenerActionPerformed(java.awt.event.ActionEvent event) { + + if (listenerList == null) return; + Object[] listeners = listenerList.getListenerList (); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i]==java.awt.event.ActionListener.class) { + ((java.awt.event.ActionListener)listeners[i+1]).actionPerformed (event); + } + } + } +} -- GitLab