org.progeeks.meta
Class DefaultMetaTable

java.lang.Object
  extended by org.progeeks.util.beans.BeanChangeSupport
      extended by org.progeeks.meta.DefaultMetaTable
All Implemented Interfaces:
MetaTable, StandardBean

public class DefaultMetaTable
extends BeanChangeSupport
implements MetaTable

A default implementation of the MetaTable interface. This meta-table implementation contains an internal list of objects. If these objects are meta-objects then they are access directly. Otherwise, they are wrapped in meta-objects using the meta-kit provided. Optionally a list of property names can be provided or the table will pull the property names from the specified meta-class.

Version:
$Revision: 1.16 $
Author:
Paul Speed

Constructor Summary
DefaultMetaTable(java.util.List objects, java.util.List properties, MetaClass metaClass, MetaKit kit)
          Creates a default meta-table that contains the specified list of objects.
DefaultMetaTable(java.util.List objects, java.util.List properties, MetaClass metaClass, MetaKit kit, boolean autoWrap)
          Creates a default meta-table that contains the specified list of objects.
 
Method Summary
 void addObject(java.lang.Object obj)
          Adds the specified object to the list.
 void addPropertyChangeListener(int column, java.beans.PropertyChangeListener l)
          Adds a property change listener that will be notified whenever the specified property changes in any row.
 int getColumnCount()
          Returns the number of columns in the table.
 int getColumnIndex(java.lang.String propertyName)
          Returns the column index of the specified property.
 MetaClass getMetaClass()
          Returns the meta-class associated with this object.
 MetaKit getMetaKit()
          Returns the meta-kit for this meta-object's implementation layer.
 MetaObject getMetaObject(int row)
          Returns the specified row as a meta-object.
 java.lang.Object getProperty(int row, int column)
          Returns the value of the specified property.
 PropertyInfo getPropertyInfo(int column)
          Returns the property info for a given column.
 PropertyMutator getPropertyMutator(int row, int column)
          Returns a mutator for the specified property.
 int getRowCount()
          Returns the number of rows in the table.
 int getRowIndex(MetaObject obj)
          Returns the row index for the specified meta-object.
 boolean hasListeners(int column)
          Returns true if the specified property name has listeners registered.
 void release()
          Releases any listeners registered with the internal lists and objects.
 void removePropertyChangeListener(int column, java.beans.PropertyChangeListener l)
          Removes the property change listener from a specific property.
protected  void setObjects(java.util.List objects, boolean autoWrap)
           
protected  void setProperties(java.util.List names)
           
 void setProperty(int row, int column, java.lang.Object value)
          Sets the value of the specified property.
 
Methods inherited from class org.progeeks.util.beans.BeanChangeSupport
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.progeeks.meta.MetaTable
addPropertyChangeListener, clearAllListeners, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

DefaultMetaTable

public DefaultMetaTable(java.util.List objects,
                        java.util.List properties,
                        MetaClass metaClass,
                        MetaKit kit)
Creates a default meta-table that contains the specified list of objects.


DefaultMetaTable

public DefaultMetaTable(java.util.List objects,
                        java.util.List properties,
                        MetaClass metaClass,
                        MetaKit kit,
                        boolean autoWrap)
Creates a default meta-table that contains the specified list of objects.

Method Detail

release

public void release()
Releases any listeners registered with the internal lists and objects. The internal list references will be cleared and the model will become invalid.


setObjects

protected void setObjects(java.util.List objects,
                          boolean autoWrap)

setProperties

protected void setProperties(java.util.List names)

addObject

public void addObject(java.lang.Object obj)
Adds the specified object to the list. If an object is a meta-object then it will be directly added to the meta-object list. Otherwise, a meta-object will be created.


getMetaObject

public MetaObject getMetaObject(int row)
Returns the specified row as a meta-object.

Specified by:
getMetaObject in interface MetaTable

getRowIndex

public int getRowIndex(MetaObject obj)
Returns the row index for the specified meta-object. This is an optional operation and may throw an UnsupportedOpreationException.

Specified by:
getRowIndex in interface MetaTable

getPropertyInfo

public PropertyInfo getPropertyInfo(int column)
Returns the property info for a given column.

Specified by:
getPropertyInfo in interface MetaTable

getColumnIndex

public int getColumnIndex(java.lang.String propertyName)
Returns the column index of the specified property.

Specified by:
getColumnIndex in interface MetaTable
Returns:
The index of the property or -1 if the name does not represent a supported property.

getRowCount

public int getRowCount()
Returns the number of rows in the table.

Specified by:
getRowCount in interface MetaTable

getColumnCount

public int getColumnCount()
Returns the number of columns in the table.

Specified by:
getColumnCount in interface MetaTable

setProperty

public void setProperty(int row,
                        int column,
                        java.lang.Object value)
Sets the value of the specified property.

Specified by:
setProperty in interface MetaTable

getProperty

public java.lang.Object getProperty(int row,
                                    int column)
Returns the value of the specified property.

Specified by:
getProperty in interface MetaTable

getPropertyMutator

public PropertyMutator getPropertyMutator(int row,
                                          int column)
Returns a mutator for the specified property.

Specified by:
getPropertyMutator in interface MetaTable

getMetaClass

public MetaClass getMetaClass()
Returns the meta-class associated with this object.

Specified by:
getMetaClass in interface MetaTable

getMetaKit

public MetaKit getMetaKit()
Returns the meta-kit for this meta-object's implementation layer.

Specified by:
getMetaKit in interface MetaTable

addPropertyChangeListener

public void addPropertyChangeListener(int column,
                                      java.beans.PropertyChangeListener l)
Adds a property change listener that will be notified whenever the specified property changes in any row.

Specified by:
addPropertyChangeListener in interface MetaTable

hasListeners

public boolean hasListeners(int column)
Returns true if the specified property name has listeners registered.

Specified by:
hasListeners in interface MetaTable

removePropertyChangeListener

public void removePropertyChangeListener(int column,
                                         java.beans.PropertyChangeListener l)
Removes the property change listener from a specific property.

Specified by:
removePropertyChangeListener in interface MetaTable


Copyright © 2002-2003 Paul Speed. All Rights Reserved.