com.arsdigita.toolbox.ui
Class DataQueryListModelBuilder.DataQueryListModel

java.lang.Object
  extended bycom.arsdigita.toolbox.ui.DataQueryListModelBuilder.DataQueryListModel
All Implemented Interfaces:
ListModel
Enclosing class:
DataQueryListModelBuilder

public class DataQueryListModelBuilder.DataQueryListModel
extends Object
implements ListModel

Encapsulates a DataQuery as a ListModel. Uses the key and value attributes as specified in the DataQueryListModelBuilder constructor.


Field Summary
 
Fields inherited from interface com.arsdigita.bebop.list.ListModel
versionId
 
Constructor Summary
DataQueryListModelBuilder.DataQueryListModel(DataQuery dq, String keyName, String valueName)
          Construct a new DataQueryListModel
 
Method Summary
 Object getElement()
          Return the value of the attribute specified in the valueName constructor parameter.
 String getKey()
          Returns the string representation of the primary key of the current row.
 boolean next()
          Advance to the next row
 long size()
          Return the number of rows in the query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataQueryListModelBuilder.DataQueryListModel

public DataQueryListModelBuilder.DataQueryListModel(DataQuery dq,
                                                    String keyName,
                                                    String valueName)
Construct a new DataQueryListModel

Parameters:
dq - the DataQuery that will be used to supply the list with data
keyName - the name of the attribute which contains the primary key for each row of the query
valueName - the name of the attribute which contains the value for each row of the query
Method Detail

next

public boolean next()
             throws NoSuchElementException
Advance to the next row

Specified by:
next in interface ListModel
Returns:
false if the query was exhausted, true otherwise
Throws:
NoSuchElementException

getElement

public Object getElement()
Return the value of the attribute specified in the valueName constructor parameter. This value will most likely be used by the ListCellRenderer to display a label.

Specified by:
getElement in interface ListModel
Returns:
the value of the current row
See Also:
ListCellRenderer

getKey

public String getKey()
Returns the string representation of the primary key of the current row. The primary key is the value of the attribute specified in the keyName constructor parameter. This value will be used to uniquely identify the current row.

Specified by:
getKey in interface ListModel
Returns:
the primary key as a string
See Also:
List.getSelectedKey(PageState)

size

public long size()
Return the number of rows in the query



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