Closedown
This commit is contained in:
192
plugins/EditTestingList.java
Normal file
192
plugins/EditTestingList.java
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user