com.ibm.bpe.jsf.handler
Class BPCListHandler

java.lang.Object
  extended by com.ibm.bpe.jsf.handler.BPCListHandler
All Implemented Interfaces:
ErrorHandler, ItemProvider

public class BPCListHandler
extends java.lang.Object
implements ItemProvider, ErrorHandler

This class can be used as a Faces Managed Bean that provides the data to be displayed in a List Component. In order to associate a Managed Bean of type BPCListHandler with a List Component on a page, the Value Binding Expression of the list tag must be targeted at the Managed Bean. For more information about the List Component, see ListTag. The BPCListHandler class generates Item Changed events whenever an item in the associated List Component is selected. The ItemListener can be registered on the BPCListHandler using the ItemListener property. For more information about using the ItemListener interface, see the example shown in ItemListener.

Example:

 
  
   
   <managed-bean>
   <managed-bean-name>ProcessInstanceList</managed-bean-name>
   <managed-bean-class>com.ibm.bpe.jsf.handler.BPCListHandler</managed-bean-class>
   <managed-bean-scope>session</managed-bean-scope>
   <managed-property>
   <property-name>type</property-name>
   <value>com.ibm.bpe.client.model.ProcessInstanceBean</value>
   </managed-property>
   <managed-property>
   <property-name>itemListener</property-name>
   <list-entries>
   <value-class>com.ibm.bpe.jsf.handler.ItemListener</value-class>
   <value>#{ProcessInstanceDetailsBean}</value>
   </list-entries>
   </managed-property>
   <managed-property>
   <property-name>query</property-name>
   <value>#{ProcessInstanceQuery}</value>
   </managed-property>
   </managed-bean>
   
   
   
  
 
The specified type enables Components to retrieve metadata about the model objects that are accessed through the BPCDetailsHandler instance.

Example of how to use a BPCListComponent instance as a model of a ListComponent:
 
  
   
   <bpe:list model="#{ProcessInstanceList}" rows="5" styleClass="list" headerStyleClass="listHeader" rowClasses="normal">
   <bpe:column name="name" action="processInstanceDetails" />
   <bpe:column name="processTemplateName" action="processTemplateDetails" />
   <bpe:column name="executionState" />
   <bpe:column name="startTime" />
   </bpe:list>
   
   
  
 


Field Summary
static java.lang.String ATTRIBUTE_FOR_SORTING
          The name of the component attribute that determines which row is used when sorting the results.
static java.lang.String COPYRIGHT
           
 
Constructor Summary
BPCListHandler()
           
 
Method Summary
 void addItemListener(ItemListener listener)
          Adds a new ItemListener object to the list of ItemListener objects.
 void clearSelection()
          Resets the selection of the associated list to 'none'.
 java.lang.String executeQuery()
          Triggers execution of the associated query.
 java.util.Map getErrors()
          Returns the errors map for items in the list.
 java.lang.Object getItem()
          Returns the currently selected item.
 java.util.List getItemListener()
          Returns a list of all registered ItemListener objects.
 java.util.List getItems()
          Returns a list of all the items retrieved by running the associated query.
 java.lang.String getName()
          Returnes the list name.
 boolean getNotEmpty()
           
 com.ibm.bpe.jsf.handler.BPCListHandlerPagingHelper getPagingHelper()
          The returned class is not for public use.
 Query getQuery()
          Returns the registered query object.
 Message getQueryMessage()
          Returns message indication problems that occurred during execution of the query.
 java.util.List getSelectedItems()
          Returns all selected items in the list.
 com.ibm.bpe.jsf.handler.BPCListHandlerSelectionHelper getSelectionHelper()
          The returned class is not for public use.
 com.ibm.bpe.jsf.handler.BPCListHandlerSortHelper getSortHelper()
          The returned class is not for public use.
 java.lang.String getType()
          Returns the expected type of the query model.
 java.lang.String refreshList()
          Triggers a refresh of the list by executing the associated query.
 java.lang.String refreshList(boolean clearErrors)
          Triggers a refresh of the list by executing the associated query.
 void setErrors(java.util.Map errors)
          Sets the errors map for this instance.
 void setItemListener(java.util.List list)
          Sets the list of ItemListener objects.
 void setName(java.lang.String name)
          Sets the list name.
 void setQuery(Query newQuery)
          Sets the query used to retrieve the list of items.
 void setType(java.lang.String typeName)
          Sets the type of the BPCListHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

