org.salespointframework.core.data.interfaces
Interface Nameable

All Known Subinterfaces:
Catalog<T>, CatalogItem, CountingStock<T,CT>, Currency<T>, CurrencyItem, ListenableCatalog<T>, ListenableStock<T,CT>, MoneyBag, Stock<T,CT>, StockItem, StoringStock<T,CT>
All Known Implementing Classes:
AbstractCurrency, AbstractNameable, AbstractStockFilter, CatalogFilter, CatalogImpl, CatalogItemImpl, CountingStockFilter, CountingStockImpl, CountingStockTableModel.Record, CurrencyFilter, CurrencyImpl, CurrencyItemImpl, EUROCurrencyImpl, MoneyBagFilter, MoneyBagImpl, StockImpl, StockItemImpl, StoringStockFilter, StoringStockImpl

public interface Nameable

An object that has a name that complies with a NameContext's rules.

When implementing nameable objects you migth want to subclass AbstractNameable, which already implements all the methods required by Nameable.

Since:
v2.0
Version:
2.0 25/05/1999
Author:
Steffen Zschaler
See Also:
Catalog, Stock, CatalogItem, NameContext

Field Summary
static java.lang.String NAME_PROPERTY
          The programmatical name of the "name" property.
 
Method Summary
 void addNameListener(java.beans.PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever the "name" property changes.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Register a listener to receive events whenever propertiy changes.
 NameContext attach(NameContext nc)
          Attach a NameContext to this Nameable.
 NameContext detachNC()
          Detach the current NameContext from this Nameable.
 java.lang.String getName()
          Get the name of this Nameable object.
 void removeNameListener(java.beans.PropertyChangeListener pcl)
          Remove a PropertyChangeListener for the "name" property.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Stop a listener from receiving events whenever a property changes.
 void setName(java.lang.String sName, DataBasket db)
          Set the Nameable's name.
 

Field Detail

NAME_PROPERTY

static final java.lang.String NAME_PROPERTY
The programmatical name of the "name" property. This is "name".

See Also:
Constant Field Values
Method Detail

attach

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

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

Parameters:
nc - the new NameContext of this Nameable object.
Returns:
the previous NameContext, if any.

detachNC

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

Returns:
the previously attached NameContext, if any.

setName

void setName(java.lang.String sName,
             DataBasket db)
             throws NameContextException
Set the Nameable's name.

setName() must implement the following protocol (Let nc be the Nameable's current NameContext):

 if (nc != null) {
   synchronized (nc.getNCMonitor()) {
     nc.checkNameChange (db, getName(), sName);

     // set the internal name attribute(s), leaving old name in sOldName

     nc.nameHasChanged (db, sOldName, getName());
   }
 }
 else {
   // set the internal name attribute(s)
 }
 

Parameters:
sName - the new name of the object
db - the DataBasket relative to which the operation is to be performed.
Throws:
NameContextException - if the name change was not approved of by the NameContext.
See Also:
NameContext

getName

java.lang.String getName()
Get the name of this Nameable object.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Register a listener to receive events whenever propertiy changes.


removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Stop a listener from receiving events whenever a property changes.


addNameListener

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


removeNameListener

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