fdda.model
Interface Property

All Superinterfaces:
Cloneable
All Known Implementing Classes:
Property

public interface Property
extends Cloneable

A property of a part of a model. Properties have a certain Type. Each property can hold one or more Values of this type. This type can e.g. be Integer, String, Boolean, Date, or anything more complex. A type can only be used, though, if a related class exists that implements the interface fdda.propertyTypes.PropertyType and is in the package fdda.propertyTypes. E.g., for integers, the class fdda.propertyTypes.IntegerType is needed, for booleans, the class fdda.propertyTypes.BooleanType.

A property can also have one or more Facets. These facets usually place constraints on the values. Several facets are predefined by constants in this class - e.g. a facet that determines whether the property can have multiple values, one that gives a default value, one that defines a maximum value, etc. These constraints are only used by the dialog, though - if values are changed directly by add/setValue, they are not checked.

Finally, a property has some attributes pertaining to the view the user gets: whether he sees it at all, whether he can modify it, and a description.

Author:
Jörg Rüdenauer
See Also:
PropertyType, PropertyHolder

Field Summary
static String DEFAULT_VALUE
          Name of the facet that specifies the default value of the property
static String FIXED_WHILE_RUNNING
          Name of the facet that specifies that this property can't be modified while a demonstration is running.
static String GRAPHIC_RELEVANT
          Name of the facet that specifies whether the property influences the graphical representation of the property holder.
static String LINE_COUNT_LINK
          Name of the facet that specifies whether the property shall have as many values as the node that holds is has connections.
static String MAX_COUNT_VALUES
          Name of the facet that holds the maximum number of values of the property.
static String MAX_VALUE
          Name of the facet that holds the maximal value of the property.
static String MIN_COUNT_VALUES
          Name of the facet that holds the minimum number of values of the property.
static String MIN_VALUE
          Name of the facet that holds the minimal value of the property.
static String MULTI_VALUED
          Name of the facet that specifies whether the property has more than one value.
 
