use of com.salaboy.jbpm5.dev.guide.tablemodel.TaskSummariesModel in project jBPM5-Developer-Guide by Salaboy.
the class TasksListUI method selectTaskForm.
//GEN-LAST:event_refreshjButtonActionPerformed
private void selectTaskForm(JTable target, int row) {
long taskId = ((TaskSummariesModel) target.getModel()).getTaskId(row);
String taskName = ((TaskSummariesModel) target.getModel()).getTaskName(row);
String selectedUser = (String) selectedUserjComboBox.getItemAt(selectedUserjComboBox.getSelectedIndex());
System.out.println("Selected User: " + selectedUser);
Class clazz = taskForms.get(taskName);
if (clazz == null) {
//no custom form for this task. Let's see if there is a default
//form defined.
clazz = taskForms.get("*");
if (clazz == null) {
JOptionPane.showMessageDialog(this, "No form defined for '" + taskName + " and not default (*) form is configured.", "Error", JOptionPane.ERROR_MESSAGE);
}
}
Constructor constructor = null;
try {
constructor = clazz.getConstructor(LocalTaskService.class, long.class, String.class);
} catch (NoSuchMethodException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
}
JPanel taskForm = null;
try {
taskForm = (JPanel) constructor.newInstance(localTaskService, taskId, selectedUser);
} catch (InstantiationException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvocationTargetException ex) {
Logger.getLogger(TasksListUI.class.getName()).log(Level.SEVERE, null, ex);
}
//new MyTaskFormJPanel(localTaskService, taskId, selectedUser);
tasklistsjTabbedPane.add(taskForm);
tasklistsjTabbedPane.setSelectedComponent(taskForm);
openedTaskForms.put(taskId, taskForm);
}
Aggregations