org.argouml.cognitive
Class DesignMaterial

java.lang.Object
  extended byjava.util.Observable
      extended byorg.argouml.cognitive.DesignMaterial
All Implemented Interfaces:
org.tigris.gef.ui.Highlightable, java.io.Serializable
Direct Known Subclasses:
Design

public abstract class DesignMaterial
extends java.util.Observable
implements org.tigris.gef.ui.Highlightable, java.io.Serializable

Abstract class to represent the materials being used in design. The nature of these materials is domain-dependent. For example, in the domain of software architecture the design materials are software components and connectors. There is not much that can be said about generic design materials at this level of abstraction. But the Argo kernel provides for all DesignMaterials to (1) be Observable, (2) have Properties (in addition to instance variables supplied in subclasses) that can be shown in a property sheet, (3) ask Agency to critique them, (4) keep a list of the ToDoItem's that are generated from that critiquing, (5) be notified when the user selects them in an editor, (6) highlight themselves to draw the designer's attention.

TODO: should I implement virtual copying? or instance-based inheritiance of properties? How are properties shared (it at all)? For examples of subclasing see the package jargo.softarch. For instructions on how to define subclasses for DesignMaterials in your domain, see the Argo cookbook entry for define_design_material

See Also:
Design, Serialized Form

Field Summary
protected  boolean _highlight
           
protected  java.util.Vector _parents
          Other DesignMaterial's that contain this one.
protected  ToDoList _pendingItems
          ToDoList items that are on the designers ToDoList because of this material.
protected  java.util.Vector _persistObservers
          Observers of this object that should be saved and loaded with this object.
protected  java.util.Vector _propertyListeners
           
protected  java.util.Hashtable _props
          "Soft" Properties that this DesignMaterial may have, but we do not want to allocate an instance variable to them.
 
Constructor Summary
DesignMaterial()
          Construct a new DesignMaterial with empty Properties.
DesignMaterial(java.util.Hashtable ht)
          Construct a new DesignMaterial with the given Properties.
 
Method Summary
 void addPersistantObserver(java.util.Observer o)
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 boolean canPut(java.lang.String key)
           
 void changedProperty(java.lang.String key)
           
 void critique(Designer dsgr)
          Critique this DesignMaterial and post ToDoItem's to the Designer's list.
 void define(java.lang.String k, boolean v)
          Set the value of a property iff it is not already set.
 void define(java.lang.String k, int v)
          Set the value of a property iff it is not already set.
 boolean define(java.lang.String k, java.lang.Object v)
           
 void dispose()
          Remove this DesignMaterial from the design document and free up memory and other resources as much as possible.
 void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
           
 void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
           
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 java.lang.Object get(java.lang.String k)
           
 java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
           
 boolean getBoolean(java.lang.String k)
          Convenient function for getting the value of boolean properties.
 boolean getBoolProperty(java.lang.String k)
          Reply the value an boolean property, if not found reply false.
 boolean getBoolProperty(java.lang.String k, boolean defaultValue)
          Reply the value an int property, if not found reply defaultValue.
 boolean getHighlight()
           
 int getIntProperty(java.lang.String k)
          Reply the value an int property, if not found reply 0.
 int getIntProperty(java.lang.String k, int defaultValue)
          Reply the value an int property, if not found reply defaultValue.
 java.lang.Object getProperty(java.lang.String k)
          Reply the value of one property, if not found reply null.
 java.lang.Object getProperty(java.lang.String key, java.lang.Object defaultValue)
          Reply the value of one property, if not found reply defaultValue.
 void inform(ToDoItem item)
          When a critic produces a ToDoItem, both the Designer and the "offending" DesignMaterial's are notified.
 java.util.Enumeration keysIn(java.lang.String cat)
           
 void notifyObservers(java.lang.Object arg)
           
 void notifyPersistantObservers(java.lang.Object arg)
           
 java.util.Enumeration parents()
          Enumerate over all my parents.
 void put(java.util.Hashtable ht)
           
 boolean put(java.lang.String k, boolean v)
          Convenient function for setting the value of boolean properties.
 boolean put(java.lang.String k, int v)
          Convenient function for setting the value of boolean properties.
 boolean put(java.lang.String k, java.lang.Object v)
          Set the value of a property.
 void removePendingItems(Designer dsgr)
          Remove all the ToDoItem's generated by this DesignMaterial from the ToDoList of the given Designer.
 void removePersistObserver(java.util.Observer o)
           
 java.lang.Object removeProperty(java.lang.String k)
          Make the given property undefined.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setHighlight(boolean h)
          Draw the Designer's attention to this DesignMaterial in all views.
 void setProperty(java.lang.String k, boolean v)
           
 void setProperty(java.lang.String k, int v)
           
 void setProperty(java.lang.String k, java.lang.Object v)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_persistObservers

protected java.util.Vector _persistObservers
Observers of this object that should be saved and loaded with this object.


