com.dlsc.flexgantt.util
Class NamedObject

java.lang.Object
  extended by com.dlsc.flexgantt.util.NamedObject
All Implemented Interfaces:
INamedObject, java.lang.Comparable<INamedObject>
Direct Known Subclasses:
Layer, Page, TreeTableColumn

public class NamedObject
extends java.lang.Object
implements INamedObject

A named object is a simple object that only carries a name attribute. As this is a very common attribute it makes sense to create a separate class for it so that it can be used as a superclass for various other types.

Since:
1.0
Author:
Dirk Lemmermann

Field Summary
static java.lang.String PROPERTY_NAME
          Constant used for those property change events that get triggered when the name of the object gets changed.
 
Constructor Summary
NamedObject()
          Constructs a new named object.
NamedObject(java.lang.String name)
          Constructs a new named object with the given name.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a property change listener to the named object.
 int compareTo(INamedObject o)
           
protected  java.beans.PropertyChangeSupport getChangeSupport()
          Returns the property change support object so that subclasses can use it to fire property change events.
 java.lang.String getName()
          Returns the value of the object's name attribute (the object's name).
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a property change listener from the named object.
 void setName(java.lang.String name)
          Assigns a new name to the object.
 java.lang.String toString()
          Returns the name of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_NAME

public static final java.lang.String PROPERTY_NAME
Constant used for those property change events that get triggered when the name of the object gets changed.

Since:
1.0
See Also:
setName(String), addPropertyChangeListener(PropertyChangeListener), Constant Field Values
Constructor Detail

NamedObject

public NamedObject(java.lang.String name)
Constructs a new named object with the given name.

Parameters:
name - the object's name
Since:
1.0

NamedObject

public NamedObject()
Constructs a new named object.

Since:
1.0
See Also:
setName(String)
Method Detail

setName

public void setName(java.lang.String name)
Assigns a new name to the object.

Parameters:
name - the new object name
Since:
1.0
See Also:
getName()

getName

public java.lang.String getName()
Description copied from interface: INamedObject
Returns the value of the object's name attribute (the object's name).

Specified by:
getName in interface INamedObject
Returns:
the object's name

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener to the named object. The listener will be informed if the object's name changes.

Parameters:
l - the new listener
Since:
1.0
See Also:
removePropertyChangeListener(PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener from the named object.

Parameters:
l - the listener that will be removed
Since:
1.0
See Also:
addPropertyChangeListener(PropertyChangeListener)

getChangeSupport

protected java.beans.PropertyChangeSupport getChangeSupport()
Returns the property change support object so that subclasses can use it to fire property change events.

Returns:
the property change support object
Since:
1.0

toString

public java.lang.String toString()
Returns the name of the object.

Overrides:
toString in class java.lang.Object
Returns:
the same value as getName()
Since:
1.0

compareTo

public int compareTo(INamedObject o)
Specified by:
compareTo in interface java.lang.Comparable<INamedObject>