Closedown

This commit is contained in:
boccioli_m
2015-08-18 14:46:02 +02:00
parent 59cb0c34ac
commit d80fb06a4e
4 changed files with 378 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<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" max="-2" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Component id="cmDefault" min="-2" pref="132" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="180" max="-2" attributes="0"/>
<Component id="cmOk" min="-2" pref="96" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cmCancel" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane5" max="32767" attributes="0"/>
</Group>
<EmptySpace 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="jScrollPane5" pref="547" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cmCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmOk" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cmDefault" alignment="3" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="cmCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmCancelActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="cmOk">
<Properties>
<Property name="text" type="java.lang.String" value="Ok"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="cmDefault">
<Properties>
<Property name="text" type="java.lang.String" value="Save as Default"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmDefaultActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;this.cmDefault.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane5">
<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.JTable" name="jTable1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="15" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.table.DefaultTableModel(&#xa; new Object [][] {&#xa;&#xa; },&#xa; new String [] {&#xa; &quot;Select&quot;, &quot;Start&quot;, &quot;Time&quot;, &quot;Device Name&quot;, &quot;Device Description&quot;, &quot;Test Suite&quot;, &quot;Test Name&quot;, &quot;Test Peth&quot;, &quot;Test Parameters&quot;, &quot;Test Description&quot;, &quot;Test Help&quot;, &quot;Last Test Result&quot;, &quot;Status&quot;, &quot;&quot;&#xa; }&#xa;) {&#xa; Class[] types = new Class [] {&#xa; java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class&#xa; };&#xa; boolean[] canEdit = new boolean [] {&#xa; true, true, false, false, false, false, false, false, false, false, false, false, false, false&#xa; };&#xa;&#xa; public Class getColumnClass(int columnIndex) {&#xa; return types [columnIndex];&#xa; }&#xa;&#xa; public boolean isCellEditable(int rowIndex, int columnIndex) {&#xa; return canEdit [columnIndex];&#xa; }&#xa;}" type="code"/>
</Property>
<Property name="dragEnabled" type="boolean" value="true"/>
<Property name="dropMode" type="javax.swing.DropMode" editor="org.netbeans.modules.form.editors.EnumEditor">
<Value id="INSERT"/>
</Property>
<Property name="rowHeight" type="int" value="22"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jTable1MouseClicked"/>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jTable1KeyReleased"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -0,0 +1,192 @@
/*
* Copyright (c) 2015 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.utils.swing.SwingUtils;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.apache.commons.io.FilenameUtils;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author boccioli_m
*/
public class EditTestingList extends javax.swing.JPanel {
/**
* Creates new form TestingListDetails
*/
public EditTestingList() {
initComponents();
}
public EditTestingList(TableModel hDetails) {
initComponents();
fillComponents(hDetails);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
cmCancel = new javax.swing.JButton();
cmOk = new javax.swing.JButton();
cmDefault = new javax.swing.JButton();
jScrollPane5 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
cmCancel.setText("Cancel");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
cmCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmCancelActionPerformed(evt);
}
});
cmOk.setText("Ok");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
cmDefault.setText("Save as Default");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
this.cmDefault.setVisible(false);
cmDefault.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmDefaultActionPerformed(evt);
}
});
jTable1.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Select", "Start", "Time", "Device Name", "Device Description", "Test Suite", "Test Name", "Test Peth", "Test Parameters", "Test Description", "Test Help", "Last Test Result", "Status", ""
}
) {
Class[] types = new Class [] {
java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class
};
boolean[] canEdit = new boolean [] {
true, true, false, false, false, false, false, false, false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setDragEnabled(true);
jTable1.setDropMode(javax.swing.DropMode.INSERT);
jTable1.setRowHeight(22);
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTable1KeyReleased(evt);
}
});
jScrollPane5.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(cmDefault, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(180, 180, 180)
.addComponent(cmOk, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cmCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane5))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 547, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cmCancel)
.addComponent(cmOk)
.addComponent(cmDefault)))
);
}// </editor-fold>//GEN-END:initComponents
private void fillComponents(TableModel hDetails) {
jTable1.setModel(hDetails);
}
private void cmCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmCancelActionPerformed
}//GEN-LAST:event_cmCancelActionPerformed
private void cmDefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmDefaultActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cmDefaultActionPerformed
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
if (this.jTable1.isEnabled()) {
try {
switch (evt.getClickCount()) {
case 1:
break;
case 2:
break;
}
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}
}//GEN-LAST:event_jTable1MouseClicked
private void jTable1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyReleased
}//GEN-LAST:event_jTable1KeyReleased
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cmCancel;
private javax.swing.JButton cmDefault;
private javax.swing.JButton cmOk;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}

