Closedown
This commit is contained in:
@@ -18,9 +18,14 @@ import javax.swing.JPanel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
import javax.swing.JDialog;
|
||||
@@ -278,6 +283,8 @@ public class TestingList extends Panel {
|
||||
jCheckBox1 = new javax.swing.JCheckBox();
|
||||
jButtonMoveDown = new javax.swing.JButton();
|
||||
jButtonMoveUp = new javax.swing.JButton();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
@@ -387,6 +394,22 @@ public class TestingList extends Panel {
|
||||
});
|
||||
jPanel2.add(jButtonMoveUp, java.awt.BorderLayout.PAGE_START);
|
||||
|
||||
jButton1.setText("jButton1");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel2.add(jButton1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jButton2.setText("jButton2");
|
||||
jButton2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel2.add(jButton2, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
jPanel1.add(jPanel2, java.awt.BorderLayout.LINE_START);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.NORTH);
|
||||
@@ -483,8 +506,20 @@ public class TestingList extends Panel {
|
||||
moveUp();
|
||||
}//GEN-LAST:event_jButtonMoveUpActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
this.saveSettings();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
this.loadSettings();
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
//<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 jButton2;
|
||||
private javax.swing.JButton jButtonMoveDown;
|
||||
private javax.swing.JButton jButtonMoveUp;
|
||||
private javax.swing.JButton jButtonOpenLog;
|
||||
@@ -523,11 +558,11 @@ public class TestingList extends Panel {
|
||||
|
||||
//open details of the selected test in a new panel
|
||||
private void openDetails() 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();
|
||||
@@ -546,6 +581,7 @@ public class TestingList extends Panel {
|
||||
details.put("time", sResultTime);
|
||||
details.put("parameters", mParameters);
|
||||
details.put("testHelp", sTestHelp);
|
||||
details.put("testPath", sTestPath);
|
||||
//open details panel
|
||||
JDialog dlg = new JDialog(getView(), "Test Details - " + sTestName , true);
|
||||
//create a class to visualise the details panel
|
||||
@@ -736,7 +772,7 @@ public class TestingList extends Panel {
|
||||
/**
|
||||
*table management
|
||||
*/
|
||||
public void buildTable() {
|
||||
private void buildTable() {
|
||||
String sDate = getNow();
|
||||
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
|
||||
jTable1.setModel(model);
|
||||
@@ -744,17 +780,19 @@ public class TestingList extends Panel {
|
||||
jTable1.getColumnModel().getColumn(COL.CHECK.ordinal()).setMaxWidth(27);
|
||||
jTable1.getColumnModel().getColumn(COL.DEVICENAME.ordinal()).setPreferredWidth(30);
|
||||
jTable1.getColumnModel().getColumn(COL.STATUS.ordinal()).setPreferredWidth(30);
|
||||
jTable1.getColumnModel().getColumn(COL.DEVICEDESCR.ordinal()).setMinWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.DEVICEDESCR.ordinal()).setMaxWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTPATH.ordinal()).setMinWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTPATH.ordinal()).setMaxWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTDESCR.ordinal()).setMinWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTDESCR.ordinal()).setMaxWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTPARAMS.ordinal()).setMinWidth(0);
|
||||
jTable1.getColumnModel().getColumn(COL.TESTPARAMS.ordinal()).setMaxWidth(0);
|
||||
hideColumn(COL.DEVICEDESCR);
|
||||
hideColumn(COL.TESTPATH);
|
||||
hideColumn(COL.TESTDESCR);
|
||||
hideColumn(COL.TESTPARAMS);
|
||||
hideColumn(COL.TESTHELP);
|
||||
jTable1.setAutoCreateRowSorter(true);
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void hideColumn(COL column){
|
||||
jTable1.getColumnModel().getColumn(column.ordinal()).setMinWidth(0);
|
||||
jTable1.getColumnModel().getColumn(column.ordinal()).setMaxWidth(0);
|
||||
}
|
||||
|
||||
//append test info to table
|
||||
private void addToTable(String deviceName,
|
||||
@@ -898,7 +936,59 @@ public class TestingList extends Panel {
|
||||
System.out.println("Open command cancelled by user.");
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSettings() {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
|
||||
int returnVal = fc.showOpenDialog(NetbeansPluginPanel.this);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
saveSettings(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSettings(File file) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel();
|
||||
try {
|
||||
ObjectOutputStream out = new ObjectOutputStream(
|
||||
new FileOutputStream(file));
|
||||
out.writeObject(tableModel.getDataVector());
|
||||
out.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
final JFileChooser fc = new JFileChooser();
|
||||
int returnVal = fc.showOpenDialog(NetbeansPluginPanel.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
loadSettings(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSettings(File file) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel();
|
||||
try {
|
||||
ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
|
||||
Vector rowData = (Vector)in.readObject();
|
||||
Iterator itr = rowData.iterator();
|
||||
for (int row = 0 ; row < jTable1.getRowCount() ; row++){
|
||||
tableModel.removeRow(row);
|
||||
}
|
||||
while(itr.hasNext()) {
|
||||
tableModel.addRow((Vector) itr.next());
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SwingUtils.showMessage(this, "getTestInProgress()", ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user