algoanim.properties
Class AnimationProperties

java.lang.Object
  extended by algoanim.properties.AnimationProperties
Direct Known Subclasses:
ArcProperties, ArrayMarkerProperties, ArrayProperties, CallMethodProperties, CircleProperties, CircleSegProperties, EllipseProperties, EllipseSegProperties, GraphProperties, ListElementProperties, MatrixProperties, PointProperties, PolygonProperties, PolylineProperties, QueueProperties, RectProperties, SourceCodeProperties, SquareProperties, StackProperties, TextProperties, TriangleProperties, VHDLElementProperties, VHDLWireProperties

public abstract class AnimationProperties
extends java.lang.Object

Description of the Properties system: Every type of all languages has its associated class in the primitives package and an own properties class which holds the relevant informations to display the object. These properties classes are based on a HashMap consisting of pairs of a String key and a PropertyItem. Each PropertyItem is represented by an object of a definite class which is able to work properly on its internal data. There are types for color, font and integer PropertyItems for example. But actually this underlying concept is not visible to the user.

Author:
Jens Pfau, Stephan Mehlhase, T. Ackermann

Field Summary
protected  java.util.HashMap<java.lang.String,AnimationPropertyItem> data
          Contains a mapping from String keys to PropertyItems.
 
Constructor Summary
AnimationProperties()
          Default Constructor The constructor in the derivated classes *MUST* fill the data HashMap with keys and appropriate AnimationPropertyItems.
AnimationProperties(java.lang.String name)
          Constructor which receives the name of the property.
 
Method Summary
 void fillAdditional()
          This function takes all keys from the data HashMap and fills the isEditable and labels HashMaps with appropriate values.
protected abstract  void fillHashMap()
          Fills the internal data HashMap with values and copies them to all other Hashmaps.
 java.lang.Object get(java.lang.String key)
          Searches the map for the value according to the given key.
 java.util.Set<java.lang.String> getAllPropertyNames()
          Returns a Set view on all possible keys provided by a concrete AnimationProperties.
 java.util.Vector<java.lang.String> getAllPropertyNamesVector()
          Returns a Set view on all possible keys provided by a concrete AnimationProperties.
static java.util.Vector<java.lang.String> getAllPropertyTypes()
          Returns a Vector of Strings with all classnames which are in this package and can be used.
 AnimationPropertyItem getDefault(java.lang.String key)
          Returns the default value for the given key (as an Object).
 boolean getIsEditable(java.lang.String key)
          Returns wether an item is editable by the end-user of the Generator-GUI.
 AnimationPropertyItem getItem(java.lang.String key)
          Searches the map for the item according to the given key.
 java.lang.String getLabel(java.lang.String key)
          Returns the label of the item.
 void set(java.lang.String key, boolean value)
          Sets the PropertyItem associated with the key to the new value.
 void set(java.lang.String key, java.awt.Color value)
          Sets the PropertyItem associated with the key to the new value.
 void set(java.lang.String key, java.awt.Font value)
          Sets the PropertyItem associated with the key to the new value.
 void set(java.lang.String key, int value)
          Sets the PropertyItem associated with the key to the new value.
 void set(java.lang.String key, java.lang.Object value)
          Sets the PropertyItem associated with the key to the new value.
 void set(java.lang.String key, java.lang.String value)
          Sets the PropertyItem associated with the key to the new value.
 void setDefault(java.lang.String key, AnimationPropertyItem value)
          Sets the default value for the given key.
 void setIsEditable(java.lang.String key, boolean value)
          Sets wether an item is editable by the end-user of the Generator GUI.
 void setLabel(java.lang.String key, java.lang.String value)
          Sets the label of the given item.
 void setName(java.lang.String newName)
          Inserts the "name" items into the HashMaps.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.util.HashMap<java.lang.String,AnimationPropertyItem> data
Contains a mapping from String keys to PropertyItems.

Constructor Detail

AnimationProperties

