org.salespointframework.desktop.models
Class CountingStockTableModel.Record

java.lang.Object
  extended by org.salespointframework.desktop.models.CountingStockTableModel.Record
All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>, CatalogItem, Nameable, SpItem
Enclosing class:
CountingStockTableModel

public static class CountingStockTableModel.Record
extends java.lang.Object
implements CatalogItem

A CountingStockTableModel's record.

The record is basically a combination of a CatalogItem and a number indicating the number of objects available.

Since:
v2.0
Version:
2.0 23/08/1999
Author:
Steffen Zschaler

Field Summary
private  CatalogItem m_ciDescriptor
          The CatalogItem part of the record.
private  int m_nCount
          The number of actually available items.
 
Fields inherited from interface org.salespointframework.core.data.interfaces.CatalogItem
VALUE_PROPERTY
 
Fields inherited from interface org.salespointframework.core.data.interfaces.Nameable
NAME_PROPERTY
 
Constructor Summary
CountingStockTableModel.Record(CatalogItem ci, int nCount)
          Create a new Record.
 
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.
 void addValueListener(java.beans.PropertyChangeListener pcl)
          Add a PropertyChangeListener that will receive events whenever the "value" property changes.
 NameContext attach(NameContext nc)
          Attach a NameContext to this Nameable.
 int compareTo(CountingStockTableModel.Record r)
          Compare by descriptor.
 int compareTo(java.lang.Object arg0)
           
 NameContext detachNC()
          Detach the current NameContext from this Nameable.
 void firePropertyChanged()
          Signals persistence layer to update objects values
 Catalog getCatalog()
          Get the Catalog that currently contains this CatalogItem.
 int getCount()
          Get the number of items in this record.
 CatalogItem getDescriptor()
          Get the CatalogItem describing the items represented by this record.
 java.awt.image.BufferedImage getImage()
          Get the image of the CatalogItem
 java.lang.String getName()
          Get the name of this Nameable object.
 Value getValue()
          Get the default value of this CatalogItem.
 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 removeValueListener(java.beans.PropertyChangeListener pcl)
          Remove a PropertyChangeListener for the "value" property.
 boolean setImage(java.net.URI filename)
          Set the image of the CatalogItem
 void setName(java.lang.String sName, DataBasket db)
          Set the Nameable's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ciDescriptor

private CatalogItem m_ciDescriptor
The CatalogItem part of the record.


m_nCount

private int m_nCount
The number of actually available items.

Constructor Detail

CountingStockTableModel.Record

public CountingStockTableModel.Record(CatalogItem ci,
                                      int nCount)
Create a new Record.

Method Detail

compareTo

public int compareTo(CountingStockTableModel.Record r)
Compare by descriptor.


getDescriptor

public CatalogItem getDescriptor()
Get the CatalogItem describing the items represented by this record.


getCount

public int getCount()
Get the number of items in this record.


addNameListener

public void addNameListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: Nameable
Add a PropertyChangeListener that will receive events whenever the "name" property changes.

Specified by:
addNameListener in interface Nameable

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: Nameable
Register a listener to receive events whenever propertiy changes.

Specified by:
addPropertyChangeListener in interface Nameable

addValueListener

public void addValueListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: CatalogItem
Add a PropertyChangeListener that will receive events whenever the "value" property changes.

Specified by:
addValueListener in interface CatalogItem

attach

public NameContext attach(NameContext nc)
Description copied from interface: Nameable
Attach a NameContext to this Nameable.

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

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

compareTo

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

detachNC

public NameContext detachNC()
Description copied from interface: Nameable
Detach the current NameContext from this Nameable.

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

getCatalog

public Catalog getCatalog()
Description copied from interface: CatalogItem
Get the Catalog that currently contains this CatalogItem.

Specified by:
getCatalog in interface CatalogItem

getName

public java.lang.String getName()
Description copied from interface: Nameable
Get the name of this Nameable object.

Specified by:
getName in interface Nameable
Specified by:
getName in interface SpItem

getValue

public Value getValue()
Description copied from interface: CatalogItem
Get the default value of this CatalogItem. Although CatalogItems have a default value, you can use any other value through the CatalogItemValue adapter.

Specified by:
getValue in interface CatalogItem

removeNameListener

public void removeNameListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: Nameable
Remove a PropertyChangeListener for the "name" property.

Specified by:
removeNameListener in interface Nameable

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: Nameable
Stop a listener from receiving events whenever a property changes.

Specified by:
removePropertyChangeListener in interface Nameable

removeValueListener

public void removeValueListener(java.beans.PropertyChangeListener pcl)
Description copied from interface: CatalogItem
Remove a PropertyChangeListener for the "value" property.

Specified by:
removeValueListener in interface CatalogItem

setName

public void setName(java.lang.String sName,
                    DataBasket db)
             throws NameContextException
Description copied from interface: Nameable
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)
 }
 

Specified by:
setName in interface Nameable
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

firePropertyChanged

public void firePropertyChanged()
Description copied from interface: CatalogItem
Signals persistence layer to update objects values

Specified by:
firePropertyChanged in interface CatalogItem

getImage

public java.awt.image.BufferedImage getImage()
Description copied from interface: CatalogItem
Get the image of the CatalogItem

Specified by:
getImage in interface CatalogItem
Returns:

setImage

public boolean setImage(java.net.URI filename)
Description copied from interface: CatalogItem
Set the image of the CatalogItem

Specified by:
setImage in interface CatalogItem
Parameters:
filename - uri, pointing to the image file
Returns:
true on success