org.argouml.cognitive
Class ToDoList

java.lang.Object
  extended byjava.util.Observable
      extended byorg.argouml.cognitive.ToDoList
All Implemented Interfaces:
Runnable, Serializable

public class ToDoList
extends Observable
implements Runnable, Serializable

Implements a list of ToDoItem's.

It spawns a "sweeper" thread that periodically goes through the list and elimiates ToDoItem's that are no longer valid.

One difficulty designers face is keeping track of all the myrid details of thier task. It is all to easy to skip a step in the design process, leave part of the design unspecified, of make a mistake that requires revision. Argo provides the designer with a "to do" list user interface that presents action items in an organized form. These items can be suggestions from critics, reminders to finish steps in the process model, or personal notes entered by the designer. The choice control at the top of the "to do" list pane allow the designer to organize items in different ways: by priority, by decision supported, by offending design element, etc.

The to do lists right now are a bit unstable. Please test and let us know what you find through Issuezilla.

Items are shown under all applicable headings. The "to do" list may also be viewed as a flat list.

This class is dependent on Designer.

See Also:
Designer.nondisruptivelyWarn(org.argouml.cognitive.ToDoItem), Serialized Form

Field Summary
private  org.tigris.gef.util.VectorSet allOffenders
          These are computed when needed.
private  org.tigris.gef.util.VectorSet allPosters
          These are computed when needed.
private  Designer designer
          The designer, used in determining if a ToDoItem is still valid.
private  boolean isPaused
          state variable for whether the validity checking thread is paused (waiting).
private  Vector items
          Pending ToDoItems for the designer to consider.
private  EventListenerList listenerList
           
private static Logger LOG
           
private static int longestToDoList
           
private static int numNotValid
           
private static Object recentOffender
           
private static Vector recentOffenderItems
           
private  Vector resolvedItems
          ToDoItems that the designer has explicitly indicated that (s)he considers resolved.
private static ToDoList theInstance
          The ToDoList instance that is also the validity checking thread.
private  Thread validityChecker
          A Thread that keeps checking if the items on the list are still valid.
 
Fields inherited from class java.util.Observable
 
Constructor Summary
ToDoList()
          creates a new todolist.
 
Method Summary
 void addAll(ToDoList list)
           
private  void addE(ToDoItem item)
          needs documenting, why synchronised?
 void addElement(ToDoItem item)
           
private  void addOffenders(org.tigris.gef.util.VectorSet newoffs)
           
private  void addPosters(Poster newp)
           
 void addToDoListListener(ToDoListListener l)
           
 ToDoItem elementAt(int index)
           
 Enumeration elements()
           
 Vector elementsForOffender(Object off)
           
 boolean explicitlyResolve(ToDoItem item, String reason)
           
protected  void fireToDoItemAdded(ToDoItem item)
           
protected  void fireToDoItemChanged(ToDoItem item)
           
protected  void fireToDoItemRemoved(ToDoItem item)
           
protected  void fireToDoItemsAdded(Vector theItems)
           
protected  void fireToDoItemsRemoved(Vector theItems)
           
protected  void fireToDoListChanged()
          Notify all listeners that have registered interest for notification on this event type.
 void forceValidityCheck()
          Check each ToDoItem on the list to see if it is still valid.
protected  void forceValidityCheck(Vector removes)
          Check each ToDoItem on the list to see if it is still valid.
static Vector getDecisions()
           
static Vector getGoals()
           
static ToDoList getInstance()
          Returns the validity checking thread instance.
 org.tigris.gef.util.VectorSet getOffenders()
           
 org.tigris.gef.util.VectorSet getPosters()
           
 Vector getResolvedItems()
           
 Vector getToDoItems()
           
 boolean isPaused()
           
 void notifyObservers()
           
 void notifyObservers(Object o)
           
 void notifyObservers(String action, Object arg)
           
 void pause()
          Pause.
protected  void recomputeAllOffenders()
          Re-compute all offenders.
protected  void recomputeAllPosters()
          Reset all posters.
 void removeAll(ToDoList list)
           
 void removeAllElements()
          Remove all todo items.
private  boolean removeE(ToDoItem item)
           
 boolean removeElement(ToDoItem item)
           
 void removeToDoListListener(ToDoListListener l)
           
 boolean resolve(ToDoItem item)
           
 void resume()
          Resume.
 void run()
          Periodically check to see if items on the list are still valid.
 void setPaused(boolean paused)
          sets the pause state.
 int size()
           
 void spawnValidityChecker(Designer d)
          Start a Thread to delete old items from the ToDoList.
 String toString()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG

recentOffender

private static Object recentOffender

recentOffenderItems

private static Vector recentOffenderItems

items

private Vector items
Pending ToDoItems for the designer to consider.


allOffenders

private org.tigris.gef.util.VectorSet allOffenders
These are computed when needed.


allPosters

private org.tigris.gef.util.VectorSet allPosters
These are computed when needed.


resolvedItems

private Vector resolvedItems
ToDoItems that the designer has explicitly indicated that (s)he considers resolved.

TODO: generalize into a design rationale logging facility.


validityChecker

private Thread validityChecker
A Thread that keeps checking if the items on the list are still valid.


designer

private Designer designer
The designer, used in determining if a ToDoItem is still valid.


listenerList

private EventListenerList listenerList