Method Summary
 void addValue(Object value)
          Adds a new value at the end of the value list.
 void addValueAt(int nr, Object value)
          Adds a new value at the specified nr.
 void deleteValue(int nr)
          Removes a value from the list.
 Iterator facets()
          Returns an Iterator over the names of the facets of the property.
 int getCountOfValues()
          Returns the number of values.
 String getDescription()
          Returns the description of the property
 String getDisplayedName()
          Returns the displayed name of the property.
 Object getFacet(String name)
          Returns the value of the facet with the specified name.
 String getName()
          Returns the name of the property.
 String getType()
          Returns the type of the property (e.g.
 Object getValue()
          Returns the value of the property, or the first value in case of a multi-valued property.
 Object getValue(int nr)
          Returns a specific value of the property.
 boolean isModifiable()
          Returns whether the property shall be modifiable by the user
 boolean isVisible()
          Returns whether the property is visible to the user.
 void setFacet(String name, Object value)
          Sets the facet of the specified name to the specified value.
 void setModifiable(boolean modifiable)
          Specifies whether the property shall be modifiable by the user
 void setPropertyHolder(PropertyHolder holder)
          Sets the PropertyHolder that holds the property.
 void setValueAt(int nr, Object value)
          Changes the specified value to the new value.
 void setVisible(boolean visible)
          Specifies whether the property shall be visible to the user.
 

Field Detail

MIN_VALUE

public static final String MIN_VALUE
Name of the facet that holds the minimal value of the property.

See Also:
Constant Field Values

MAX_VALUE

public static final String MAX_VALUE
Name of the facet that holds the maximal value of the property.

See Also:
Constant Field Values

MIN_COUNT_VALUES

public static final String MIN_COUNT_VALUES
Name of the facet that holds the minimum number of values of the property. Is of no effect if LINE_COUNT_LINK is set.

See Also:
Constant Field Values

MAX_COUNT_VALUES

public static final String MAX_COUNT_VALUES
Name of the facet that holds the maximum number of values of the property. Is of no effect if LINE_COUNT_LINK is set.

See Also:
Constant Field Values

LINE_COUNT_LINK

public static final String LINE_COUNT_LINK
Name of the facet that specifies whether the property shall have as many values as the node that holds is has connections. This is the case if the value of the facet is Boolean.TRUE.

See Also:
Constant Field Values

DEFAULT_VALUE

public static final String DEFAULT_VALUE
Name of the facet that specifies the default value of the property

See Also:
Constant Field Values

MULTI_VALUED

public static final String MULTI_VALUED
Name of the facet that specifies whether the property has more than one value.

See Also:
Constant Field Values

GRAPHIC_RELEVANT

public static final String GRAPHIC_RELEVANT
Name of the facet that specifies whether the property influences the graphical representation of the property holder.

See Also:
Constant Field Values

FIXED_WHILE_RUNNING

public static final String FIXED_WHILE_RUNNING
Name of the facet that specifies that this property can't be modified while a demonstration is running. Set to Boolean.True to prevent changes in demo mode.

See Also:
Constant Field Values
Method Detail

getName

public String getName()
Returns the name of the property. This name must be unique within a PropertyHolder.

Returns:
the name of the property

getDisplayedName

public String getDisplayedName()
Returns the displayed name of the property.

Returns:
the displayed name

getValue

public Object getValue()
Returns the value of the property, or the first value in case of a multi-valued property. If no values exist, null is returned.

Returns:
the value of the property

getValue

public Object getValue(int nr)
Returns a specific value of the property. If no such value exists, null is returned (especially, if the given number is not 0 and the property is not multi-valued).

Parameters:
nr - the number of the value
Returns:
the specified value of the property

setValueAt

public void setValueAt(int nr,
                       Object value)
Changes the specified value to the new value. If the property hasn't a value of that number, addProperty is called.

Parameters:
nr - the nr of the value
value - the new value

addValueAt

public void addValueAt(int nr,
                       Object value)
Adds a new value at the specified nr. Not existent intermediate values are set to null.

Parameters:
nr - the nr of the new value
value - the new value

addValue

public void addValue(Object value)
Adds a new value at the end of the value list.

Parameters:
value - the new value

deleteValue

public void deleteValue(int nr)
Removes a value from the list. If the value number doesn't exit, nothing happens.

Parameters:
nr - the number of the value which shall be deleted

getCountOfValues

public int getCountOfValues()
Returns the number of values.

Returns:
the number of values of the properties

getType

public String getType()
Returns the type of the property (e.g. Integer).

Returns:
the type of the property

getFacet

public Object getFacet(String name)
Returns the value of the facet with the specified name. If there is no facet of that name, null is returned.

Parameters:
name - the name of the facet
Returns:
the value of the facet

setFacet

public void setFacet(String name,
                     Object value)
Sets the facet of the specified name to the specified value.

Parameters:
name - the name of the facet
value - the new value of the facet

facets

public Iterator facets()
Returns an Iterator over the names of the facets of the property.

Returns:
an Iterator over the facet names

getDescription

public String getDescription()
Returns the description of the property

Returns:
the description

isVisible

public boolean isVisible()
Returns whether the property is visible to the user.

Returns:
whether the property is visible

setVisible

public void setVisible(boolean visible)
Specifies whether the property shall be visible to the user.

Parameters:
visible - whether the property shall be visible

isModifiable

public boolean isModifiable()
Returns whether the property shall be modifiable by the user

Returns:
whether the property shall be modifiable

setModifiable

public void setModifiable(boolean modifiable)
Specifies whether the property shall be modifiable by the user

Parameters:
modifiable - whether the property shall be modifiable

setPropertyHolder

public void setPropertyHolder(PropertyHolder holder)
Sets the PropertyHolder that holds the property. Is only called by the PropertyHolder itself.

Parameters:
holder - the PropertyHolder


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.