From: Christian G. [M. Mitch] <mas...@us...> - 2002-01-25 17:54:44
|
Update of /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer In directory usw-pr-cvs1:/tmp/cvs-serv11780/de/cgarbs/apps/jprojecttimer Modified Files: TaskEditDialog.java TaskListPane.java Log Message: When you add a new task, cancelling the dialog adds no task to the list any more. Index: TaskEditDialog.java =================================================================== RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskEditDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TaskEditDialog.java 2002/01/25 17:34:22 1.3 --- TaskEditDialog.java 2002/01/25 17:54:41 1.4 *************** *** 40,57 **** final static String CANCEL_BUTTON = "cancel"; ! TaskEditDialog(JFrame owner, TaskList tasks, int index) { super(owner, Resource.get("editTaskDialogTitle"), true); ! t = (Task) tasks.elementAt(index); this.tasks = tasks; Vector showedList = new Vector(tasks); ! showedList.removeElementAt(index); list = new JList(showedList); list.setPrototypeCellValue("ABCDEFGHIJKLMNOPQRST"); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ! for (Enumeration e = ((Task) tasks.elementAt(index)).getDependencies().elements(); e.hasMoreElements(); ) { int i = tasks.indexOf(e.nextElement()); list.addSelectionInterval(i,i); --- 40,57 ---- final static String CANCEL_BUTTON = "cancel"; ! TaskEditDialog(JFrame owner, TaskList tasks, Task t) { super(owner, Resource.get("editTaskDialogTitle"), true); ! this.t = t; this.tasks = tasks; Vector showedList = new Vector(tasks); ! showedList.removeElement(t); list = new JList(showedList); list.setPrototypeCellValue("ABCDEFGHIJKLMNOPQRST"); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ! for (Enumeration e = t.getDependencies().elements(); e.hasMoreElements(); ) { int i = tasks.indexOf(e.nextElement()); list.addSelectionInterval(i,i); Index: TaskListPane.java =================================================================== RCS file: /cvsroot/jprojecttimer/jprojecttimer/de/cgarbs/apps/jprojecttimer/TaskListPane.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TaskListPane.java 2002/01/20 13:09:34 1.4 --- TaskListPane.java 2002/01/25 17:54:41 1.5 *************** *** 109,114 **** if (e.getActionCommand().equals(NEW_BUTTON)) { ! int row = tasks.size(); ! TaskList dependencies = new TaskList(); if (! tasks.isEmpty()) { --- 109,114 ---- if (e.getActionCommand().equals(NEW_BUTTON)) { ! // Perhaps we should automatically depend on the currently ! // selected Task instead of the last Task in the list? TaskList dependencies = new TaskList(); if (! tasks.isEmpty()) { *************** *** 116,124 **** } Task t = new Task (dependencies); - tasks.addElement(t); ! new TaskEditDialog(gui, tasks, row); - model.fireTableRowsInserted(row, row); } else if (e.getActionCommand().equals(EDIT_BUTTON)) { --- 116,129 ---- } Task t = new Task (dependencies); ! t.calculate(); // mustn't be dirty ! System.out.println("before " + t.isDirty()); ! new TaskEditDialog(gui, tasks, t); ! System.out.println("after " + t.isDirty()); ! if (t.isDirty()) { ! tasks.addElement(t); ! model.fireTableRowsInserted(tasks.size()-1, tasks.size()-1); ! } } else if (e.getActionCommand().equals(EDIT_BUTTON)) { *************** *** 126,130 **** int row = table.getSelectedRow(); if (row > -1) { ! new TaskEditDialog(gui, tasks, row); model.fireTableRowsUpdated(row, row); } --- 131,135 ---- int row = table.getSelectedRow(); if (row > -1) { ! new TaskEditDialog(gui, tasks, (Task) tasks.elementAt(row)); model.fireTableRowsUpdated(row, row); } |