ATTRIBUTE_FOR_SORTING

public static final java.lang.String ATTRIBUTE_FOR_SORTING
The name of the component attribute that determines which row is used when sorting the results. Sorting is triggered by the Command Listener Method sortBy(ActionEvent).

See Also:
Constant Field Values
Constructor Detail

BPCListHandler

public BPCListHandler()
Method Detail

clearSelection

public void clearSelection()
Resets the selection of the associated list to 'none'.


getItems

public java.util.List getItems()
Returns a list of all the items retrieved by running the associated query.

Returns:
List of all items retrieved by the associated query

refreshList

public java.lang.String refreshList(boolean clearErrors)
Triggers a refresh of the list by executing the associated query. The method uses a Faces Action Method.

Returns:
null stay on this page.

refreshList

public java.lang.String refreshList()
Triggers a refresh of the list by executing the associated query. The method uses a Faces Action Method. The error map is cleared automatically.

Returns:
null stay on this page.

executeQuery

public java.lang.String executeQuery()
                              throws ClientException
Triggers execution of the associated query. Passes exceptions so that the caller can perform error handling. The error map is not touched.

Returns:
null stay on this page.
Throws:
ClientException

setQuery

public void setQuery(Query newQuery)
Sets the query used to retrieve the list of items. If both the 'type' property of the BPCListHandler and the 'type' property of the query are set, an assertion is thrown if they differ.

Parameters:
newQuery - The query used to retrieve the model

getQuery

public Query getQuery()
Returns the registered query object.

Returns:
the query used to retrieve the list of items.

getName

public java.lang.String getName()
Returnes the list name.


setName

public void setName(java.lang.String name)
Sets the list name.


setType

public void setType(java.lang.String typeName)
Sets the type of the BPCListHandler. If both the 'type' property of the BPCListHandler and the 'type' property of the query are set, an assertion is thrown if they differ. This property is optional.

Parameters:
typeName - The model type

getType

public java.lang.String getType()
Returns the expected type of the query model.

Returns:
The model type

getItem

public java.lang.Object getItem()
Returns the currently selected item. This method could be called as a result of an action method that is referenced using the action attribute of the ColumnTag. If called in any other context, the item might no longer be valid.

Returns:
the currently selected item.

getSelectedItems

public java.util.List getSelectedItems()
Returns all selected items in the list. In contrast to the getItem method, this method returns all items for which checkboxes in the list are selected (getItem returns the single item that has been selected by clicking on its link in the associated list).

Specified by:
getSelectedItems in interface ItemProvider
Returns:
List of selected items

getItemListener

public java.util.List getItemListener()
Returns a list of all registered ItemListener objects.

Returns:
List of ItemListener

setItemListener

public void setItemListener(java.util.List list)
Sets the list of ItemListener objects. For example, this method is called if ItemListeners are specified as the managed-bean-property of a BPCListHandler instance in a faces configuration file. It overwrites any ItemListener objects that have been set using the addItemListener method.

Parameters:
list - The list of ItemListener objects

addItemListener

public void addItemListener(ItemListener listener)
Adds a new ItemListener object to the list of ItemListener objects.

Parameters:
listener - An ItemListener

getErrors

public java.util.Map getErrors()
Returns the errors map for items in the list. If errors for items in the list have been registered, the error messages are displayed in the associated List Component.

Specified by:
getErrors in interface ErrorHandler
Returns:
The errors that occurred while processing commands

setErrors

public void setErrors(java.util.Map errors)
Sets the errors map for this instance. If errors for items in the list have been registerd, they are displayed by the DetailsComponent.

Specified by:
setErrors in interface ErrorHandler
Parameters:
errors - The errors that occurred while processing commands

getQueryMessage

public Message getQueryMessage()
Returns message indication problems that occurred during execution of the query. This method can be used to obtain more information about why a query returned no data.

Returns:
The Message

getPagingHelper

public com.ibm.bpe.jsf.handler.BPCListHandlerPagingHelper getPagingHelper()
The returned class is not for public use.


getSelectionHelper

public com.ibm.bpe.jsf.handler.BPCListHandlerSelectionHelper getSelectionHelper()
The returned class is not for public use.


getSortHelper

public com.ibm.bpe.jsf.handler.BPCListHandlerSortHelper getSortHelper()
The returned class is not for public use.


getNotEmpty

public boolean getNotEmpty()