TaskList.getRoot() deprecated. BLD200404271353
authorpkuzel@netbeans.org
Tue, 27 Apr 2004 13:47:23 +0000
changeset 446884e2622f1608
parent 4467 9d62ae81bd38
child 4469 2ff010dcbb39
TaskList.getRoot() deprecated.
suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/DefaultSuggestionManager.java
suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionList.java
suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionManagerImpl.java
suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionsBroker.java
tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/Bug.java
tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/BugList.java
tasklist.core/src/org/netbeans/modules/tasklist/core/ObservableList.java
tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java
tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java
tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/FilteredTasksList.java
     1.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/DefaultSuggestionManager.java	Tue Apr 27 09:51:11 2004 +0000
     1.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/DefaultSuggestionManager.java	Tue Apr 27 13:47:23 2004 +0000
     1.3 @@ -226,7 +226,7 @@
     1.4              if (category != null) {
     1.5                  currnum = category.subtasksCount();
     1.6              } else {
     1.7 -                Iterator it = tasklist.getRoot().subtasksIterator();
     1.8 +                Iterator it = tasklist.getTasks().iterator();
     1.9                  while (it.hasNext()) {
    1.10                      SuggestionImpl s = (SuggestionImpl) it.next();
    1.11                      if (s.getSType() == type) {
    1.12 @@ -254,7 +254,7 @@
    1.13                          }
    1.14                          if (currnum - remnum > 0) {
    1.15                              leftover = new ArrayList(currnum);
    1.16 -                            Iterator it = tasklist.getRoot().subtasksIterator();
    1.17 +                            Iterator it = tasklist.getTasks().iterator();
    1.18                              while (it.hasNext()) {
    1.19                                  SuggestionImpl s = (SuggestionImpl) it.next();
    1.20                                  if ((s.getSType() == type) &&
     2.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionList.java	Tue Apr 27 09:51:11 2004 +0000
     2.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionList.java	Tue Apr 27 13:47:23 2004 +0000
     2.3 @@ -165,7 +165,7 @@
     2.4      SuggestionImpl findAfter(SuggestionType type) {
     2.5          SuggestionImpl after = null;
     2.6          int pos = type.getPosition();
     2.7 -        Iterator it = getRoot().subtasksIterator();
     2.8 +        Iterator it = getTasks().iterator();
     2.9          while (it.hasNext()) {
    2.10              SuggestionImpl s = (SuggestionImpl)it.next();
    2.11              int spos = s.getSType().getPosition();
    2.12 @@ -191,12 +191,11 @@
    2.13      }
    2.14  
    2.15      synchronized void removeCategory(SuggestionType type) {
    2.16 -        Task root = getRoot();
    2.17 -        if (root.subtasksCount() == 0) {
    2.18 +        if (getTasks().size() == 0) {
    2.19              categoryTasks = null;
    2.20              return;
    2.21          }
    2.22 -        Iterator ti = root.subtasksIterator();
    2.23 +        Iterator ti = getTasks().iterator();
    2.24          ArrayList removeTasks = new ArrayList(50);
    2.25          while (ti.hasNext()) {
    2.26              SuggestionImpl suggestion = (SuggestionImpl)ti.next();
     3.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionManagerImpl.java	Tue Apr 27 09:51:11 2004 +0000
     3.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionManagerImpl.java	Tue Apr 27 13:47:23 2004 +0000
     3.3 @@ -372,7 +372,7 @@
     3.4          if (type != null) {
     3.5              // "Flatten" the list when I'm filtering so that I don't show
     3.6              // category nodes!
     3.7 -            List oldList = tasklist.getRoot().getSubtasks();
     3.8 +            List oldList = tasklist.getTasks();
     3.9  
    3.10              if (oldList != null) {
    3.11                  List allTasks = new ArrayList(oldList.size());
    3.12 @@ -404,7 +404,7 @@
    3.13              }
    3.14          } else {
    3.15              tasklist.clearCategoryTasks();
    3.16 -            List oldList = tasklist.getRoot().getSubtasks();
    3.17 +            List oldList = tasklist.getTasks();
    3.18              List suggestions = new ArrayList();
    3.19              if (oldList != null)
    3.20                  suggestions.addAll(oldList);
     4.1 --- a/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionsBroker.java	Tue Apr 27 09:51:11 2004 +0000
     4.2 +++ b/suggestions_framework/src/org/netbeans/modules/tasklist/suggestions/SuggestionsBroker.java	Tue Apr 27 13:47:23 2004 +0000
     4.3 @@ -641,7 +641,7 @@
     4.4                          clones.add(next.cloneTask());
     4.5                      }
     4.6  
     4.7 -                    List previous = new ArrayList(getCurrentSuggestionsList().getRoot().getSubtasks());
     4.8 +                    List previous = new ArrayList(getCurrentSuggestionsList().getTasks());
     4.9                      getCurrentSuggestionsList().addRemove(clones, previous, false, null, null);
    4.10  
    4.11                  }
    4.12 @@ -680,12 +680,11 @@
    4.13          // to just reuse it, since the document must not have been edited!
    4.14  
    4.15          SuggestionList tasklist = getCurrentSuggestionsList();
    4.16 -        Task root = tasklist.getRoot();
    4.17 -        if (root.subtasksCount() == 0) {
    4.18 +        if (tasklist.getTasks().size() == 0) {
    4.19              return;
    4.20          }
    4.21 -        Iterator it = root.subtasksIterator();
    4.22 -        List sgs = new ArrayList(root.subtasksCount());
    4.23 +        Iterator it = tasklist.getTasks().iterator();
    4.24 +        List sgs = new ArrayList(tasklist.getTasks().size());
    4.25          while (it.hasNext()) {
    4.26              SuggestionImpl s = (SuggestionImpl) it.next();
    4.27              Object seed = s.getSeed();
     5.1 --- a/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/Bug.java	Tue Apr 27 09:51:11 2004 +0000
     5.2 +++ b/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/Bug.java	Tue Apr 27 13:47:23 2004 +0000
     5.3 @@ -309,13 +309,6 @@
     5.4      }
     5.5  
     5.6      /**
     5.7 -     * Get rid of the children/subtasks associated with this task
     5.8 -     */
     5.9 -    void dropSubtasks() {
    5.10 -        subtasks = null;
    5.11 -    }
    5.12 -
    5.13 -    /**
    5.14       * View the particular bug in current view
    5.15       */
    5.16      void view() {
     6.1 --- a/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/BugList.java	Tue Apr 27 09:51:11 2004 +0000
     6.2 +++ b/tasklist.bugs/src/org/netbeans/modules/tasklist/bugs/BugList.java	Tue Apr 27 13:47:23 2004 +0000
     6.3 @@ -94,10 +94,7 @@
     6.4  
     6.5      /** Update the contents to show the given list */
     6.6      public void setBugs(List issues) {
     6.7 -        Bug parent = (Bug)getRoot();
     6.8 -        parent.dropSubtasks();
     6.9 -
    6.10 -        addRemove(issues, null, false, null, null);
    6.11 +        addRemove(issues, getTasks(), false, null, null);
    6.12      }
    6.13      
    6.14  //    public void addBug(List issue) {
     7.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/ObservableList.java	Tue Apr 27 09:51:11 2004 +0000
     7.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/ObservableList.java	Tue Apr 27 13:47:23 2004 +0000
     7.3 @@ -13,6 +13,8 @@
     7.4  
     7.5  package org.netbeans.modules.tasklist.core;
     7.6  
     7.7 +import java.util.List;
     7.8 +
     7.9  /**
    7.10   * Readonly live tasklist interface.
    7.11   *
    7.12 @@ -30,10 +32,19 @@
    7.13       * holder is impl issue and clients
    7.14       * use mutation methods using writeable
    7.15       * tasklist interface
    7.16 +     *
    7.17 +     * @deprecated by {@link #getTasks}
    7.18       */
    7.19      Task getRoot();
    7.20  
    7.21      /**
    7.22 +     * Access top level tasks in the list.
    7.23 +     *
    7.24 +     * @return List&lt;Task> never <code>null</code>
    7.25 +     */
    7.26 +    List getTasks();
    7.27 +
    7.28 +    /**
    7.29       * The listener is notifiead about list modifications
    7.30       */
    7.31      void addTaskListener(TaskListener l);
     8.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java	Tue Apr 27 09:51:11 2004 +0000
     8.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/Task.java	Tue Apr 27 13:47:23 2004 +0000
     8.3 @@ -48,7 +48,7 @@
     8.4       */
     8.5      static final String PROP_ATTRS_CHANGED = "attrs"; // NOI18N
     8.6  
     8.7 -    /** Set&lt;TaskListener> */  // replacement for above attribute
     8.8 +    /** Set&lt;TaskListener> */
     8.9      private Set listeners = new HashSet(2);
    8.10  
    8.11      private boolean visitable;
    8.12 @@ -69,7 +69,10 @@
    8.13  
    8.14      /** When true, this item has been removed from a list.
    8.15          The old list reference is still kept around so that
    8.16 -        we can use it to search for a reincarnation of the task. */
    8.17 +        we can use it to search for a reincarnation of the task.
    8.18 +
    8.19 +        @deprecated duplicates isValid property
    8.20 +     */
    8.21      private boolean zombie = false;
    8.22  
    8.23      public Task() {
     9.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java	Tue Apr 27 09:51:11 2004 +0000
     9.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskList.java	Tue Apr 27 13:47:23 2004 +0000
     9.3 @@ -15,10 +15,7 @@
     9.4  
     9.5  
     9.6  import java.io.*;
     9.7 -import java.util.ArrayList;
     9.8 -import java.util.Iterator;
     9.9 -import java.util.List;
    9.10 -import java.util.ListIterator;
    9.11 +import java.util.*;
    9.12  
    9.13  import org.netbeans.modules.tasklist.core.translators.XMLTranslator;
    9.14  import org.netbeans.modules.tasklist.core.translators.HTMLSupport;
    9.15 @@ -86,6 +83,11 @@
    9.16          return root;
    9.17      }
    9.18  
    9.19 +    /** Access tasks held by this list. */
    9.20 +    public final List getTasks() {
    9.21 +        return getRoot().getSubtasks();
    9.22 +    }
    9.23 +
    9.24      /** Add a list of tasks to the tasklist, and remove a list of
    9.25       *	tasks from the tasklist. This is done instead of a separate
    9.26       *  add and remove method such that you can change the tasklist
    10.1 --- a/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/FilteredTasksList.java	Tue Apr 27 09:51:11 2004 +0000
    10.2 +++ b/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/FilteredTasksList.java	Tue Apr 27 13:47:23 2004 +0000
    10.3 @@ -64,6 +64,10 @@
    10.4          return root;
    10.5      }
    10.6  
    10.7 +    public List getTasks() {
    10.8 +        return getRoot().getSubtasks();
    10.9 +    }
   10.10 +
   10.11      public synchronized void addTaskListener(TaskListener l) {
   10.12          // we do not add directly to peer
   10.13          // because we filter fired events
   10.14 @@ -141,7 +145,7 @@
   10.15       */
   10.16      private class EventHandler implements TaskListener {
   10.17          public void selectedTask(Task t) {
   10.18 -            if (getRoot().containsSubtask(t)) {
   10.19 +            if (getTasks().contains(t)) {
   10.20                  Iterator it = listeners.iterator();
   10.21                  while (it.hasNext()) {
   10.22                      TaskListener listener = (TaskListener) it.next();
   10.23 @@ -185,7 +189,7 @@
   10.24                      // find pairing task by key identity
   10.25                      Object key = t.getKey();
   10.26                      Task remove = null;
   10.27 -                    Iterator it = getRoot().subtasksIterator();
   10.28 +                    Iterator it = getTasks().iterator();
   10.29                      while (it.hasNext()) {
   10.30                          Task task = (Task) it.next();
   10.31                          if (key == task.getKey()) {