1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
public void launch(int launchType,Object parameters) {
if(launchType == 0) {
this.jButton2.setEnabled(false);
ArrayList<String> list = (ArrayList<String>)Controller.getInstance().getGlobalVariable("ListConnectedObjectA");
if(list.size() > 0) {
this.currentEquipment = list.get(0);
} else {
this.currentEquipment = "";
}
EquipmentListModel elm = new EquipmentListModel(list);
this.jList1.setModel(elm);
this.listListenner = new ListListenner("list",this,this.jList1);
this.jList1.addListSelectionListener(this.listListenner);
this.jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.LoadXmls();
ArrayList<ArrayList<String>> data = new ArrayList<ArrayList<String>>();
String [] column = new String[]{"Xml Name","Select","Status","View report"};
jTable1.setModel(new Result1Model(data, column));
this.mod = 0;
TableColumnModel myColumnModel = this.jTable1.getColumnModel();
TableColumn Column = myColumnModel.getColumn(1);
this.checkBox = new JCheckBox();
//this.chec
Column.setCellRenderer(new CheckBoxRender(this.checkBox));
Column = myColumnModel.getColumn(0);
Column.setCellRenderer(new FileRender());
Column = myColumnModel.getColumn(3);
Column.setCellRenderer(new ButtonRender("ViewReport","View Report"));
// Select Column 2 & appliquer un success renderer
Column = myColumnModel.getColumn(2);
Column.setCellRenderer(new SuccessRender());
this.jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.jTable1.setAutoscrolls(false);
this.jTable1.setShowGrid(false);
this.jTable1.setDragEnabled(false);
this.tableListenner = new TableListenner("Row",this,this,this.jTable1);
this.tableListenner.set(jButton2);
//this.jTable1.getSelectionModel().addListSelectionListener(this.tableListenner);
this.jTable1.addMouseListener(this.tableListenner);
Result1Model rm = (Result1Model)this.jTable1.getModel();
ArrayList<Object> row;
int i = 0;
File f;
for(String xml : this.XmlList.get(this.currentEquipment).keySet()) {
row = new ArrayList<Object>();
row.add(xml);
row.add("NOK");
row.add("");
row.add("");
rm.insertLine(i,row);
i++;
}
this.jLabel3.setText("Select the xml files of the equipment " + this.currentEquipment);
} else {
if(launchType == 1) {
} else {
if(launchType == 3) {
this.jList1.addListSelectionListener(this.listListenner);
this.jTable1.addMouseListener(this.tableListenner);
ArrayList<String> list = (ArrayList<String>)Controller.getInstance().getGlobalVariable("ListConnectedObjectA");
if(list.size() > 0) {
this.currentEquipment = list.get(0);
} else {
this.currentEquipment = "";
}
EquipmentListModel elm = new EquipmentListModel(list);
this.jList1.setModel(elm);
this.mod = 3;
HashMap<String,HashMap<String,Boolean>> res = (HashMap<String,HashMap<String,Boolean>>)Controller.getInstance().getGlobalVariable("ListloadedXml");
for(String equi : res.keySet()) {
for(String xml : res.get(equi).keySet()) {
if(this.XmlListSelected.get(equi).get(xml)) {
this.XmlList.get(equi).put(xml,res.get(equi).get(xml));
}
}
}
this.changeEquipment(this.currentEquipment);
// We indicate that it's the End of XML Loading
endOfXmlLoad = "OK";
Controller.getInstance().setGlobalVariable("endofXmlLoad", endOfXmlLoad);
// We test if we can enable auditButton (See More detail in this function)
boolean enAuditButton = this.enableAuditButton();
// this.jTable1.getSelectionModel().addListSelectionListener(this.tableListenner);
if( enAuditButton==true && ((GlobalTreatment)Controller.getInstance().getProcess()).getNumTreatment() > 0) {
this.jButton2.setEnabled(true);
} else {
this.jButton2.setEnabled(false);
}
}
}
}
} |
Partager