/** 删除 */ private void processDeleteEvent() { int index = timeTable.getSelectedRow(); if (index == -1) return; JTimeTableModel model = (JTimeTableModel) timeTable.getModel(); if (index < model.timeList.size()) model.timeList.removeElementAt(index); timeTable.updateUI(); }
/** 增加 */ private void processAddEvent() { Frame frame = JActiveDComDM.MainApplication.MainWindow; JManageCTimeDialog ctimeDlg; ctimeDlg = new JManageCTimeDialog(frame, "添加时间方案", true); ctimeDlg.setSize(480, 310); ctimeDlg.setMinimumSize(480, 310); ctimeDlg.CenterWindow(); ctimeDlg.setVisible(true); if (ctimeDlg.OPTION == ctimeDlg.OPTION_OK) { int index = timeTable.getRowCount(); timeTable.getModel().setValueAt(ctimeDlg.getCTimeObject(), index, 0); timeTable.updateUI(); } }
/** 编辑 */ private void processEditEvent() { int count = timeTable.getModel().getRowCount(); if (count == 0) return; int index = timeTable.getSelectedRow(); if (index < 0) return; JTimeTableModel model = (JTimeTableModel) timeTable.getModel(); JCTimeObject obj = (JCTimeObject) model.timeList.get(index); Frame frame = JActiveDComDM.MainApplication.MainWindow; JManageCTimeDialog actionDlg; actionDlg = new JManageCTimeDialog(frame, "编辑时间方案", true); actionDlg.setSize(480, 310); actionDlg.CenterWindow(); actionDlg.setCTimeObject(obj); actionDlg.setVisible(true); if (actionDlg.OPTION == actionDlg.OPTION_OK) { timeTable.getModel().setValueAt(actionDlg.getCTimeObject(), index, 0); timeTable.updateUI(); } }