SalesPoint v3.3 API

data.ooimpl
Class CatalogItemImpl

java.lang.Object
  extended by data.AbstractNameable
      extended by data.ooimpl.CatalogItemImpl
All Implemented Interfaces:
CatalogItem, DataBasketKeys, Nameable, Serializable, Cloneable, Comparable<Object>
Direct Known Subclasses:
CatalogImpl, CurrencyItemImpl

public abstract class CatalogItemImpl
extends AbstractNameable
implements CatalogItem, DataBasketKeys, Cloneable

Pure Java implementation of the CatalogItem interface. See the documentation for CatalogItem for a description of the semantics of this class.

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

Field Summary
 
Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Fields inherited from interface data.CatalogItem
VALUE_PROPERTY
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
CatalogItemImpl(String sName)
          Create a new CatalogItemImpl.
CatalogItemImpl(String sName, Value vValue)
          Create a new CatalogItemImpl.
 
Method Summary
 void addValueListener(PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever the "value" property changes.
 int compareTo(Object o)
          Compare this CatalogItem to an object.
 boolean equals(Object o)
          Check whether two objects are equal.
 Catalog getCatalog()
          Get the Catalog of this CatalogItem.
protected
<T extends CatalogItemImpl>
T
getInternalShallowClone()
          Get a shallow clone of the CatalogItem.
protected abstract  CatalogItemImpl getShallowClone()
          Get a shallow clone of the CatalogItem.
 Value getValue()
          Get the item's value.
 boolean isEditable()
          Return true if this CatalogItem is editable.
 void removeValueListener(PropertyChangeListener pcl)
          Remove a PropertyChangeListener for the "value" property.
protected  void setValue(Value vNew)
          Set the item's value.
 String toString()
          Return a String representation of the item.
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 

Constructor Detail

CatalogItemImpl

public CatalogItemImpl(String sName)
Create a new CatalogItemImpl. The item's value defaults to an IntegerValue of 0.

Parameters:
sName - the name of the new item.

CatalogItemImpl

public CatalogItemImpl(String sName,
                       Value vValue)
Create a new CatalogItemImpl.

Parameters:
sName - the name of the new item.
vValue - the value of the item.
Method Detail

getValue

public Value getValue()
Get the item's value.

Specified by:
getValue in interface CatalogItem
Returns:
a clone of the item's value.
Override:
Never

setValue

protected void setValue(Value vNew)
Set the item's value. This method is protected so that subclasses can decide whether or not to allow clients to set the value of a CatalogItem once it has been created.

The method will fire a property change event for the "value" property.

Override:
Sometimes

isEditable

public boolean isEditable()
Return true if this CatalogItem is editable.

Override:
Never

getCatalog

public Catalog getCatalog()
Get the Catalog of this CatalogItem.

Specified by:
getCatalog in interface CatalogItem
Override:
Never

toString

public String toString()
Return a String representation of the item.

Overrides:
toString in class Object
Override:
Sometimes

getShallowClone

protected abstract CatalogItemImpl getShallowClone()
Get a shallow clone of the CatalogItem. For normal CatalogItems there is no difference between a shallow and a deep clone.

Override:
Always

getInternalShallowClone

protected <T extends CatalogItemImpl> T getInternalShallowClone()
Get a shallow clone of the CatalogItem. This is for internal use only.

Override:
Never

compareTo

public int compareTo(Object o)
Compare this CatalogItem to an object.

Specified by:
compareTo in interface Comparable<Object>
Throws:
ClassCastException - if the given object cannot be cast into a CatalogItem.
Override:
Sometimes The default implementation assumes that the given object is also a CatalogItem and compares the names of these two CatalogItems.

equals

public boolean equals(Object o)
Check whether two objects are equal.

Overrides:
equals in class Object
Override:
Sometimes The default implementation returns true iff o is identical to this object.

addValueListener

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

Specified by:
addValueListener in interface CatalogItem
Override:
Never

removeValueListener

public void removeValueListener(PropertyChangeListener pcl)
Remove a PropertyChangeListener for the "value" property.

Specified by:
removeValueListener in interface CatalogItem
Override:
Never

SalesPoint v3.3 API