com.arsdigita.toolbox.ui
Class DataQueryListModelBuilder

java.lang.Object
  extended bycom.arsdigita.util.LockableImpl
      extended bycom.arsdigita.toolbox.ui.DataQueryListModelBuilder
All Implemented Interfaces:
ListModelBuilder, Lockable

public abstract class DataQueryListModelBuilder
extends LockableImpl
implements ListModelBuilder

Builds a DataQueryListModelBuilder.DataQueryListModel from a DataQuery. By specifying the name of the key and value columns, a DataQuery object can be transformed into a DataQueryListModelBuilder.DataQueryListModel. To use this class, override the getDataQuery(PageState ps) method. This method prepares a query, applying any additional filters, so that a call to next() will return the first row of the result set.

Version:
$Revision: #10 $ $Date: 2004/04/07 $
Author:
Michael Pih, Stanislav Freidin

Nested Class Summary
 class DataQueryListModelBuilder.DataQueryListModel
          Encapsulates a DataQuery as a ListModel.
 
Field Summary
static String versionId
           
 
Constructor Summary
DataQueryListModelBuilder(String keyName)
          Construct a new DataQueryListModelBuilder that returns a Map containing all the data in each row (rather than a single column).
DataQueryListModelBuilder(String keyName, String valueName)
          Construct a new DataQueryListModelBuilder
 
Method Summary
protected abstract  DataQuery getDataQuery(PageState ps)
          Returns the data query for the current request.
 ListModel makeModel(List l, PageState ps)
          Produce a DataQueryListModelBuilder.DataQueryListModel for the request specified by state.
 
Methods inherited from class com.arsdigita.util.LockableImpl
isLocked, lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked, lock
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

DataQueryListModelBuilder

public DataQueryListModelBuilder(String keyName,
                                 String valueName)
Construct a new DataQueryListModelBuilder

Parameters:
keyName - the name of the attribute in the query that contains the primary key of a row
valueName - the name of the attribute in the query that contains the value. The value will be passed directly to the ListCellRenderer of the List. Usually, the value will be a primitive (such as a String or a Date); the default list cell renderer will call .toString() on the value and display it as a link. If null, the ListModel will return a Map of all the data in the row.

DataQueryListModelBuilder

public DataQueryListModelBuilder(String keyName)
Construct a new DataQueryListModelBuilder that returns a Map containing all the data in each row (rather than a single column).

Parameters:
keyName - the name of the Property that stores the row's primary key.
Method Detail

getDataQuery

protected abstract DataQuery getDataQuery(PageState ps)
Returns the data query for the current request. Child classes should override this method to construct the appropriate data query (or obtain a named query), and then apply the right filters and sorts to it.

Parameters:
ps - represents the current request
Returns:
the DataQuery for the request

makeModel

public ListModel makeModel(List l,
                           PageState ps)
Description copied from interface: ListModelBuilder
Produce a ListModel for the request specified by state. This method is called at least once, and usually only once, for each request served by the List that this ListModelBuilder has been added to.

Specified by:
makeModel in interface ListModelBuilder
Parameters:
ps - contains the request specific data for the request
Returns:
the abstract representation of the list item for this request


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC