SalesPoint Framework v3.1

data
Class AbstractNameable

java.lang.Object
  extended bydata.AbstractNameable
All Implemented Interfaces:
Nameable, Serializable
Direct Known Subclasses:
CatalogItemImpl, StockItemImpl

public abstract class AbstractNameable
extends Object
implements Nameable

Convenience class implementing the Nameable interface.

You should derive all your Nameable classes from this class, as it provides a complete implementation of the Nameable interface. However, there is no obligation to derive from this class, as long as your class implements Nameable and sticks to the contract defined in that interface.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
protected  NameContext m_ncContext
          The current name context.
protected  PropertyChangeSupport m_pcsPropertyListeners
          Used to fire PropertyChangeEvents.
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Constructor Summary
AbstractNameable()
          Initialize a new AbstractNameable object with a null name.
AbstractNameable(String sName)
          Initialize a new AbstractNameable object with the given name.
 
Method Summary
 void addNameListener(PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever the "name" property changes.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever a bound property changes.
 NameContext attach(NameContext nc)
          Attach a NameContext to this Nameable.
 NameContext detachNC()
          Detach the current NameContext from this Nameable.
 String getName()
          Get the name of the object.
 void removeNameListener(PropertyChangeListener pcl)
          Remove a PropertyChangeListener for the "name" property.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          Remove a PropertyChangeListener.
 void setName(String sName, DataBasket db)
          Set the Nameable's name, using help by the NameContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pcsPropertyListeners

protected PropertyChangeSupport m_pcsPropertyListeners
Used to fire PropertyChangeEvents.


m_ncContext

protected NameContext m_ncContext
The current name context.

Constructor Detail

AbstractNameable

public AbstractNameable()
Initialize a new AbstractNameable object with a null name.


AbstractNameable

public AbstractNameable(String sName)
Initialize a new AbstractNameable object with the given name. The name context will initially be null.

Parameters:
sName - the AbstractNameable's name.
Method Detail

attach

public NameContext attach(NameContext nc)
Attach a NameContext to this Nameable.

No naming conventions are checked neither in the old nor in the new NameContext.

All access to the NameContext is synchronized for thread-safety.

Specified by:
attach in interface Nameable
Parameters:
nc - the new NameContext of this Nameable object.
Returns:
the previous NameContext, if any.
Override:
Never

detachNC

public NameContext detachNC()
Detach the current NameContext from this Nameable.

All access to the NameContext is synchronized for thread-safety.

Specified by:
detachNC in interface Nameable
Returns:
the previously attached NameContext, if any.
Override:
Never

setName

public void setName(String sName,
                    DataBasket db)
             throws NameContextException
Set the Nameable's name, using help by the NameContext.

All access to the NameContext is synchronized for thread-safety.

Specified by:
setName in interface Nameable
Parameters:
sName - the new name of the object
db - the DataBasket relative to which the name change is to take place.
Throws:
NameContextException - if the name change was not approved of by the NameContext.
See Also:
NameContext
Override:
Never

getName

public String getName()
Get the name of the object. override Never

Specified by:
getName in interface Nameable

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcl)
Add a PropertyChangeListener that will receive events whenever a bound property changes.

Specified by:
addPropertyChangeListener in interface Nameable
Override:
Never

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pcl)
Remove a PropertyChangeListener.

Specified by:
removePropertyChangeListener in interface Nameable
Override:
Never

addNameListener

public void addNameListener(PropertyChangeListener pcl)
Add a PropertyChangeListener that will receive events whenever the "name" property changes.

Specified by:
addNameListener in interface Nameable
Override:
Never

removeNameListener

public void removeNameListener(PropertyChangeListener pcl)
Remove a PropertyChangeListener for the "name" property.

Specified by:
removeNameListener in interface Nameable
Override:
Never

SalesPoint Framework v3.1