#33753: Would like better ordering capabilities BLD200409270901
authorlebedkov@netbeans.org
Sat, 25 Sep 2004 19:41:27 +0000
changeset 5276673bf3df1c8b
parent 5275 ffb7d2781ea4
child 5277 f0670d6be95f
#33753: Would like better ordering capabilities
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/Bundle.properties
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskNode.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskView.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTasksTreeTable.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/Bundle.properties
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ClearCompletedAction.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveDownAction.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveUpAction.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/NewTaskAction.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/mf-layer.xml
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalExportFormat.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalImportFormat.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/XmlExportFormat.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/AdvancedTreeTableNode.java
tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/TreeTable.java
tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/IcsNode.java
tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/TestTable.java
tasklist.usertasks/test/qa-functional/testCases.html
     1.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/Bundle.properties	Fri Sep 24 16:22:13 2004 +0000
     1.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/Bundle.properties	Sat Sep 25 19:41:27 2004 +0000
     1.3 @@ -16,7 +16,7 @@
     1.4  # So if you're going to translate -- you may want to wait.
     1.5  #
     1.6  
     1.7 -
     1.8 +## manifest.mf
     1.9  OpenIDE-Module-Name=User Tasks
    1.10  OpenIDE-Module-Display-Category=Task List
    1.11  OpenIDE-Module-Short-Description=This module helps you track your tasks
    1.12 @@ -92,8 +92,6 @@
    1.13  
    1.14  DueSummary=DUE SOON: {0}
    1.15  PastDueSummary=PAST DUE: {0}
    1.16 -HINT_due_task=Tasks Due
    1.17 -LONGHINT_due_task=Identifies user tasks due within the next 36 hours - typically today or tomorrow.
    1.18  DueLabel=Due:
    1.19  
    1.20  SelectDateLabel=Select date
    1.21 @@ -167,6 +165,12 @@
    1.22  HNT_spentTimeProperty=Time spent for this task
    1.23  LBL_effortProperty=Effort
    1.24  HNT_effortProperty=Effort
    1.25 +LBL_computeProgress=Compute Progress
    1.26 +HNT_progressComputed=Should the progress be computed automatically
    1.27 +LBL_computeEffort=Compute Effort
    1.28 +HNT_effortComputed=Should the effort be computed automatically
    1.29 +LBL_spentTimeComputed=Compute Spent Time
    1.30 +HNT_spentTimeComputed=Should the spent time be computed automatically
    1.31  EffortFormat={0,choice,0#|1#1 day|1<{0} days}{1,choice,0#|1# 1 hour|1< {1} hours}{2,choice,0#|1# 1 minute|1< {2} minutes}
    1.32  
    1.33  ## UserTaskListNode
    1.34 @@ -176,4 +180,20 @@
    1.35  ## UserTaskTransfer
    1.36  LBL_todo_flavor=Tasks
    1.37  
    1.38 +## UserTasksTreeTableModel
    1.39 +ColumnEffort=Effort
    1.40 +ColumnSummary=Summary
    1.41 +ColumnPriority=Priority
    1.42 +ColumnDone=Done
    1.43 +ColumnPercentComplete=Percent Complete
    1.44 +ColumnRemEffort=Rem. Effort
    1.45 +ColumnSpentTime=Spent Time
    1.46 +ColumnDetails=Details
    1.47 +ColumnFile=File
    1.48 +ColumnLine=Line
    1.49 +ColumnCategory=Category
    1.50 +ColumnCreated=Created
    1.51 +ColumnEdited=Edited
    1.52 +ColumnDue=Due
    1.53  
    1.54 +
     2.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskNode.java	Fri Sep 24 16:22:13 2004 +0000
     2.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskNode.java	Sat Sep 25 19:41:27 2004 +0000
     2.3 @@ -34,6 +34,8 @@
     2.4  import org.netbeans.modules.tasklist.usertasks.actions.CollapseAllAction;
     2.5  import org.netbeans.modules.tasklist.usertasks.actions.ExpandAllUserTasksAction;
     2.6  import org.netbeans.modules.tasklist.usertasks.actions.GoToUserTaskAction;
     2.7 +import org.netbeans.modules.tasklist.usertasks.actions.MoveDownAction;
     2.8 +import org.netbeans.modules.tasklist.usertasks.actions.MoveUpAction;
     2.9  import org.netbeans.modules.tasklist.usertasks.actions.NewTaskAction;
    2.10  import org.netbeans.modules.tasklist.usertasks.actions.NewTaskListAction;
    2.11  import org.netbeans.modules.tasklist.usertasks.actions.PauseAction;
    2.12 @@ -46,6 +48,7 @@
    2.13  import org.netbeans.modules.tasklist.usertasks.editors.DurationPropertyEditor;
    2.14  import org.netbeans.modules.tasklist.usertasks.editors.PercentsPropertyEditor;
    2.15  import org.netbeans.modules.tasklist.usertasks.filter.FilterUserTaskAction;
    2.16 +import org.netbeans.modules.tasklist.usertasks.filter.RemoveFilterUserTaskAction;
    2.17  import org.netbeans.modules.tasklist.usertasks.treetable.AdvancedTreeTableNode;
    2.18  import org.openide.ErrorManager;
    2.19  import org.openide.actions.CopyAction;
    2.20 @@ -95,7 +98,7 @@
    2.21                  UserTaskNode.this.firePropertyChange(e.getPropertyName(),
    2.22                      e.getOldValue(), e.getNewValue());
    2.23                  String n = e.getPropertyName();
    2.24 -                if (n == "started" || n == "spentTimeComputed") {
    2.25 +                if (n == "started" || n == "spentTimeComputed") { // NOI18N
    2.26                      fireCookieChange();
    2.27                  }
    2.28              }
    2.29 @@ -111,9 +114,6 @@
    2.30      
    2.31      protected void updateIcon() {
    2.32          UserTask uitem = (UserTask)item;
    2.33 -        if (uitem.getIcon() != null) {
    2.34 -            return;
    2.35 -        }
    2.36          if (uitem.isDone()) {
    2.37              setIconBase("org/netbeans/modules/tasklist/core/doneItem"); // NOI18N
    2.38          } else {
    2.39 @@ -138,7 +138,12 @@
    2.40              null,
    2.41              SystemAction.get(DeleteAction.class),
    2.42              null,
    2.43 +            SystemAction.get(MoveUpAction.class),
    2.44 +            SystemAction.get(MoveDownAction.class),
    2.45 +            null,
    2.46              SystemAction.get(FilterUserTaskAction.class),
    2.47 +            SystemAction.get(RemoveFilterUserTaskAction.class),
    2.48 +            null,
    2.49              SystemAction.get(PurgeTasksAction.class),
    2.50              SystemAction.get(ClearCompletedAction.class),
    2.51              null,
    2.52 @@ -215,47 +220,47 @@
    2.53              
    2.54              p = new PropertySupport.Reflection(item, Boolean.TYPE, 
    2.55                  "isProgressComputed", "setProgressComputed"); // NOI18N
    2.56 -            p.setName("progressComputed");
    2.57 -            p.setDisplayName("Compute Progress"); // TODO: i18n
    2.58 -            p.setShortDescription("Should the progress be computed automatically"); // TODO: i18n
    2.59 +            p.setName("progressComputed"); // NOI18N
    2.60 +            p.setDisplayName(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "LBL_computeProgress")); // NOI18N
    2.61 +            p.setShortDescription(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "HNT_progressComputed")); // NOI18N
    2.62              ss.put(p);
    2.63              
    2.64 -            p = new PropertySupport.Reflection(item, Integer.TYPE, "getEffort", null);
    2.65 -            p.setName("effort");
    2.66 +            p = new PropertySupport.Reflection(item, Integer.TYPE, "getEffort", null); // NOI18N
    2.67 +            p.setName("effort"); // NOI18N
    2.68              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_effortProperty")); // NOI18N
    2.69              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_effortProperty")); // NOI18N
    2.70 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
    2.71 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
    2.72              p.setPropertyEditorClass(DurationPropertyEditor.class);
    2.73              ss.put(p);
    2.74  
    2.75              p = new PropertySupport.Reflection(item, Boolean.TYPE, 
    2.76                  "isEffortComputed", "setEffortComputed"); // NOI18N
    2.77 -            p.setName("effortComputed");
    2.78 -            p.setDisplayName("Compute Effort"); // TODO: i18n
    2.79 -            p.setShortDescription("Should the effort be computed automatically"); // TODO: i18n
    2.80 +            p.setName("effortComputed"); // NOI18N
    2.81 +            p.setDisplayName(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "LBL_computeEffort")); // NOI18N
    2.82 +            p.setShortDescription(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "HNT_effortComputed")); // NOI18N
    2.83              ss.put(p);
    2.84              
    2.85 -            p = new PropertySupport.Reflection(item, Integer.TYPE, "getRemainingEffort", null);
    2.86 -            p.setName("remainingEffort");
    2.87 +            p = new PropertySupport.Reflection(item, Integer.TYPE, "getRemainingEffort", null); // NOI18N
    2.88 +            p.setName("remainingEffort"); // NOI18N
    2.89              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_remainingEffortProperty")); // NOI18N
    2.90              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_remainingEffortProperty")); // NOI18N
    2.91 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
    2.92 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
    2.93              p.setPropertyEditorClass(DurationPropertyEditor.class);
    2.94              ss.put(p);
    2.95  
    2.96 -            p = new PropertySupport.Reflection(item, Integer.TYPE, "getSpentTime", null);
    2.97 -            p.setName("spentTime");
    2.98 +            p = new PropertySupport.Reflection(item, Integer.TYPE, "getSpentTime", null); // NOI18N
    2.99 +            p.setName("spentTime"); // NOI18N
   2.100              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_spentTimeProperty")); // NOI18N
   2.101              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_spentTimeProperty")); // NOI18N
   2.102 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
   2.103 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
   2.104              p.setPropertyEditorClass(DurationPropertyEditor.class);
   2.105              ss.put(p);
   2.106  
   2.107              p = new PropertySupport.Reflection(item, Boolean.TYPE, 
   2.108                  "isSpentTimeComputed", "setSpentTimeComputed"); // NOI18N
   2.109 -            p.setName("spentTimeComputed");
   2.110 -            p.setDisplayName("Compute Spent Time"); // TODO: i18n
   2.111 -            p.setShortDescription("Should the spent time be computed automatically"); // TODO: i18n
   2.112 +            p.setName("spentTimeComputed"); // NOI18N
   2.113 +            p.setDisplayName(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "LBL_spentTimeComputed")); // NOI18N
   2.114 +            p.setShortDescription(org.openide.util.NbBundle.getMessage(UserTaskNode.class, "HNT_spentTimeComputed")); // NOI18N
   2.115              ss.put(p);
   2.116              
   2.117              p = new PropertySupport.Reflection(item, String.class, "getDetails", "setDetails"); // NOI18N
   2.118 @@ -268,7 +273,7 @@
   2.119              p.setName(UserTaskView.PROP_TASK_FILE);
   2.120              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_filenameProperty")); // NOI18N
   2.121              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_filenameProperty")); // NOI18N
   2.122 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
   2.123 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
   2.124              ss.put(p);
   2.125  
   2.126              p = new PropertySupport.Reflection(item, Integer.TYPE, "getLineNumber", "setLineNumber"); // NOI18N
   2.127 @@ -282,7 +287,7 @@
   2.128              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_categoryProperty")); // NOI18N
   2.129              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_categoryProperty")); // NOI18N
   2.130              p.setValue("canEditAsText", Boolean.TRUE); // NOI18N
   2.131 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
   2.132 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
   2.133              ss.put(p);
   2.134  
   2.135              p = new PropertySupport.Reflection(item, Date.class, "getCreatedDate", null); // NOI18N
   2.136 @@ -290,7 +295,7 @@
   2.137              p.setName(UserTaskView.PROP_TASK_CREATED);
   2.138              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_createdProperty")); // NOI18N
   2.139              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_createdProperty")); // NOI18N
   2.140 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
   2.141 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
   2.142              ss.put(p);
   2.143  
   2.144              p = new PropertySupport.Reflection(item, Date.class, "getLastEditedDate", null); // NOI18N
   2.145 @@ -298,7 +303,7 @@
   2.146              p.setName(UserTaskView.PROP_TASK_EDITED);
   2.147              p.setDisplayName(NbBundle.getMessage(UserTaskNode.class, "LBL_editedProperty")); // NOI18N
   2.148              p.setShortDescription(NbBundle.getMessage(UserTaskNode.class, "HNT_editedProperty")); // NOI18N
   2.149 -            p.setValue("suppressCustomEditor", Boolean.TRUE);
   2.150 +            p.setValue("suppressCustomEditor", Boolean.TRUE); // NOI18N
   2.151              ss.put(p);
   2.152  
   2.153              p = new PropertySupport.Reflection(item, Date.class, "getDueDate", "setDueDate"); // NOI18N            
   2.154 @@ -357,7 +362,7 @@
   2.155       */
   2.156      public static PasteType createTodoPasteType(
   2.157      UserTaskNode target, Transferable t) {
   2.158 -        UTUtils.LOGGER.fine("entering");
   2.159 +        // UTUtils.LOGGER.fine("entering");
   2.160          if (t.isDataFlavorSupported(ExTransferable.multiFlavor)) {
   2.161              try {
   2.162                  // Multiselection
   2.163 @@ -409,7 +414,7 @@
   2.164      }
   2.165      
   2.166      public Transferable clipboardCopy() throws IOException {
   2.167 -        UTUtils.LOGGER.fine("entering");
   2.168 +        UTUtils.LOGGER.fine("entering"); // NOI18N
   2.169          final UserTask copy = (UserTask) item.clone();
   2.170          return new ExTransferable.Single(UserTaskTransfer.TODO_FLAVOR) {
   2.171              protected Object getData() {
   2.172 @@ -426,11 +431,11 @@
   2.173      public void destroy() throws IOException {
   2.174          AdvancedTreeTableNode n = 
   2.175              (AdvancedTreeTableNode) this.node.findNextNodeAfterDelete();
   2.176 -        UTUtils.LOGGER.fine("selected node after delete:" + n);
   2.177 +        UTUtils.LOGGER.fine("selected node after delete:" + n); // NOI18N
   2.178          if (item.getParent() != null)
   2.179 -            item.getParent().removeSubtask(item);
   2.180 +            item.getParent().getSubtasks().remove(item);
   2.181          else
   2.182 -            utl.removeTask(item);
   2.183 +            utl.getSubtasks().remove(item);
   2.184          super.destroy();
   2.185          if (n != null) {
   2.186              TreePath tp = new TreePath(n.getPathToRoot());
   2.187 @@ -446,7 +451,7 @@
   2.188       */
   2.189      public void pasteTask(UserTask t) {
   2.190          t = (UserTask) t.clone();
   2.191 -        item.addSubtask(t);
   2.192 +        item.getSubtasks().add(t);
   2.193          int index = this.node.getIndexOfObject(t);
   2.194          if (index >= 0) {
   2.195              AdvancedTreeTableNode n = 
     3.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskView.java	Fri Sep 24 16:22:13 2004 +0000
     3.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTaskView.java	Sat Sep 25 19:41:27 2004 +0000
     3.3 @@ -35,15 +35,11 @@
     3.4  import java.util.Map;
     3.5  import java.util.logging.Level;
     3.6  
     3.7 -import javax.swing.Action;
     3.8  import javax.swing.ActionMap;
     3.9 -import javax.swing.InputMap;
    3.10 -import javax.swing.JComponent;
    3.11  import javax.swing.JLabel;
    3.12  import javax.swing.JPanel;
    3.13  import javax.swing.JScrollPane;
    3.14  import javax.swing.JToolBar;
    3.15 -import javax.swing.KeyStroke;
    3.16  import javax.swing.SwingUtilities;
    3.17  import javax.swing.UIDefaults;
    3.18  import javax.swing.UIManager;
    3.19 @@ -57,6 +53,8 @@
    3.20  import org.netbeans.modules.tasklist.core.filter.Filter;
    3.21  import org.netbeans.modules.tasklist.core.filter.FilterRepository;
    3.22  import org.netbeans.modules.tasklist.usertasks.actions.GoToUserTaskAction;
    3.23 +import org.netbeans.modules.tasklist.usertasks.actions.MoveDownAction;
    3.24 +import org.netbeans.modules.tasklist.usertasks.actions.MoveUpAction;
    3.25  import org.netbeans.modules.tasklist.usertasks.actions.NewTaskAction;
    3.26  import org.netbeans.modules.tasklist.usertasks.actions.PauseAction;
    3.27  import org.netbeans.modules.tasklist.usertasks.actions.StartTaskAction;
    3.28 @@ -69,6 +67,7 @@
    3.29  import org.netbeans.modules.tasklist.usertasks.translators.ICalImportFormat;
    3.30  import org.netbeans.modules.tasklist.usertasks.translators.XmlExportFormat;
    3.31  import org.netbeans.modules.tasklist.usertasks.treetable.ChooseColumnsPanel;
    3.32 +import org.netbeans.modules.tasklist.usertasks.treetable.TreeTable;
    3.33  import org.netbeans.modules.tasklist.usertasks.treetable.TreeTableModel;
    3.34  import org.openide.ErrorManager;
    3.35  import org.openide.actions.FindAction;
    3.36 @@ -96,7 +95,7 @@
    3.37   *
    3.38   * @author Tor Norbye
    3.39   */
    3.40 -public class UserTaskView extends TopComponent implements UserTaskListener, 
    3.41 +public class UserTaskView extends TopComponent implements
    3.42  ExplorerManager.Provider, ExportImportProvider {
    3.43      // TODO: replace these constants with the equivalents from UserTaskProperties
    3.44      public static final String PROP_TASK_DONE = UserTaskProperties.PROPID_DONE;
    3.45 @@ -115,6 +114,8 @@
    3.46      
    3.47      private static final long serialVersionUID = 1;
    3.48  
    3.49 +    private static int nextViewId = 0;
    3.50 +    
    3.51      private static UserTaskView defview = null;
    3.52      
    3.53      /** Keeps track of all UserTaskViews */
    3.54 @@ -176,6 +177,8 @@
    3.55      
    3.56      private UserTasksTreeTable tt;
    3.57      
    3.58 +    private int viewId;
    3.59 +    
    3.60      /** 
    3.61       * Construct a new UserTaskView. Most work is deferred to
    3.62       * componentOpened. NOTE: this is only for use by the window
    3.63 @@ -199,6 +202,7 @@
    3.64  
    3.65          assert category != null : "category == null";
    3.66  
    3.67 +        this.viewId = nextViewId++;
    3.68          this.category = category;
    3.69          setName(title);
    3.70          this.persistent = persistent;
    3.71 @@ -234,6 +238,15 @@
    3.72      }
    3.73  
    3.74      /**
    3.75 +     * Returns the component representing the tasks.
    3.76 +     *
    3.77 +     * @return TreeTable
    3.78 +     */
    3.79 +    public TreeTable getTreeTable() {
    3.80 +        return tt;
    3.81 +    }
    3.82 +    
    3.83 +    /**
    3.84       * Returns actions for the toolbar.
    3.85       *
    3.86       * @return actions for the toolbar or null
    3.87 @@ -245,7 +258,9 @@
    3.88              SystemAction.get(FilterUserTaskAction.class),
    3.89              SystemAction.get(RemoveFilterUserTaskAction.class),
    3.90              SystemAction.get(StartTaskAction.class),
    3.91 -            SystemAction.get(PauseAction.class)
    3.92 +            SystemAction.get(PauseAction.class),
    3.93 +            SystemAction.get(MoveUpAction.class),
    3.94 +            SystemAction.get(MoveDownAction.class)
    3.95          };
    3.96      }
    3.97      
    3.98 @@ -273,14 +288,14 @@
    3.99          removeFilter.enable();
   3.100  
   3.101          // it's strange I'd expect live listener based solution
   3.102 -        Iterator it = getModel().getTasks().iterator();
   3.103 +        Iterator it = getModel().getSubtasks().iterator();
   3.104          while (it.hasNext()) {
   3.105              UserTask next = (UserTask) it.next();
   3.106              next.updateLineNumberRecursively();
   3.107          }
   3.108  
   3.109 -        // debug Ctrl+C,V,X
   3.110 -        if (UTUtils.LOGGER.isLoggable(Level.FINE)) {
   3.111 +        /* debug Ctrl+C,V,X
   3.112 +         if (UTUtils.LOGGER.isLoggable(Level.FINE)) {
   3.113              ActionMap am = this.getActionMap();
   3.114              Object[] actionKeys = am.allKeys();
   3.115              for (int i = 0; i < actionKeys.length; i++) {
   3.116 @@ -312,6 +327,7 @@
   3.117                  cmp = cmp.getParent();
   3.118              }
   3.119          }
   3.120 +         */
   3.121      }
   3.122      
   3.123      /** 
   3.124 @@ -446,37 +462,36 @@
   3.125       */    
   3.126      public void readExternal(ObjectInput objectInput) throws IOException, java.lang.ClassNotFoundException {
   3.127          try {
   3.128 -        readExternalCore(objectInput);
   3.129 -	int ver = objectInput.read();
   3.130 +            readExternalCore(objectInput);
   3.131 +            int ver = objectInput.read();
   3.132  
   3.133 -        if (ver >= 2) {
   3.134 -            // Read tasklist file name
   3.135 -	    String urlString = (String)objectInput.readObject();
   3.136 -            if (urlString != null) {
   3.137 -                URL url = new URL(urlString);
   3.138 -                final FileObject fo = URLMapper.findFileObject(url);
   3.139 -                if (fo != null) {
   3.140 -                	UserTaskList utl = new UserTaskList();
   3.141 -                	utl.readFile(fo);
   3.142 -                    setModel(utl);
   3.143 -                    SwingUtilities.invokeLater(new Runnable() {
   3.144 -                        public void run() {
   3.145 -                            setName(fo.getNameExt());
   3.146 -                        }
   3.147 -                    }); 
   3.148 -                }
   3.149 -                // XXX I do extra work here. I read in the global task
   3.150 -                // list each time (default UserTaskView constructor)
   3.151 -                // and then replace it with my own. If the default is large
   3.152 -                // this is significant. Think of a better way to do it.
   3.153 -                if (defview == this) { // work around one such problem
   3.154 -                    defview = null;
   3.155 +            if (ver >= 2) {
   3.156 +                // Read tasklist file name
   3.157 +                String urlString = (String)objectInput.readObject();
   3.158 +                if (urlString != null) {
   3.159 +                    URL url = new URL(urlString);
   3.160 +                    final FileObject fo = URLMapper.findFileObject(url);
   3.161 +                    if (fo != null) {
   3.162 +                            UserTaskList utl = new UserTaskList();
   3.163 +                            utl.readFile(fo);
   3.164 +                        setModel(utl);
   3.165 +                        SwingUtilities.invokeLater(new Runnable() {
   3.166 +                            public void run() {
   3.167 +                                setName(fo.getNameExt());
   3.168 +                            }
   3.169 +                        }); 
   3.170 +                    }
   3.171 +                    // XXX I do extra work here. I read in the global task
   3.172 +                    // list each time (default UserTaskView constructor)
   3.173 +                    // and then replace it with my own. If the default is large
   3.174 +                    // this is significant. Think of a better way to do it.
   3.175 +                    if (defview == this) { // work around one such problem
   3.176 +                        defview = null;
   3.177 +                    }
   3.178                  }
   3.179              }
   3.180 -        }
   3.181          } catch (Throwable t) {
   3.182 -            if (UTUtils.LOGGER.isLoggable(Level.SEVERE))
   3.183 -                t.printStackTrace();
   3.184 +            t.printStackTrace();
   3.185          }
   3.186      }
   3.187  
   3.188 @@ -491,8 +506,8 @@
   3.189      public void writeExternalCore(ObjectOutput objectOutput) throws IOException {
   3.190          if (!persistent) {
   3.191              ErrorManager.getDefault().log(
   3.192 -                    ErrorManager.INFORMATIONAL,
   3.193 -                    "Warning: This tasklist window (" + getName() + ") should not have been persisted!");
   3.194 +                ErrorManager.INFORMATIONAL,
   3.195 +                "Warning: This tasklist window (" + getName() + ") should not have been persisted!");
   3.196              return;
   3.197          }
   3.198  
   3.199 @@ -529,12 +544,6 @@
   3.200  
   3.201          // Write out the UID of the currently selected task, or null if none
   3.202          objectOutput.writeObject(null); // Not yet implemented
   3.203 -
   3.204 -        // Write out the window's properties:
   3.205 -        // TODO: do we really need these properties?
   3.206 -        // objectOutput.writeObject(category);
   3.207 -        // objectOutput.writeObject(title);
   3.208 -        // objectOutput.write(persistent ? 1 : 0);
   3.209      }
   3.210  
   3.211      /** 
   3.212 @@ -622,19 +631,21 @@
   3.213      protected void setModel(UserTaskList list) {
   3.214          hideList();
   3.215          tasklist = list;
   3.216 -        getModel().addTaskListener(this);
   3.217 +        // TODO getModel().addTaskListener(this);
   3.218          UserTaskList utl = (UserTaskList) this.getList();
   3.219 -        utl.showAnnotations(utl.getTasks().iterator());
   3.220 +        utl.showAnnotations(utl.getSubtasks().iterator());
   3.221      }
   3.222      
   3.223      protected void hideList() {
   3.224 -        UserTaskList prev = getModel();
   3.225 +        /*UserTaskList prev = getModel();
   3.226          if (prev != null) {
   3.227              prev.removeTaskListener(this);
   3.228          }
   3.229          UserTaskList utl = (UserTaskList) this.getModel();
   3.230          if (utl != null)
   3.231              utl.hideAnnotations(utl.getTasks().iterator());
   3.232 +         *
   3.233 +         * TODO */
   3.234      }
   3.235  
   3.236      public String toString() { 
   3.237 @@ -651,7 +662,10 @@
   3.238      }
   3.239  
   3.240      protected java.lang.String preferredID() {
   3.241 -        return "org.netbeans.modules.tasklist.usertasks.Window";
   3.242 +        // although TC.preferredId says that the return value of
   3.243 +        // preferredID must not be unique it does not seem to work
   3.244 +        // so viewId is used to identify the views
   3.245 +        return "org.netbeans.modules.tasklist.usertasks.Window" + viewId; // NOI18N
   3.246      }    
   3.247  
   3.248      protected void setFiltered() {
   3.249 @@ -1136,35 +1150,6 @@
   3.250          storeColumnsConfiguration();
   3.251      }
   3.252  
   3.253 -    private void setRoot() {
   3.254 -        /* TODO: remove
   3.255 -         rootNode = createRootNode();
   3.256 -	// TODO: usertasks module sets the display name of the root node to
   3.257 -        // "Task List"
   3.258 -        rootNode.setDisplayName(getMainColumn(-1).getDisplayName());
   3.259 -
   3.260 -        LOGGER.fine("root created " + rootNode);
   3.261 -
   3.262 -        Node prevRoot = getExplorerManager().getRootContext();
   3.263 -
   3.264 -        if (isFiltered()) {
   3.265 -            // Create filtered view of the tasklist
   3.266 -            FilteredTaskChildren children =
   3.267 -                new FilteredTaskChildren(this, rootNode, getFilter());
   3.268 -            FilterNode n = new FilterTaskNode(rootNode, children, false);
   3.269 -            getExplorerManager().setRootContext(n);
   3.270 -        } else {
   3.271 -            getExplorerManager().setRootContext(rootNode);
   3.272 -        }
   3.273 -
   3.274 -        try {
   3.275 -            if (prevRoot != null) prevRoot.destroy();
   3.276 -        } catch (IOException ex) {
   3.277 -            throw new IllegalStateException("Unexpected IOex in " + prevRoot);  // NOI18N
   3.278 -        }
   3.279 -         **/
   3.280 -    }
   3.281 -
   3.282      /**
   3.283       * Returns the root node. It is never a filtered node.
   3.284       *
   3.285 @@ -1335,6 +1320,9 @@
   3.286          // Nothing to do?
   3.287      }
   3.288  
   3.289 +    public void tasksReordered(UserTask parent) {
   3.290 +    }
   3.291 +    
   3.292      public void removedTask(UserTask pt, UserTask task, int index) {
   3.293          if ((task == unshowItem) && (listeningViews != null)) {
   3.294              unshowItem = null;
   3.295 @@ -1416,20 +1404,6 @@
   3.296      /** When true, we've already warned about the need to wrap */
   3.297      private boolean wrapWarned = false;
   3.298  
   3.299 -    /** Try to select nodes in all known views. */
   3.300 -    private void selectNode(Node node) {
   3.301 -        if (node != null) {
   3.302 -            UserTask nextTask = ((UserTaskNode) node).getTask();
   3.303 -            if (nextTask.getLine() != null) {
   3.304 -                UserTaskAnnotation anno = getAnnotation(nextTask);
   3.305 -                if (anno != null) {
   3.306 -                    showTaskInEditor(nextTask, anno);
   3.307 -                }
   3.308 -            }
   3.309 -            select(nextTask); // XXX call EM directly
   3.310 -        }
   3.311 -    }
   3.312 -
   3.313      /**
   3.314       * @param tail if true take the last one from multiple selection
   3.315       *        othervise the first one
   3.316 @@ -1467,26 +1441,4 @@
   3.317              tt.requestFocus();
   3.318          }
   3.319      }
   3.320 -
   3.321 -    /**
   3.322 -     * Returns visible columns
   3.323 -     *
   3.324 -     * @return visible columns
   3.325 -     */
   3.326 -    /*public final ColumnProperty[] getVisibleColumns() {
   3.327 -        TableColumnModel tcm = getTable().getColumnModel();
   3.328 -        ColumnProperty[] all = getColumns();
   3.329 -        List ret = new ArrayList();
   3.330 -        ret.add(all[0]);
   3.331 -        for (int i = 0; i < tcm.getColumnCount(); i++) {
   3.332 -            String title = tcm.getColumn(i).getHeaderValue().toString();
   3.333 -            for (int j = 1; j < all.length; j++) {
   3.334 -                if (title.equalsIgnoreCase(all[j].getDisplayName())) {
   3.335 -                    ret.add(all[j]);
   3.336 -                    break;
   3.337 -                }
   3.338 -            }
   3.339 -        }
   3.340 -        return (ColumnProperty[]) ret.toArray(new ColumnProperty[ret.size()]);
   3.341 -    } TODO: remove*/
   3.342  }
     4.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTasksTreeTable.java	Fri Sep 24 16:22:13 2004 +0000
     4.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/UserTasksTreeTable.java	Sat Sep 25 19:41:27 2004 +0000
     4.3 @@ -48,7 +48,9 @@
     4.4  public class UserTasksTreeTable extends NodesTreeTable {
     4.5      /**
     4.6       * Creates a new instance of UserTasksTreeTable
     4.7 -     * TODO: comment
     4.8 +     * 
     4.9 +     * @param em ExplorerManager associated with this tree table
    4.10 +     * @param utl list with user tasks
    4.11       * @param filter used filter or null
    4.12       */
    4.13      public UserTasksTreeTable(ExplorerManager em, UserTaskList utl,
     5.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/Bundle.properties	Fri Sep 24 16:22:13 2004 +0000
     5.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/Bundle.properties	Sat Sep 25 19:41:27 2004 +0000
     5.3 @@ -21,6 +21,9 @@
     5.4  ## MoveUpAction
     5.5  MoveUp=Move Up
     5.6  
     5.7 +## MoveDownAction
     5.8 +MoveDown=Move Down
     5.9 +
    5.10  ## NewTaskAction
    5.11  BTN_AddAnother=Add Another
    5.12  TITLE_add_todo=New Task
     6.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ClearCompletedAction.java	Fri Sep 24 16:22:13 2004 +0000
     6.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/ClearCompletedAction.java	Sat Sep 25 19:41:27 2004 +0000
     6.3 @@ -55,7 +55,7 @@
     6.4              } else {
     6.5                  UserTaskList utl = 
     6.6                      ((UserTaskListNode) nodes[0]).getUserTaskList();
     6.7 -                Iterator it = utl.getTasks().iterator();
     6.8 +                Iterator it = utl.getSubtasks().iterator();
     6.9                  while (it.hasNext()) {
    6.10                      UserTask ut = (UserTask) it.next();
    6.11                      clearCompleted(ut);
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveDownAction.java	Sat Sep 25 19:41:27 2004 +0000
     7.3 @@ -0,0 +1,82 @@
     7.4 +/*
     7.5 + *                 Sun Public License Notice
     7.6 + *
     7.7 + * The contents of this file are subject to the Sun Public License
     7.8 + * Version 1.0 (the "License"). You may not use this file except in
     7.9 + * compliance with the License. A copy of the License is available at
    7.10 + * http://www.sun.com/
    7.11 + *
    7.12 + * The Original Code is NetBeans. The Initial Developer of the Original
    7.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
    7.14 + * Microsystems, Inc. All Rights Reserved.
    7.15 + */
    7.16 +
    7.17 +package org.netbeans.modules.tasklist.usertasks.actions;
    7.18 +
    7.19 +import org.netbeans.modules.tasklist.usertasks.UTUtils;
    7.20 +import org.netbeans.modules.tasklist.usertasks.UserTask;
    7.21 +import org.netbeans.modules.tasklist.usertasks.UserTaskNode;
    7.22 +import org.netbeans.modules.tasklist.usertasks.UserTaskObjectList;
    7.23 +import org.netbeans.modules.tasklist.usertasks.UserTaskView;
    7.24 +import org.openide.util.HelpCtx;
    7.25 +import org.openide.util.NbBundle;
    7.26 +import org.openide.util.actions.NodeAction;
    7.27 +
    7.28 +/**
    7.29 + * Moves a task down
    7.30 + */
    7.31 +public class MoveDownAction extends NodeAction {
    7.32 +    /**
    7.33 +     * Creates a new instance
    7.34 +     */
    7.35 +    public MoveDownAction() {
    7.36 +    }
    7.37 +    
    7.38 +    protected void performAction(org.openide.nodes.Node[] activatedNodes) {
    7.39 +        UserTaskNode n = (UserTaskNode) activatedNodes[0];
    7.40 +        UserTask ut = n.getTask();
    7.41 +        UserTaskView utv = UserTaskView.getCurrent();
    7.42 +        Object es = utv.getTreeTable().getExpandedNodesAndSelection();
    7.43 +        ut.moveDown();
    7.44 +        utv.getTreeTable().setExpandedNodesAndSelection(es);
    7.45 +    }
    7.46 +    
    7.47 +    protected boolean enable(org.openide.nodes.Node[] activatedNodes) {
    7.48 +        if (activatedNodes.length != 1)
    7.49 +            return false;
    7.50 +        
    7.51 +        if (!(activatedNodes[0] instanceof UserTaskNode))
    7.52 +            return false;
    7.53 +        
    7.54 +        UTUtils.LOGGER.fine("checking the index"); // NOI18N
    7.55 +        UserTaskNode n = (UserTaskNode) activatedNodes[0];
    7.56 +        UserTask ut = n.getTask();
    7.57 +        
    7.58 +        UserTaskObjectList list;
    7.59 +        if (ut.getParent() == null)
    7.60 +            list = ut.getList().getSubtasks();
    7.61 +        else
    7.62 +            list = ut.getParent().getSubtasks();
    7.63 +        
    7.64 +        if (list.indexOf(ut) == list.size() - 1) 
    7.65 +            return false;
    7.66 +        
    7.67 +        return true;
    7.68 +    }
    7.69 +    
    7.70 +    protected String iconResource() {
    7.71 +        return "org/netbeans/modules/tasklist/usertasks/actions/moveDown.gif"; // NOI18N
    7.72 +    }
    7.73 +    
    7.74 +    public org.openide.util.HelpCtx getHelpCtx() {
    7.75 +        return HelpCtx.DEFAULT_HELP;
    7.76 +    }
    7.77 +    
    7.78 +    public String getName() {
    7.79 +        return NbBundle.getMessage(MoveUpAction.class, "MoveDown"); // NOI18N
    7.80 +    }    
    7.81 +    
    7.82 +    protected boolean asynchronous() {
    7.83 +        return false;
    7.84 +    }    
    7.85 +}
     8.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveUpAction.java	Fri Sep 24 16:22:13 2004 +0000
     8.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/MoveUpAction.java	Sat Sep 25 19:41:27 2004 +0000
     8.3 @@ -13,8 +13,11 @@
     8.4  
     8.5  package org.netbeans.modules.tasklist.usertasks.actions;
     8.6  
     8.7 +import org.netbeans.modules.tasklist.usertasks.UTUtils;
     8.8  import org.netbeans.modules.tasklist.usertasks.UserTask;
     8.9  import org.netbeans.modules.tasklist.usertasks.UserTaskNode;
    8.10 +import org.netbeans.modules.tasklist.usertasks.UserTaskObjectList;
    8.11 +import org.netbeans.modules.tasklist.usertasks.UserTaskView;
    8.12  import org.openide.util.HelpCtx;
    8.13  import org.openide.util.NbBundle;
    8.14  import org.openide.util.actions.NodeAction;
    8.15 @@ -32,13 +35,37 @@
    8.16      protected void performAction(org.openide.nodes.Node[] activatedNodes) {
    8.17          UserTaskNode n = (UserTaskNode) activatedNodes[0];
    8.18          UserTask ut = n.getTask();
    8.19 -        //if (ut.getParent().indexOf(ut) != 0)
    8.20 -        //    ut.moveUp();
    8.21 +        UserTaskView utv = UserTaskView.getCurrent();
    8.22 +        Object es = utv.getTreeTable().getExpandedNodesAndSelection();
    8.23 +        ut.moveUp();
    8.24 +        utv.getTreeTable().setExpandedNodesAndSelection(es);
    8.25      }
    8.26      
    8.27      protected boolean enable(org.openide.nodes.Node[] activatedNodes) {
    8.28 -        return activatedNodes.length == 1 && 
    8.29 -            activatedNodes[0] instanceof UserTaskNode;
    8.30 +        if (activatedNodes.length != 1)
    8.31 +            return false;
    8.32 +        
    8.33 +        if (!(activatedNodes[0] instanceof UserTaskNode))
    8.34 +            return false;
    8.35 +        
    8.36 +        UTUtils.LOGGER.fine("checking the index"); // NOI18N
    8.37 +        UserTaskNode n = (UserTaskNode) activatedNodes[0];
    8.38 +        UserTask ut = n.getTask();
    8.39 +
    8.40 +        UserTaskObjectList list;
    8.41 +        if (ut.getParent() == null)
    8.42 +            list = ut.getList().getSubtasks();
    8.43 +        else
    8.44 +            list = ut.getParent().getSubtasks();
    8.45 +        
    8.46 +        if (list.indexOf(ut) == 0) 
    8.47 +            return false;
    8.48 +        
    8.49 +        return true;
    8.50 +    }
    8.51 +    
    8.52 +    protected String iconResource() {
    8.53 +        return "org/netbeans/modules/tasklist/usertasks/actions/moveUp.gif"; // NOI18N
    8.54      }
    8.55      
    8.56      public org.openide.util.HelpCtx getHelpCtx() {
    8.57 @@ -47,6 +74,9 @@
    8.58      
    8.59      public String getName() {
    8.60          return NbBundle.getMessage(MoveUpAction.class, "MoveUp"); // NOI18N
    8.61 -    }
    8.62 +    }    
    8.63      
    8.64 +    protected boolean asynchronous() {
    8.65 +        return false;
    8.66 +    }    
    8.67  }
     9.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/NewTaskAction.java	Fri Sep 24 16:22:13 2004 +0000
     9.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/actions/NewTaskAction.java	Sat Sep 25 19:41:27 2004 +0000
     9.3 @@ -17,8 +17,6 @@
     9.4  import java.awt.Dimension;
     9.5  import java.awt.event.ActionEvent;
     9.6  import java.awt.event.ActionListener;
     9.7 -import java.util.Collections;
     9.8 -
     9.9  import javax.swing.JButton;
    9.10  
    9.11  import org.netbeans.modules.tasklist.usertasks.EditTaskPanel;
    9.12 @@ -142,9 +140,15 @@
    9.13          // See if the user wants to append or prepend
    9.14          boolean append = panel.getAppend();
    9.15          if (parent != null) {
    9.16 -            parent.addSubtask(ut, append);
    9.17 +        	if (append)
    9.18 +        		parent.getSubtasks().add(ut);
    9.19 +        	else
    9.20 +        		parent.getSubtasks().add(0, ut);
    9.21          } else {
    9.22 -            utl.addTasks(Collections.singletonList(ut), append);
    9.23 +        	if (append)
    9.24 +        		utl.getSubtasks().add(ut);
    9.25 +        	else
    9.26 +        		utl.getSubtasks().add(0, ut);
    9.27          }
    9.28  
    9.29          ut.updateAnnotation();
    9.30 @@ -155,12 +159,6 @@
    9.31          utv.scrollTo(ut);
    9.32  
    9.33          ut = new UserTask("", utl); // NOI18N
    9.34 -        if (filename != null) {
    9.35 -            ut.setFilename(filename);
    9.36 -            if (line != 0) {
    9.37 -                ut.setLineNumber(line);
    9.38 -            }
    9.39 -        }
    9.40          panel.fillPanel(ut);
    9.41          panel.focusSummary();
    9.42      }
    9.43 @@ -247,12 +245,6 @@
    9.44              view = UserTaskView.getDefault();
    9.45          
    9.46          UserTask ut = new UserTask("", utl); // NOI18N
    9.47 -        if (filename != null) {
    9.48 -            ut.setFilename(filename);
    9.49 -            if (line != 0) {
    9.50 -                ut.setLineNumber(line);
    9.51 -            }
    9.52 -        }
    9.53  
    9.54          EditTaskPanel panel = getEditTaskPanel();
    9.55          panel.fillPanel(ut);
    9.56 @@ -267,9 +259,15 @@
    9.57              // See if the user wants to append or prepend
    9.58              boolean append = panel.getAppend();
    9.59              if (parent != null) {
    9.60 -                parent.addSubtask(ut, append);
    9.61 +            	if (append)
    9.62 +                    parent.getSubtasks().add(ut);
    9.63 +            	else
    9.64 +                    parent.getSubtasks().add(0, ut);
    9.65              } else {
    9.66 -                utl.addTasks(Collections.singletonList(ut), append);
    9.67 +            	if (append)
    9.68 +                    utl.getSubtasks().add(ut);
    9.69 +            	else
    9.70 +                    utl.getSubtasks().add(0, ut);
    9.71              }
    9.72  
    9.73              ut.updateAnnotation();
    10.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/mf-layer.xml	Fri Sep 24 16:22:13 2004 +0000
    10.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/mf-layer.xml	Sat Sep 25 19:41:27 2004 +0000
    10.3 @@ -43,12 +43,6 @@
    10.4      </folder>
    10.5    </folder>
    10.6  
    10.7 -    <folder name="Suggestions">
    10.8 -      <folder name="Types">
    10.9 -        <file name="org-netbeans-modules-tasklist-usertasks-duetasks.xml" url="duetasks.xml"/>
   10.10 -      </folder>
   10.11 -    </folder>
   10.12 -
   10.13    <folder name="Services">
   10.14          <folder name="JavaHelp">
   10.15              <!-- Merge after Core IDE Help: -->
    11.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalExportFormat.java	Fri Sep 24 16:22:13 2004 +0000
    11.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalExportFormat.java	Sat Sep 25 19:41:27 2004 +0000
    11.3 @@ -161,7 +161,7 @@
    11.4          formatter.setTimeZone(new SimpleTimeZone(0, "GMT")); // NOI18N
    11.5          
    11.6          // Write out todo items
    11.7 -        Iterator it = list.getTasks().iterator();
    11.8 +        Iterator it = list.getSubtasks().iterator();
    11.9          while (it.hasNext()) {
   11.10              // Note: The previous try/catch block was superfluous (?) since
   11.11              // no exceptions will we thrown inside this block (unless
   11.12 @@ -410,7 +410,7 @@
   11.13  
   11.14          // Recurse over subtasks
   11.15          // XXX do the other tags here...
   11.16 -        Iterator it = task.subtasksIterator();
   11.17 +        Iterator it = task.getSubtasks().iterator();
   11.18          while (it.hasNext()) {
   11.19              UserTask subtask = (UserTask)it.next();
   11.20              writeTask(writer, subtask, sdf);
    12.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalImportFormat.java	Fri Sep 24 16:22:13 2004 +0000
    12.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/ICalImportFormat.java	Sat Sep 25 19:41:27 2004 +0000
    12.3 @@ -412,7 +412,7 @@
    12.4       */
    12.5      private UserTask readVTODO(UserTaskList list, UserTask prev, SimpleDateFormat formatter) throws IOException {
    12.6          UserTask task = new UserTask("", list); // NOI18N
    12.7 -        task.setSilentUpdate(true, false);
    12.8 +        // TODO task.setSilentUpdate(true, false);
    12.9          task.setLastEditedDate(System.currentTimeMillis());
   12.10          StringWriter writer = null;
   12.11          String related = null;
   12.12 @@ -435,6 +435,8 @@
   12.13                  stashBulk(writer, name, param, value);
   12.14              }
   12.15              
   12.16 +            // UTUtils.LOGGER.fine("processing " + name); // NOI18N
   12.17 +            
   12.18              if (name.equals("END")) { // NOI18N
   12.19                  break;  // @@@ Should I verify that this is the end of a VTODO???
   12.20              } else if (name.equals("CREATED")) { // NOI18N
   12.21 @@ -610,18 +612,23 @@
   12.22              task.userObject = writer.getBuffer();
   12.23          }
   12.24          
   12.25 -        UserTask alreadyExists = list.findItem(list.getTasks().iterator(), task.getUID());
   12.26 +        UserTask alreadyExists = list.findItem(list.getSubtasks().iterator(), task.getUID());
   12.27          if (alreadyExists != null) {
   12.28              // I should replace alreadyexists with task...
   12.29              UserTask parent = alreadyExists.getParent();
   12.30 -            parent.removeSubtask(alreadyExists);
   12.31 -            parent.addSubtask(task);
   12.32 +            if (parent != null) {
   12.33 +                parent.getSubtasks().remove(alreadyExists);
   12.34 +                parent.getSubtasks().add(task);
   12.35 +            } else {
   12.36 +                list.getSubtasks().remove(alreadyExists);
   12.37 +                list.getSubtasks().add(task);
   12.38 +            }
   12.39              
   12.40 -            Iterator li = alreadyExists.subtasksIterator();
   12.41 +            Iterator li = alreadyExists.getSubtasks().iterator();
   12.42              while (li.hasNext()) {
   12.43                  UserTask c = (UserTask)li.next();
   12.44 -                alreadyExists.removeSubtask(c);
   12.45 -                task.addSubtask(c);
   12.46 +                alreadyExists.getSubtasks().remove(c);
   12.47 +                task.getSubtasks().add(c);
   12.48              }
   12.49          } else if (related != null) {
   12.50              // the parent setting !!
   12.51 @@ -629,11 +636,11 @@
   12.52              if (prev != null && prev.getUID().equals(related)) {
   12.53                  parent = prev;
   12.54              } else {
   12.55 -                parent = list.findItem(list.getTasks().iterator(), related);
   12.56 +                parent = list.findItem(list.getSubtasks().iterator(), related);
   12.57              }
   12.58              
   12.59              if (parent != null) {
   12.60 -                parent.addSubtask(task, true);
   12.61 +                parent.getSubtasks().add(task);
   12.62              }
   12.63          }
   12.64          
   12.65 @@ -687,9 +694,9 @@
   12.66                      
   12.67                      if (task != null) {
   12.68                          if (task.getParent() == null) {
   12.69 -                            ulist.appendTask(task);
   12.70 +                            ulist.getSubtasks().add(task);
   12.71                          }
   12.72 -                        task.setSilentUpdate(false, false);
   12.73 +                        // TODO task.setSilentUpdate(false, false);
   12.74                          prev = (UserTask)task;
   12.75                      }
   12.76                  } else if (value.equals("VCALENDAR")) { // NOI18N
    13.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/XmlExportFormat.java	Fri Sep 24 16:22:13 2004 +0000
    13.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/translators/XmlExportFormat.java	Sat Sep 25 19:41:27 2004 +0000
    13.3 @@ -160,7 +160,7 @@
    13.4          Element tasks = doc.createElement("tasks"); // NOI18N
    13.5          doc.appendChild(tasks);
    13.6  
    13.7 -        Iterator it = list.getTasks().iterator();
    13.8 +        Iterator it = list.getSubtasks().iterator();
    13.9          while (it.hasNext()) {
   13.10              task(tasks, (UserTask) it.next());
   13.11          }
   13.12 @@ -240,7 +240,7 @@
   13.13          
   13.14          node.appendChild(doc.createTextNode(LINE_SEPARATOR));
   13.15          
   13.16 -        Iterator it = task.subtasksIterator();
   13.17 +        Iterator it = task.getSubtasks().iterator();
   13.18          while (it.hasNext()) {
   13.19              task(node, (UserTask) it.next());
   13.20          }
    14.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/AdvancedTreeTableNode.java	Fri Sep 24 16:22:13 2004 +0000
    14.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/AdvancedTreeTableNode.java	Sat Sep 25 19:41:27 2004 +0000
    14.3 @@ -206,6 +206,29 @@
    14.4      }
    14.5      
    14.6      /**
    14.7 +     * Fires the appropriate events if the children under this node
    14.8 +     * were reordered.
    14.9 +     */
   14.10 +    protected void fireChildObjectsReordered() {
   14.11 +        if (children != null) {
   14.12 +            if (this.comparator == null) {
   14.13 +                AdvancedTreeTableNode[] newch = 
   14.14 +                    new AdvancedTreeTableNode[children.length];
   14.15 +                Iterator it = this.getChildrenObjectsIterator();
   14.16 +                int i = 0;
   14.17 +                while (it.hasNext()) {
   14.18 +                    Object obj = it.next();
   14.19 +                    int index = getIndexOfObject(obj);
   14.20 +                    if (index >= 0)
   14.21 +                        newch[i++] = (AdvancedTreeTableNode) children[index];
   14.22 +                }
   14.23 +                children = newch;
   14.24 +                model.fireTreeStructureChanged(model, getPathToRoot());
   14.25 +            }
   14.26 +        }
   14.27 +    }
   14.28 +    
   14.29 +    /**
   14.30       * Fires the appropriate events if a child object was removed
   14.31       *
   14.32       * @param obj one of the child nodes objects
    15.1 --- a/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/TreeTable.java	Fri Sep 24 16:22:13 2004 +0000
    15.2 +++ b/tasklist.usertasks/src/org/netbeans/modules/tasklist/usertasks/treetable/TreeTable.java	Sat Sep 25 19:41:27 2004 +0000
    15.3 @@ -29,8 +29,10 @@
    15.4  import java.awt.event.MouseEvent;
    15.5  import java.beans.PropertyChangeEvent;
    15.6  import java.beans.PropertyChangeListener;
    15.7 +import java.util.ArrayList;
    15.8  import java.util.Enumeration;
    15.9  import java.util.EventObject;
   15.10 +import java.util.List;
   15.11  import javax.swing.ActionMap;
   15.12  import javax.swing.Icon;
   15.13  import javax.swing.InputMap;
   15.14 @@ -68,9 +70,20 @@
   15.15   * @author Scott Violet
   15.16   */
   15.17  public class TreeTable extends JTable {
   15.18 -
   15.19 +    /**
   15.20 +     * Expanded nodes and selection.
   15.21 +     * See setExpandedNodesAndSelection/getExpandedNodesAndSelection
   15.22 +     */
   15.23 +    private static final class ExpandedNodesAndSelection {
   15.24 +        /** selection */
   15.25 +        public TreePath[] selection;
   15.26 +        
   15.27 +        /** expanded nodes */
   15.28 +        public TreePath[] expandedNodes;
   15.29 +    }
   15.30 +    
   15.31      private static final long serialVersionUID = 1;
   15.32 -
   15.33 +    
   15.34      /** A subclass of JTree. */
   15.35      protected TreeTableCellRenderer tree;
   15.36      private TreeTableModel treeTableModel;
   15.37 @@ -137,33 +150,72 @@
   15.38          // copied from TTV
   15.39          getSortingModel().addChangeListener(new ChangeListener() {
   15.40              public void stateChanged(ChangeEvent e) {
   15.41 -                Enumeration en = tree.getExpandedDescendants( 
   15.42 -                    new TreePath(getTreeTableModel().getRoot()));
   15.43 -                int[] selRows = getSelectedRows();
   15.44 -                TreePath[] selPaths = new TreePath[selRows.length];
   15.45 -                for (int i = 0; i < selRows.length; i++) {
   15.46 -                    selPaths[i] = tree.getPathForRow(selRows[i]);
   15.47 -                }
   15.48 -                    
   15.49 +                Object es = getExpandedNodesAndSelection();
   15.50 +
   15.51                  getTreeTableModel().sort(getSortingModel());
   15.52                  
   15.53 -                // expand again folders
   15.54 -                if (en != null) { // #49217
   15.55 -                    while (en.hasMoreElements()) {
   15.56 -                        TreePath tp = (TreePath) en.nextElement();
   15.57 -                        tree.expandPath(tp);
   15.58 -                    }
   15.59 -                }
   15.60 -                
   15.61 -                for (int i = 0; i < selPaths.length; i++) {
   15.62 -                    int row = tree.getRowForPath(selPaths[i]);
   15.63 -                    getSelectionModel().addSelectionInterval(row, row);
   15.64 -                }
   15.65 +                setExpandedNodesAndSelection(es);
   15.66              }
   15.67          });
   15.68      }
   15.69  
   15.70      /**
   15.71 +     * TreeModel does not support a reordering event. Therefore it is 
   15.72 +     * necessary to save the expanded nodes and selection before 
   15.73 +     * a reordering and restore them after such an operation.
   15.74 +     *
   15.75 +     * @return an object that could be used in setExpandedNodesAndSelection()
   15.76 +     */
   15.77 +    public Object getExpandedNodesAndSelection() {
   15.78 +        TreeTable.ExpandedNodesAndSelection ret =
   15.79 +            new TreeTable.ExpandedNodesAndSelection();
   15.80 +        
   15.81 +        Enumeration en = tree.getExpandedDescendants( 
   15.82 +            new TreePath(getTreeTableModel().getRoot()));
   15.83 +        if (en != null) {
   15.84 +            List exp = new ArrayList();
   15.85 +            while (en.hasMoreElements()) {
   15.86 +                exp.add(en.nextElement());
   15.87 +            }
   15.88 +            ret.expandedNodes = (TreePath[]) exp.toArray(
   15.89 +                new TreePath[exp.size()]);
   15.90 +        } else {
   15.91 +            ret.expandedNodes = new TreePath[0];
   15.92 +        }
   15.93 +        
   15.94 +        int[] selRows = getSelectedRows();
   15.95 +        ret.selection = new TreePath[selRows.length];
   15.96 +        for (int i = 0; i < selRows.length; i++) {
   15.97 +            ret.selection[i] = tree.getPathForRow(selRows[i]);
   15.98 +        }
   15.99 +
  15.100 +        return ret;
  15.101 +    }
  15.102 +    
  15.103 +    /**
  15.104 +     * TreeModel does not support a reordering event. Therefore it is 
  15.105 +     * necessary to save the expanded nodes and selection before 
  15.106 +     * a reordering and restore them after such an operation.
  15.107 +     *
  15.108 +     * @param an object that was returned by getExpandedNodesAndSelection()
  15.109 +     */
  15.110 +    public void setExpandedNodesAndSelection(Object obj) {
  15.111 +        TreeTable.ExpandedNodesAndSelection es = 
  15.112 +            (TreeTable.ExpandedNodesAndSelection) obj;
  15.113 +        
  15.114 +        // expanded nodes
  15.115 +        for (int i = 0; i < es.expandedNodes.length; i++) {
  15.116 +            tree.expandPath(es.expandedNodes[i]);
  15.117 +        }
  15.118 +
  15.119 +        // selection
  15.120 +        for (int i = 0; i < es.selection.length; i++) {
  15.121 +            int row = tree.getRowForPath(es.selection[i]);
  15.122 +            getSelectionModel().addSelectionInterval(row, row);
  15.123 +        }
  15.124 +    }
  15.125 +    
  15.126 +    /**
  15.127       * Expands all nodes
  15.128       */    
  15.129      public void expandAll() {
    16.1 --- a/tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/IcsNode.java	Fri Sep 24 16:22:13 2004 +0000
    16.2 +++ b/tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/IcsNode.java	Sat Sep 25 19:41:27 2004 +0000
    16.3 @@ -13,12 +13,9 @@
    16.4  
    16.5  package org.netbeans.modules.tasklist.usertasks.test;
    16.6  
    16.7 -import org.netbeans.jemmy.EventTool;
    16.8 -
    16.9 -import org.netbeans.jellytools.Bundle;
   16.10  import org.netbeans.jellytools.FilesTabOperator;
   16.11 +import org.netbeans.jellytools.actions.ExecuteAction;
   16.12  import org.netbeans.jellytools.nodes.Node;
   16.13 -import org.netbeans.jellytools.actions.ExecuteAction;
   16.14  import org.netbeans.jemmy.operators.JTreeOperator;
   16.15  
   16.16  /**
    17.1 --- a/tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/TestTable.java	Fri Sep 24 16:22:13 2004 +0000
    17.2 +++ b/tasklist.usertasks/test/qa-functional/src/org/netbeans/modules/tasklist/usertasks/test/TestTable.java	Sat Sep 25 19:41:27 2004 +0000
    17.3 @@ -13,32 +13,11 @@
    17.4  
    17.5  package org.netbeans.modules.tasklist.usertasks.test;
    17.6  
    17.7 -import java.io.File;
    17.8 -import java.util.HashSet;
    17.9 -
   17.10 -import junit.framework.*;
   17.11 -import junit.extensions.TestSetup;
   17.12 -
   17.13 -import org.netbeans.junit.*;
   17.14 -
   17.15 -import org.netbeans.jemmy.EventTool;
   17.16 -
   17.17 -import org.netbeans.jellytools.Bundle;
   17.18 +import junit.framework.Test;
   17.19 +import junit.framework.TestSuite;
   17.20  
   17.21  import org.netbeans.jellytools.JellyTestCase;
   17.22 -import org.netbeans.jellytools.NbDialogOperator;
   17.23 -import org.netbeans.jellytools.EditorOperator;
   17.24 -
   17.25 -import org.netbeans.jellytools.actions.SaveAllAction;
   17.26 -import org.netbeans.jellytools.actions.CopyAction;
   17.27 -import org.netbeans.jellytools.actions.PasteAction;
   17.28 -import org.netbeans.jellytools.actions.CutAction;
   17.29 -import org.netbeans.jellytools.actions.DeleteAction;
   17.30 -
   17.31 -import org.netbeans.jellytools.nodes.Node;
   17.32 -
   17.33 -import org.netbeans.jellytools.MainWindowOperator;
   17.34 -import org.netbeans.jellytools.OutputOperator;
   17.35 +import org.netbeans.junit.NbTestSuite;
   17.36  
   17.37  /**
   17.38   * Tests for the TreeTable
    18.1 --- a/tasklist.usertasks/test/qa-functional/testCases.html	Fri Sep 24 16:22:13 2004 +0000
    18.2 +++ b/tasklist.usertasks/test/qa-functional/testCases.html	Sat Sep 25 19:41:27 2004 +0000
    18.3 @@ -82,8 +82,18 @@
    18.4      <li>F2.</li>
    18.5      <li>Enter "Test".</li>
    18.6      <li>Show Task "Test".</li>
    18.7 -    <li>Check the summary. It should be "Test".<br>
    18.8 -    </li>
    18.9 +    <li>Check the summary. It should be "Test".</li>
   18.10 +  </ol>
   18.11 +  <li>"Move up/Move down" should not change selection.<br>
   18.12 +  </li>
   18.13 +  <ol>
   18.14 +    <li>Open test9.ics.</li>
   18.15 +    <li>Select "Music".</li>
   18.16 +    <li>Move it down.</li>
   18.17 +    <li>"Music" still selected.</li>
   18.18 +    <li value="2">Select "Music/Pop".</li>
   18.19 +    <li>Move it down.</li>
   18.20 +    <li>"Music/Pop" still selected.</li>
   18.21    </ol>
   18.22  </ol>
   18.23  </body>