public AnimationProperties()
Default Constructor The constructor in the derivated classes *MUST* fill the data HashMap with keys and appropriate AnimationPropertyItems.


AnimationProperties

public AnimationProperties(java.lang.String name)
Constructor which receives the name of the property. The constructor in the derivated classes *MUST* fill the data HashMap with keys and appropriate AnimationPropertyItems.

Parameters:
name - the name of the Properties object.
Method Detail

setName

public void setName(java.lang.String newName)
Inserts the "name" items into the HashMaps.

Parameters:
newName - The initial name for this Propertie.

fillHashMap

protected abstract void fillHashMap()
Fills the internal data HashMap with values and copies them to all other Hashmaps.


fillAdditional

public void fillAdditional()
This function takes all keys from the data HashMap and fills the isEditable and labels HashMaps with appropriate values. (All Elements of isEditable are false by default and all elementes of labels are empty Strings.)


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getAllPropertyNames

public java.util.Set<java.lang.String> getAllPropertyNames()
Returns a Set view on all possible keys provided by a concrete AnimationProperties.

Returns:
a Set view on all possible keys provided by a concrete AnimationProperties.

getAllPropertyNamesVector

public java.util.Vector<java.lang.String> getAllPropertyNamesVector()
Returns a Set view on all possible keys provided by a concrete AnimationProperties.

Returns:
a Set view on all possible keys provided by a concrete AnimationProperties.

getAllPropertyTypes

public static final java.util.Vector<java.lang.String> getAllPropertyTypes()
Returns a Vector of Strings with all classnames which are in this package and can be used.

Returns:
a Vector of Strings with all classnames which are in this package and can be used.

getItem

public AnimationPropertyItem getItem(java.lang.String key)
                              throws java.lang.IllegalArgumentException
Searches the map for the item according to the given key.

Parameters:
key - The key of the item.
Returns:
The AnimationPropertyItem with the given key.
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                int value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as an int).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                java.lang.String value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as a String).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                boolean value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as a boolean).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                java.awt.Color value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as a Color).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                java.awt.Font value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as a Font).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

set

public void set(java.lang.String key,
                java.lang.Object value)
         throws java.lang.IllegalArgumentException
Sets the PropertyItem associated with the key to the new value.

Parameters:
key - the key of the item.
value - the new value (as an Object).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

get

public java.lang.Object get(java.lang.String key)
                     throws java.lang.IllegalArgumentException
Searches the map for the value according to the given key.

Parameters:
key - the key of the item.
Returns:
the value of the item.
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

getDefault

public AnimationPropertyItem getDefault(java.lang.String key)
                                 throws java.lang.IllegalArgumentException
Returns the default value for the given key (as an Object).

Parameters:
key - the key of the item.
Returns:
the default value for the given key (as an Object).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

setDefault

public void setDefault(java.lang.String key,
                       AnimationPropertyItem value)
                throws java.lang.IllegalArgumentException
Sets the default value for the given key.

Parameters:
key - the key of the item.
value - the new default value (as an Object).
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

getIsEditable

public boolean getIsEditable(java.lang.String key)
                      throws java.lang.IllegalArgumentException
Returns wether an item is editable by the end-user of the Generator-GUI.

Parameters:
key - the key of the item.
Returns:
wether the item is editable?
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

setIsEditable

public void setIsEditable(java.lang.String key,
                          boolean value)
                   throws java.lang.IllegalArgumentException
Sets wether an item is editable by the end-user of the Generator GUI.

Parameters:
key - the key of the item.
value - wether the item should be editable.
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

getLabel

public java.lang.String getLabel(java.lang.String key)
                          throws java.lang.IllegalArgumentException
Returns the label of the item.

Parameters:
key - the key of the item.
Returns:
the label of the item.
Throws:
java.lang.IllegalArgumentException - if the item doesn't exist.

setLabel

public void setLabel(java.lang.String key,
                     java.lang.String value)
Sets the label of the given item.

Parameters:
key - the key of the item.
value - the new label for the item.