longestToDoList

private static int longestToDoList

numNotValid

private static int numNotValid

theInstance

private static ToDoList theInstance
The ToDoList instance that is also the validity checking thread. this thread should probably be factored out...


isPaused

private boolean isPaused
state variable for whether the validity checking thread is paused (waiting).

Constructor Detail

ToDoList

public ToDoList()
creates a new todolist. use getInstance() if you want to create the validity checking thread.

Method Detail

getInstance

public static ToDoList getInstance()
Returns the validity checking thread instance.

Returns:
the validity checking thread instance

spawnValidityChecker

public void spawnValidityChecker(Designer d)
Start a Thread to delete old items from the ToDoList.

Parameters:
d - the designer

run

public void run()
Periodically check to see if items on the list are still valid.

Specified by:
run in interface Runnable

forceValidityCheck

public void forceValidityCheck()
Check each ToDoItem on the list to see if it is still valid. If not, then remove that item. This is called automatically by the ValidityCheckingThread, and it can be called by the user pressing a button via forceValidityCheck().


forceValidityCheck

protected void forceValidityCheck(Vector removes)
Check each ToDoItem on the list to see if it is still valid. If not, then remove that item. This is called automatically by the ValidityCheckingThread, and it can be called by the user pressing a button via forceValidityCheck().

Warning: Fragile code! No method that this method calls can synchronized the Designer, otherwise there will be deadlock.

Parameters:
removes - the items removed

pause

public void pause()
Pause.


resume

public void resume()
Resume.


isPaused

public boolean isPaused()
Returns:
true is paused

setPaused

public void setPaused(boolean paused)
sets the pause state.

Parameters:
paused - if set to false, calls resume() also to start working

notifyObservers

public void notifyObservers(String action,
                            Object arg)
Parameters:
action - the action
arg - the argument

notifyObservers

public void notifyObservers(Object o)
See Also:
Observable.notifyObservers(Object)

notifyObservers

public void notifyObservers()
See Also:
Observable.notifyObservers()

getToDoItems

public Vector getToDoItems()
Returns:
the todo items

getResolvedItems

public Vector getResolvedItems()
Returns:
the resolved items

getOffenders

public org.tigris.gef.util.VectorSet getOffenders()
Returns:
the set of offenders

addOffenders

private void addOffenders(org.tigris.gef.util.VectorSet newoffs)

getPosters

public org.tigris.gef.util.VectorSet getPosters()
Returns:
the set of all the posters

addPosters

private void addPosters(Poster newp)

getDecisions

public static Vector getDecisions()
Returns:
the decisions

getGoals

public static Vector getGoals()
Returns:
the goals

addE

private void addE(ToDoItem item)
needs documenting, why synchronised?


addElement

public void addElement(ToDoItem item)
Parameters:
item - the todo item to be added

addAll

public void addAll(ToDoList list)
Parameters:
list - the todo items to be added

removeAll

public void removeAll(ToDoList list)
Parameters:
list - the todo items to be removed

removeE

private boolean removeE(ToDoItem item)
Parameters:
item - the todo item to be removed
Returns:
true if the argument was a component of this vector; false otherwise

removeElement

public boolean removeElement(ToDoItem item)
Parameters:
item - the todo item to be removed
Returns:
true if the argument was a component of this vector; false otherwise

resolve

public boolean resolve(ToDoItem item)
Parameters:
item - the todo item to be resolved
Returns:
true if the argument was a component of this vector; false otherwise

explicitlyResolve

public boolean explicitlyResolve(ToDoItem item,
                                 String reason)
                          throws UnresolvableException
Parameters:
item - the todo item
reason - the reason
Returns:
true if the argument was a component of this vector; false otherwise
Throws:
UnresolvableException - unable to resolve

removeAllElements

public void removeAllElements()
Remove all todo items.


elementsForOffender

public Vector elementsForOffender(Object off)
Parameters:
off - the offender
Returns:
the todo tems for this offender

size

public int size()
Returns:
the number of todo items

elements

public Enumeration elements()
Returns:
the todo items

elementAt

public ToDoItem elementAt(int index)
Parameters:
index - an index into the todo items list
Returns:
the item at the index

recomputeAllOffenders

protected void recomputeAllOffenders()
Re-compute all offenders.


recomputeAllPosters

protected void recomputeAllPosters()
Reset all posters.


addToDoListListener

public void addToDoListListener(ToDoListListener l)
Parameters:
l - the listener to be added

removeToDoListListener

public void removeToDoListListener(ToDoListListener l)
Parameters:
l - the listener to be removed

fireToDoListChanged

protected void fireToDoListChanged()
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

See Also:
EventListenerList

fireToDoItemChanged

protected void fireToDoItemChanged(ToDoItem item)
Parameters:
item - the todo item

fireToDoItemAdded

protected void fireToDoItemAdded(ToDoItem item)
Parameters:
item - the todo item

fireToDoItemsAdded

protected void fireToDoItemsAdded(Vector theItems)
Parameters:
theItems - the todo items

fireToDoItemRemoved

protected void fireToDoItemRemoved(ToDoItem item)
Parameters:
item - the todo item

fireToDoItemsRemoved

protected void fireToDoItemsRemoved(Vector theItems)
Parameters:
theItems - the todo items

toString

public String toString()
See Also:
Object.toString()


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook