org.richfaces.demo.extendeddatamodel
Class AuctionDataModel

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.ajax4jsf.model.ExtendedDataModel
          extended by org.ajax4jsf.model.SerializableDataModel
              extended by org.richfaces.demo.extendeddatamodel.AuctionDataModel
All Implemented Interfaces:
java.io.Serializable

public class AuctionDataModel
extends org.ajax4jsf.model.SerializableDataModel

Author:
ias This is example class that intended to demonstrate use of ExtendedDataModel and SerializableDataModel. This implementation intended to be used as a request scope bean. However, it actually provides serialized state, so on a post-back we do not load data from the data provider. Instead we use data that was used during rendering. This data model must be used together with Data Provider, which is responsible for actual data load from the database using specific filtering and sorting. Normally Data Provider must be in either session, or conversation scope.
See Also:
Serialized Form

Constructor Summary
AuctionDataModel()
           
 
Method Summary
 AuctionDataProvider getDataProvider()
           
 int getRowCount()
           
 java.lang.Object getRowData()
          This is main way to obtain data row.
 int getRowIndex()
          Unused rudiment from old JSF staff.
 java.lang.Object getRowKey()
          This method never called from framework.
 org.ajax4jsf.model.SerializableDataModel getSerializableModel(org.ajax4jsf.model.Range range)
          This method suppose to produce SerializableDataModel that will be serialized into View State and used on a post-back.
 java.lang.Object getWrappedData()
          Unused rudiment from old JSF staff.
 boolean isRowAvailable()
          Never called by framework.
 void setDataProvider(AuctionDataProvider dataProvider)
           
 void setRowIndex(int rowIndex)
          Unused rudiment from old JSF staff.
 void setRowKey(java.lang.Object key)
          This method normally called by Visitor before request Data Row.
 void setWrappedData(java.lang.Object data)
          Unused rudiment from old JSF staff.
 void update()
          This is helper method that is called by framework after model update.
 void walk(javax.faces.context.FacesContext context, org.ajax4jsf.model.DataVisitor visitor, org.ajax4jsf.model.Range range, java.lang.Object argument)
          This is main part of Visitor pattern.
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuctionDataModel

public AuctionDataModel()
Method Detail

getRowKey

public java.lang.Object getRowKey()
This method never called from framework. (non-Javadoc)

Specified by:
getRowKey in class org.ajax4jsf.model.ExtendedDataModel
See Also:
ExtendedDataModel.getRowKey()

setRowKey

public void setRowKey(java.lang.Object key)
This method normally called by Visitor before request Data Row.

Specified by:
setRowKey in class org.ajax4jsf.model.ExtendedDataModel

walk

public void walk(javax.faces.context.FacesContext context,
                 org.ajax4jsf.model.DataVisitor visitor,
                 org.ajax4jsf.model.Range range,
                 java.lang.Object argument)
          throws java.io.IOException
This is main part of Visitor pattern. Method called by framework many times during request processing.

Specified by:
walk in class org.ajax4jsf.model.ExtendedDataModel
Throws:
java.io.IOException

getRowCount

public int getRowCount()
Specified by:
getRowCount in class javax.faces.model.DataModel

getRowData

public java.lang.Object getRowData()
This is main way to obtain data row. It is intensively used by framework. We strongly recommend use of local cache in that method.

Specified by:
getRowData in class javax.faces.model.DataModel

getRowIndex

public int getRowIndex()
Unused rudiment from old JSF staff.

Specified by:
getRowIndex in class javax.faces.model.DataModel

getWrappedData

public java.lang.Object getWrappedData()
Unused rudiment from old JSF staff.

Specified by:
getWrappedData in class javax.faces.model.DataModel

isRowAvailable

public boolean isRowAvailable()
Never called by framework.

Specified by:
isRowAvailable in class javax.faces.model.DataModel

setRowIndex

public void setRowIndex(int rowIndex)
Unused rudiment from old JSF staff.

Specified by:
setRowIndex in class javax.faces.model.DataModel

setWrappedData

public void setWrappedData(java.lang.Object data)
Unused rudiment from old JSF staff.

Specified by:
setWrappedData in class javax.faces.model.DataModel

getSerializableModel

public org.ajax4jsf.model.SerializableDataModel getSerializableModel(org.ajax4jsf.model.Range range)
This method suppose to produce SerializableDataModel that will be serialized into View State and used on a post-back. In current implementation we just mark current model as serialized. In more complicated cases we may need to transform data to actually serialized form.

Overrides:
getSerializableModel in class org.ajax4jsf.model.ExtendedDataModel

update

public void update()
This is helper method that is called by framework after model update. In must delegate actual database update to Data Provider.

Specified by:
update in class org.ajax4jsf.model.SerializableDataModel

getDataProvider

public AuctionDataProvider getDataProvider()

setDataProvider

public void setDataProvider(AuctionDataProvider dataProvider)


Copyright © 2009. All Rights Reserved.