Changed Shell Action Panel to support exit value check and exit value.
NOTE: the newer versions of netbeans have a strange behavior the Bundles.properties gets generated inside the src/main/java folder but they need to be manually copied to the src/main/resources folder once the form is saved. Otherwise things will crash...
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
@@ -16,12 +16,28 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jTextField1" alignment="1" pref="400" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jTextField1" pref="84" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTextField2" min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jTextField1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
@@ -39,5 +55,47 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/ch/psi/fda/ui/ce/icons/plus.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jButton1.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="borderPainted" type="boolean" value="false"/>
|
||||
<Property name="contentAreaFilled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jCheckBox1.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jTextField2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jTextField2.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="jTextField2"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/ce/panels/model/Bundle.properties" key="ShellActionPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -33,6 +33,8 @@ import java.awt.Component;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
|
||||
/**
|
||||
@@ -58,12 +60,16 @@ public class ShellActionPanel extends javax.swing.JPanel implements ObjectProvid
|
||||
|
||||
HashMap<Component, ComponentMetadata> managedFields = new HashMap<Component,ComponentMetadata>();
|
||||
managedFields.put(jTextField1, new ComponentMetadata(true));
|
||||
managedFields.put(jCheckBox1, new ComponentMetadata(false));
|
||||
managedFields.put(jTextField2, new ComponentMetadata(false, "0"));
|
||||
|
||||
this.panelSupport = new PanelSupport();
|
||||
this.panelSupport.analyze(managedFields);
|
||||
|
||||
// Update view
|
||||
this.jTextField1.setText(action.getCommand());
|
||||
this.jCheckBox1.setSelected(action.isCheckExitValue());
|
||||
this.jTextField2.setText(""+action.getExitValue());
|
||||
|
||||
// Establish bindings
|
||||
jTextField1.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@@ -73,9 +79,29 @@ public class ShellActionPanel extends javax.swing.JPanel implements ObjectProvid
|
||||
action.setCommand(panelSupport.getRealFieldValue(jTextField1));
|
||||
}
|
||||
});
|
||||
jCheckBox1.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent ce) {
|
||||
modified = true;
|
||||
action.setCheckExitValue(jCheckBox1.isSelected());
|
||||
}
|
||||
});
|
||||
jTextField1.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
public void valueChange(DocumentEvent de) {
|
||||
modified = true;
|
||||
try{
|
||||
action.setExitValue(new Integer(panelSupport.getRealFieldValue(jTextField2)));
|
||||
}
|
||||
catch(Exception e){
|
||||
jTextField2.setText(""+action.getExitValue());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.panelSupport.manage(this, managedFields, null);
|
||||
this.panelSupport.manage(this, managedFields, jButton1);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
@@ -88,26 +114,62 @@ public class ShellActionPanel extends javax.swing.JPanel implements ObjectProvid
|
||||
private void initComponents() {
|
||||
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jCheckBox1 = new javax.swing.JCheckBox();
|
||||
jTextField2 = new javax.swing.JTextField();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
jTextField1.setText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jTextField1.text")); // NOI18N
|
||||
jTextField1.setToolTipText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jTextField1.toolTipText")); // NOI18N
|
||||
jTextField1.setPreferredSize(new java.awt.Dimension(200, 28));
|
||||
|
||||
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ch/psi/fda/ui/ce/icons/plus.png"))); // NOI18N
|
||||
jButton1.setText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jButton1.text_1")); // NOI18N
|
||||
jButton1.setBorderPainted(false);
|
||||
jButton1.setContentAreaFilled(false);
|
||||
|
||||
jCheckBox1.setText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jCheckBox1.text")); // NOI18N
|
||||
jCheckBox1.setName(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jCheckBox1.name")); // NOI18N
|
||||
|
||||
jTextField2.setText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jTextField2.text")); // NOI18N
|
||||
jTextField2.setName(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jTextField2.name")); // NOI18N
|
||||
|
||||
jLabel1.setLabelFor(jTextField2);
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(ShellActionPanel.class, "ShellActionPanel.jLabel1.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jCheckBox1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton1))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jButton1)
|
||||
.addComponent(jCheckBox1)
|
||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JCheckBox jCheckBox1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
private javax.swing.JTextField jTextField2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
|
||||
|
||||
@@ -260,3 +260,9 @@ LinearPositionerPanel.Asynchronous.text=Asynchronous
|
||||
DiscreteStepPositionerPanel.Asynchronous.text=Asynchronous:
|
||||
DiscreteStepPositionerPanel.jLabel7.text=Type:
|
||||
PseudoPositionerPanel.jLabel7.text=Type:
|
||||
ShellActionPanel.jButton1.text_1=
|
||||
ShellActionPanel.jCheckBox1.text=Check ReturnValue
|
||||
ShellActionPanel.jCheckBox1.name=Check ReturnValue
|
||||
ShellActionPanel.jTextField2.text=
|
||||
ShellActionPanel.jLabel1.text=Return Value
|
||||
ShellActionPanel.jTextField2.name=Return Value
|
||||
|
||||
Reference in New Issue
Block a user