com.webmethods.caf.faces.data.object
Class DataModelTableContentProvider

java.lang.Object
  extended by com.webmethods.caf.faces.bean.PageFlowScopeAdapter
      extended by com.webmethods.caf.faces.data.object.DataModelTableContentProvider
All Implemented Interfaces:
IPageFlowScopeAdapter, IContentProvider, ITableContentProvider

public class DataModelTableContentProvider
extends PageFlowScopeAdapter
implements ITableContentProvider

DataModel adapter for a ITableContentProvider.

Used internally by table control to adapt DataModel objects to ITableContentProvider.


Field Summary
protected  DataModel m_model
           
protected  String m_var
           
 
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
 
Constructor Summary
DataModelTableContentProvider()
          Default constructor.
DataModelTableContentProvider(DataModel model)
          Construct a new instance and set the data model accordingly.
 
Method Summary
 Object getCurrentRow()
          Returns current row.
 DataModel getModel()
           
 Object[] getPropertyKeys()
          Returns list of properties supported by this content provider.
 int getRowCount()
          Return the number of rows of data objects represented by this DataModel.
 int getRowIndex()
          Return the zero-relative index of the currently selected row.
 String getRowVariable()
           Returns row variable name.
 Class getType(Object propertyKey)
          Returns java type of the given property
 Object getValue(Object propertyKey)
          Returns value of the given property
 boolean hasProperty(Object propertyKey)
          Checks if the given property is supported by this content provider
 boolean isReadOnly(Object propertyKey)
           
 boolean isRowAvailable()
          Return a flag indicating whether there is rowData available at the current rowIndex.
 void setModel(DataModel model)
           
 void setRowIndex(int rowIndex)
          Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.
 void setRowVariable(String var)
          Set row variable name
 void setValue(Object propertyKey, Object value)
          Set value for the property specified for the current row
 String toString()
          Returns string representation of content.
 
Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_model

protected DataModel m_model

m_var

protected String m_var
Constructor Detail

DataModelTableContentProvider

public DataModelTableContentProvider()
Default constructor.


DataModelTableContentProvider

public DataModelTableContentProvider(DataModel model)
Construct a new instance and set the data model accordingly.

Parameters:
model -
Method Detail

toString

public String toString()
Description copied from interface: IContentProvider
Returns string representation of content.

Specified by:
toString in interface IContentProvider
Overrides:
toString in class Object
Returns:
String representation of the wrapped content

getPropertyKeys

public Object[] getPropertyKeys()
Description copied from interface: IContentProvider
Returns list of properties supported by this content provider. Can return Object[0], never null.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
array of property keys which is typically of type String or Integer

getType

public Class getType(Object propertyKey)
              throws PropertyNotFoundException
Description copied from interface: IContentProvider
Returns java type of the given property

Specified by:
getType in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
property java Class
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyKey)
                throws EvaluationException,
                       PropertyNotFoundException
Description copied from interface: IContentProvider
Returns value of the given property

Specified by:
getValue in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
value of the property, can be null
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

hasProperty

public boolean hasProperty(Object propertyKey)
Description copied from interface: IContentProvider
Checks if the given property is supported by this content provider

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if property is supported

isReadOnly

public boolean isReadOnly(Object propertyKey)
                   throws EvaluationException,
                          PropertyNotFoundException
Returns:
the flag indicates whether the property for the current row is read only or not
Throws:
PropertyNotFoundException - if the current row is null
EvaluationException
See Also:
ContentProviderUtils.isReadOnly(Object, Object)

setValue

public void setValue(Object propertyKey,
                     Object value)
              throws EvaluationException,
                     PropertyNotFoundException
Set value for the property specified for the current row

Parameters:
propertyKey -
value -
Throws:
EvaluationException
PropertyNotFoundException
See Also:
ContentProviderUtils.setValue(Object, Object, Object)

getRowCount

public int getRowCount()
Description copied from interface: ITableContentProvider
Return the number of rows of data objects represented by this DataModel.

Return -1, if the number of rows is unknown, or no wrappedData is available.

Specified by:
getRowCount in interface ITableContentProvider
See Also:
DataModel

getRowIndex

public int getRowIndex()
Description copied from interface: ITableContentProvider
Return the zero-relative index of the currently selected row.

If we are not currently positioned on a row, or no wrappedData is available, return -1.

Specified by:
getRowIndex in interface ITableContentProvider
See Also:
DataModel

isRowAvailable

public boolean isRowAvailable()
Description copied from interface: ITableContentProvider
Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.

Specified by:
isRowAvailable in interface ITableContentProvider
See Also:
DataModel

setRowIndex

public void setRowIndex(int rowIndex)
Description copied from interface: ITableContentProvider
Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.

Specified by:
setRowIndex in interface ITableContentProvider
See Also:
DataModel

getRowVariable

public String getRowVariable()
Description copied from interface: ITableContentProvider

Returns row variable name.

If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.

Specified by:
getRowVariable in interface ITableContentProvider
Returns:
row variable name
See Also:
ITableContentProvider.setRowVariable(String)

setRowVariable

public void setRowVariable(String var)
Set row variable name

Specified by:
setRowVariable in interface ITableContentProvider

getCurrentRow

public Object getCurrentRow()
Returns current row. If no row is current, returns first row. If doesn't have first row, returns null.

Specified by:
getCurrentRow in interface ITableContentProvider
Returns:
current row object
See Also:
ITableContentProvider.isRowAvailable()

getModel

public DataModel getModel()

setModel

public void setModel(DataModel model)