_propertyListeners

protected transient java.util.Vector _propertyListeners

_pendingItems

protected ToDoList _pendingItems
ToDoList items that are on the designers ToDoList because of this material.


_parents

protected java.util.Vector _parents
Other DesignMaterial's that contain this one.


_props

protected java.util.Hashtable _props
"Soft" Properties that this DesignMaterial may have, but we do not want to allocate an instance variable to them.


_highlight

protected boolean _highlight
Constructor Detail

DesignMaterial

public DesignMaterial()
Construct a new DesignMaterial with empty Properties.


DesignMaterial

public DesignMaterial(java.util.Hashtable ht)
Construct a new DesignMaterial with the given Properties.

Method Detail

parents

public java.util.Enumeration parents()
Enumerate over all my parents. For now most DesignMaterial's have just one parent, but I think this might be useful in the future.


getProperty

public java.lang.Object getProperty(java.lang.String key,
                                    java.lang.Object defaultValue)
Reply the value of one property, if not found reply defaultValue. Even if subclasses store some properties in instance variables, they should implement this method to give acces to those instance variables by name.


getProperty

public java.lang.Object getProperty(java.lang.String k)
Reply the value of one property, if not found reply null.


get

public java.lang.Object get(java.lang.String k)

get

public java.lang.Object get(java.lang.String key,
                            java.lang.Object defaultValue)

getIntProperty

public int getIntProperty(java.lang.String k)
Reply the value an int property, if not found reply 0.


getIntProperty

public int getIntProperty(java.lang.String k,
                          int defaultValue)
Reply the value an int property, if not found reply defaultValue.


getBoolProperty

public boolean getBoolProperty(java.lang.String k)
Reply the value an boolean property, if not found reply false.


getBoolProperty

public boolean getBoolProperty(java.lang.String k,
                               boolean defaultValue)
Reply the value an int property, if not found reply defaultValue.


put

public boolean put(java.lang.String k,
                   java.lang.Object v)
Set the value of a property.


put

public void put(java.util.Hashtable ht)

put

public boolean put(java.lang.String k,
                   boolean v)
Convenient function for setting the value of boolean properties.


put

public boolean put(java.lang.String k,
                   int v)
Convenient function for setting the value of boolean properties.


setProperty

public void setProperty(java.lang.String k,
                        java.lang.Object v)

setProperty

public void setProperty(java.lang.String k,
                        int v)

setProperty

public void setProperty(java.lang.String k,
                        boolean v)

define

public boolean define(java.lang.String k,
                      java.lang.Object v)

canPut

public boolean canPut(java.lang.String key)

keysIn

public java.util.Enumeration keysIn(java.lang.String cat)

define

public void define(java.lang.String k,
                   boolean v)
Set the value of a property iff it is not already set.


define

public void define(java.lang.String k,
                   int v)
Set the value of a property iff it is not already set.


removeProperty

public java.lang.Object removeProperty(java.lang.String k)
Make the given property undefined.


getBoolean

public boolean getBoolean(java.lang.String k)
Convenient function for getting the value of boolean properties.


critique

public void critique(Designer dsgr)
Critique this DesignMaterial and post ToDoItem's to the Designer's list. By default this is done by asking Agency.


removePendingItems

public void removePendingItems(Designer dsgr)
Remove all the ToDoItem's generated by this DesignMaterial from the ToDoList of the given Designer. For example, this could be called when the DesignMaterial is deleted from the design document.


dispose

public void dispose()
Remove this DesignMaterial from the design document and free up memory and other resources as much as possible.


inform

public void inform(ToDoItem item)
When a critic produces a ToDoItem, both the Designer and the "offending" DesignMaterial's are notified. By default the ToDoItem is added to the list of generated ToDoItem's. Subclasses may, for example, visually change their appearance to indicate the presence of an error. One paper called this 'clarifiers'.

TODO: do I need a Clarifier object in the framework?


setHighlight

public void setHighlight(boolean h)
Draw the Designer's attention to this DesignMaterial in all views.

Specified by:
setHighlight in interface org.tigris.gef.ui.Highlightable

getHighlight

public boolean getHighlight()
Specified by:
getHighlight in interface org.tigris.gef.ui.Highlightable

changedProperty

public void changedProperty(java.lang.String key)

addPersistantObserver

public void addPersistantObserver(java.util.Observer o)

removePersistObserver

public void removePersistObserver(java.util.Observer o)

notifyPersistantObservers

public void notifyPersistantObservers(java.lang.Object arg)

notifyObservers

public void notifyObservers(java.lang.Object arg)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface org.tigris.gef.ui.Highlightable

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface org.tigris.gef.ui.Highlightable

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               boolean oldValue,
                               boolean newValue)

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               int oldValue,
                               int newValue)

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)


ArgoUML © 1996-2003 (20030829)ArgoUML Project HomeArgoUML Cookbook