SalesPoint v3.3 API

data
Interface Nameable

All Superinterfaces:
Serializable
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
extends Serializable

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
Author:
Steffen Zschaler
See Also:
Catalog, Stock, CatalogItem, NameContext

Field Summary
static String NAME_PROPERTY
          The programmatical name of the "name" property.
 
Method Summary
 void addNameListener(PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever the "name" property changes.
 void addPropertyChangeListener(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.
 String getName()
          Get the name of this Nameable object.
 void removeNameListener(PropertyChangeListener pcl)
          Remove a PropertyChangeListener for the "name" property.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          Stop a listener from receiving events whenever a property changes.
 void setName(String sName, DataBasket db)
          Set the Nameable's name.
 

Field Detail

NAME_PROPERTY

static final 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.
Override:
Always

detachNC

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

Returns:
the previously attached NameContext, if any.
Override:
Always

setName

void setName(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
Override:
Always

getName

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

Override:
Always

addPropertyChangeListener

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

Override:
Always

removePropertyChangeListener

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

Override:
Always

addNameListener

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

Override:
Always

removeNameListener

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

Override:
Always

SalesPoint v3.3 API