fdda.model.impl
Class WorkingPart

java.lang.Object
  |
  +--fdda.model.impl.WorkingPart
All Implemented Interfaces:
EventListener, PropertyHolder, PropertyListener, WorkingPart
Direct Known Subclasses:
Connection, Node

abstract class WorkingPart
extends Object
implements PropertyHolder, PropertyListener, WorkingPart

The implementation of WorkingPart and PropertyHolder, superclass of both Node and Connection. Is also a PropertyListener to react to user changes of the 'working' property.

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

Field Summary
protected  WorkingPart graphicalRepresentation
          the graphical representation of the part
 
Fields inherited from interface fdda.model.WorkingPart
WORKING_PROPERTY_NAME
 
Constructor Summary
WorkingPart(boolean working, WorkingPart graphicalRepresentation)
          Constructor.
 
Method Summary
 void addProperty(Property property)
          Adds a property to the holder.
 void addPropertyListener(PropertyListener listener)
          Adds a PropertyListener (Observer pattern).
 void changeProperty(Property property)
          Changes a property of the holder - i.e., replaces the property with the name of the parameter property with the parameter.
protected  void firePropertyAdded(Property property)
          Notifies the listeners that a property has been added.
 void firePropertyChanged(Property property)
          Informs the listeners that a property has been changed.
protected  void firePropertyRemoved(Property property)
          Notifies the listeners that a property has been removed.
 Iterator getProperties()
          Returns an Iterator over the properties of the holder.
 Property getProperty(String name)
          Returns a property of the holder.
 boolean isWorking()
          Returns whether the part is currently working.
 void propertyAdded(PropertyEvent pe)
          Called whenever a property is added to the PropertyHolder.
 void propertyChanged(PropertyEvent pe)
          Called whenever a property of the PropertyHolder is changed.
 void propertyRemoved(PropertyEvent pe)
          Called whenever a property is removed from the PropertyHolder.
 void removeProperty(Property property)
          Removes a property from the holder.
 void removePropertyListener(PropertyListener listener)
          Removes a PropertyListener (Observer pattern).
 void setWorking(boolean working)
          Sets whether the part is currently working.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graphicalRepresentation

protected WorkingPart graphicalRepresentation
the graphical representation of the part

Constructor Detail

WorkingPart

public WorkingPart(boolean working,
                   WorkingPart graphicalRepresentation)
Constructor. The graphical representation must exist before the part is created.

Parameters:
working - whether the part is currently working
graphicalRepresentation - the graphical representation
Method Detail

isWorking

public boolean isWorking()
Description copied from interface: WorkingPart
Returns whether the part is currently working.

Specified by:
isWorking in interface WorkingPart
Returns:
whether the part is working

setWorking

public final void setWorking(boolean working)
Description copied from interface: WorkingPart
Sets whether the part is currently working.

Specified by:
setWorking in interface WorkingPart
Parameters:
working - whether the part is working

getProperties

public Iterator getProperties()
Description copied from interface: PropertyHolder
Returns an Iterator over the properties of the holder.

Specified by:
getProperties in interface PropertyHolder
Returns:
an Iterator over the properties

getProperty

public Property getProperty(String name)
Description copied from interface: PropertyHolder
Returns a property of the holder. If no property with the specified name exists, null is returned.

Specified by:
getProperty in interface PropertyHolder
Parameters:
name - the name of the property
Returns:
the property

addProperty

public void addProperty(Property property)
Description copied from interface: PropertyHolder
Adds a property to the holder. If a property with the same name already exists, it is removed.

Specified by:
addProperty in interface PropertyHolder

removeProperty

public void removeProperty(Property property)
Description copied from interface: PropertyHolder
Removes a property from the holder. The key for removal is the name of the property; if no property with that name exists, nothing happens.

Specified by:
removeProperty in interface PropertyHolder
Parameters:
property - the property to be removed, must not be null

changeProperty

public void changeProperty(Property property)
Description copied from interface: PropertyHolder
Changes a property of the holder - i.e., replaces the property with the name of the parameter property with the parameter. If no such property exists, the property is simply added to the holder; in this case, a propertyAdded event instead of a propertyChanged event is fired.

Specified by:
changeProperty in interface PropertyHolder
Parameters:
property - the new property, must not be null

addPropertyListener

public void addPropertyListener(PropertyListener listener)
Description copied from interface: PropertyHolder
Adds a PropertyListener (Observer pattern).

Specified by:
addPropertyListener in interface PropertyHolder
Parameters:
listener - the listener to be added
See Also:
EventListenerList

removePropertyListener

public void removePropertyListener(PropertyListener listener)
Description copied from interface: PropertyHolder
Removes a PropertyListener (Observer pattern).

Specified by:
removePropertyListener in interface PropertyHolder
Parameters:
listener - the listener to be removed
See Also:
EventListenerList

firePropertyChanged

public void firePropertyChanged(Property property)
Description copied from interface: PropertyHolder
Informs the listeners that a property has been changed. Note that the property holder can't determine by himself whether a property is changed internally; therefore, the property must inform its holder of any changes. This method must only be called by implementing classes of either PropertyHolder or Property.

Specified by:
firePropertyChanged in interface PropertyHolder
Parameters:
property - the property that was changed.

firePropertyAdded

protected void firePropertyAdded(Property property)
Notifies the listeners that a property has been added.

Parameters:
property - the added property
See Also:
EventListenerList

firePropertyRemoved

protected void firePropertyRemoved(Property property)
Notifies the listeners that a property has been removed.

Parameters:
property - the added property
See Also:
EventListenerList

propertyChanged

public void propertyChanged(PropertyEvent pe)
Description copied from interface: PropertyListener
Called whenever a property of the PropertyHolder is changed.

Specified by:
propertyChanged in interface PropertyListener
Parameters:
pe - the PropertyEvent

propertyAdded

public void propertyAdded(PropertyEvent pe)
Description copied from interface: PropertyListener
Called whenever a property is added to the PropertyHolder.

Specified by:
propertyAdded in interface PropertyListener
Parameters:
pe - the PropertyEvent

propertyRemoved

public void propertyRemoved(PropertyEvent pe)
Description copied from interface: PropertyListener
Called whenever a property is removed from the PropertyHolder.

Specified by:
propertyRemoved in interface PropertyListener
Parameters:
pe - the PropertyEvent


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