00001
00002
00003
00004
00005
00006
00007 package DisplayGUI;
00008 import javax.swing.JTable;
00009 import javax.swing.event.*;
00010 import javax.swing.table.TableModel;
00011 import javax.swing.ListSelectionModel;
00012 import java.util.Vector;
00017 public class ResultsTable extends GuiTable implements TableModelListener {
00018
00019
00020
00021 public ResultsTable(gui parent) {
00022 super(parent);
00023 guiControl=parent;
00024 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
00025 table.addMouseListener(new tablesMouseAdapter());
00026
00027 }
00028
00029 public Vector getISTableList(ModuleCell thisCell) {
00030
00031 Vector theLine;
00032 java.util.SortedMap m = new java.util.TreeMap();
00033
00034 TestSelection testSelection = guiControl.tablesDisplayPane.indexTable.getTestSelection();
00035
00036 if(thisCell!=null && testSelection!=null && testSelection.getRunScanRegex()!=null) {
00037 String thisSN = thisCell.getSerialNo();
00038 java.util.List isList = (java.util.List)guiControl.isInterface.isCounter.getModuleList(guiControl.selectorPane.getDisplayParameterIndex(),testSelection.getRunScanRegex(),thisSN,testSelection.isRetrievedData());
00039 if(isList==null) objectNames = new Vector();
00040 else {
00041 objectNames = new Vector(isList);
00042 for(int i=0;i<objectNames.size();i++) {
00043 String[] objectParts = ((String)objectNames.elementAt(i)).split("\\.");
00044 theLine = new Vector();
00045 String sn = objectParts[4];
00046 Integer runNo = Integer.valueOf(objectParts[2]);
00047 Integer scanNo = Integer.valueOf(objectParts[3]);
00048 String fname = objectParts[1];
00049 theLine.add(sn);
00050 theLine.add(runNo);
00051 theLine.add(scanNo);
00052 theLine.add(fname);
00053 m.put(new Integer(runNo.intValue()*10000 + scanNo.intValue()),theLine);
00054 }
00055 }
00056 }
00057 Vector tableContents = new Vector(m.values());
00058 theLine=new Vector();
00059 theLine.addElement("Serial No");
00060 theLine.addElement("Run No");
00061 theLine.addElement("Scan No");
00062 theLine.addElement("Data");
00063 tableContents.insertElementAt(theLine,0);
00064 return tableContents;
00065 }
00066
00067 class tablesMouseAdapter extends java.awt.event.MouseAdapter {
00068 public void mouseClicked(java.awt.event.MouseEvent e) {
00069 switch(e.getModifiers()) {
00070 case java.awt.event.InputEvent.BUTTON2_MASK:
00071 case java.awt.event.InputEvent.BUTTON3_MASK:
00072 int rowSelect = table.rowAtPoint(new java.awt.Point(e.getX(),e.getY()));
00073 rowSM.setSelectionInterval(rowSelect,rowSelect);
00074 if(rowSelect<0) return;
00075 String sn = (String)resultTable.getValueAt(rowSelect,0);
00076 if(sn.matches("\\d{14}")) guiControl.displayPane.setLastClickedCell(sn);
00077 else System.out.println("SctGUI::TablesDisplayPane - invalid serial no "+sn);
00078
00079 guiControl.menuActions.showTablesPopupMenu(1,e);
00080 break;
00081 default:
00082 }
00083 }
00084 }
00085
00086 }