View File

@@ -163,6 +163,19 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="+"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Before"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">

View File

@@ -335,6 +335,7 @@ public class TestingList extends Panel {
jButtonOpenLog = new javax.swing.JButton();
jButtonOpen = new javax.swing.JButton();
jButtonSave = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jCheckBox1 = new javax.swing.JCheckBox();
jButtonMoveDown = new javax.swing.JButton();
@@ -432,6 +433,14 @@ public class TestingList extends Panel {
});
jPanel3.add(jButtonSave, java.awt.BorderLayout.LINE_END);
jButton1.setText("+");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel3.add(jButton1, java.awt.BorderLayout.LINE_START);
jPanel1.add(jPanel3, java.awt.BorderLayout.EAST);
jPanel2.setLayout(new java.awt.BorderLayout());
@@ -588,8 +597,17 @@ public class TestingList extends Panel {
saveSettings();
}//GEN-LAST:event_jButtonSaveActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
openListEditor();
} catch (Exception ex) {
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
//<editor-fold defaultstate="collapsed" desc="Witget Variables declaration">
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButtonMoveDown;
private javax.swing.JButton jButtonMoveUp;
private javax.swing.JButton jButtonOpen;
@@ -684,6 +702,48 @@ public class TestingList extends Panel {
dlg.setVisible(true);
}
/**
* open details of the selected row in a new panel
*
* @throws exception
*/
private void openListEditor() throws Exception {
//pick details from the clicked row
/* int row = jTable1.getSelectedRow();
String sDeviceName = jTable1.getValueAt(row, COL.DEVICENAME.ordinal()).toString();
String sTestName = jTable1.getValueAt(row, COL.TESTNAME.ordinal()).toString();
String sTestPath = String.valueOf(jTable1.getValueAt(row, COL.TESTPATH.ordinal()));
String sTestCaseName = jTable1.getValueAt(row, COL.TESTSUITE.ordinal()).toString();
String sTestDescription = jTable1.getValueAt(row, COL.TESTDESCR.ordinal()).toString();
String sDeviceDescription = jTable1.getValueAt(row, COL.DEVICEDESCR.ordinal()).toString();
String sLastResult = jTable1.getValueAt(row, COL.RESULT.ordinal()).toString();
String sResultTime = jTable1.getValueAt(row, COL.TIME.ordinal()).toString();
String sTestHelp = String.valueOf(jTable1.getValueAt(row, COL.TESTHELP.ordinal()));
HashMap mParameters = getTestParameters(sTestPath);
//create map for passing details to Details Panel
HashMap details = new HashMap();
details.put("deviceName", sDeviceName);
details.put("deviceDescription", sDeviceDescription);
details.put("testDescription", sTestDescription);
details.put("testSuite", sTestCaseName);
details.put("testName", sTestName);
details.put("testResult", sLastResult);
details.put("time", sResultTime);
details.put("parameters", mParameters);
details.put("testHelp", sTestHelp);
details.put("testPath", sTestPath);
*/ //open details panel
JDialog dlg = new JDialog(getView(), "Add/remove tests", true);
//create a class to visualise the details panel
Class editTestingListClass = getController().getClassByName("EditTestingList");
JPanel detailsPanel = (JPanel) editTestingListClass.getConstructor(new Class[]{HashMap.class}).newInstance(jTable1.getModel());
dlg.getContentPane().add(detailsPanel);
//dlg.add(new TestingListDetails());
dlg.pack();
dlg.setVisible(true);
}
/**
* put the test result in table
*