You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Skriloff, Nicholas" <Sk...@darden.virginia.edu> on 2006/01/06 22:55:56 UTC

Table Model Question

For this question assume that the data passed into a table component
comes from a persistent property-specification, usually initialize in
pageBeginRender.

The contrib table model component accepts the data in many forms. But,
two of them are an object[] or IBasicTableModel.  What is the advantage
of doing one over the other in terms of processing?  It seems that if
your data is  IBasicTableModel then you will only store meta-data but
will hit the database between calls for things like paging. If the you
pass in an object array, then the whole array is stored in memory but
there are less database queries for things like paging. Is this Close?


This code below is taken from TableView.java
        // if the source parameter is of type {@link IBasicTableModel}, 
        // create and return an appropriate wrapper
        if (objSourceValue instanceof IBasicTableModel)
            return new BasicTableModelWrap(
                (IBasicTableModel) objSourceValue,
                objColumnModel,
                objState);

        // otherwise, the source parameter must contain the data to be
displayed
        ITableDataModel objDataModel = null;
        if (objSourceValue instanceof Object[])
            objDataModel = new SimpleListTableDataModel((Object[])
objSourceValue);
        else if (objSourceValue instanceof List)
            objDataModel = new SimpleListTableDataModel((List)
objSourceValue);
        else if (objSourceValue instanceof Collection)
            objDataModel = new SimpleListTableDataModel((Collection)
objSourceValue);
        else if (objSourceValue instanceof Iterator)
            objDataModel = new SimpleListTableDataModel((Iterator)
objSourceValue);




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org