com.ibm.bpe.jsf.handler
Class BPCListHandler

java.lang.Object
  extended bycom.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 which provides the data shown in a List Component. In order to link a Managed Bean of the type BPCListHandler with a List Component on a page, the Value Binding Expressoin of the list tag has to be targeted at the Managed Bean. For more information about the List Component see ListTag. The BPCListHandler will emit Item Changed Events if a single item in the associated List Component has been selected. ItemListener can be registered on the BPCListHandler using the ItemListener property. For more information about using the ItemListener interface, see example under 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 get hold of meta information about the model objects that are accessed through the instance of the BPCDetailsHandler.

Example for referencing a BPCListComponent instance as 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>

 


Nested Class Summary
 class BPCListHandler.PagingHelper
          This class is not for public usage.
 class BPCListHandler.SelectionHelper
          This class is not for public usage.
 class BPCListHandler.SortHelper
          This class is not for public usage.
 
Field Summary
static java.lang.String ATTRIBUTE_FOR_SORTING
          This is the name of the component attribute that determines which row will be used when sorting the result.
static java.lang.String COPYRIGHT
           
 
Constructor Summary
BPCListHandler()
           
 
Method Summary
 void addItemListener(ItemListener listener)
          Adds a new ItemListener to the list of ItemListener.
 void clearSelection()
           
 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.
 java.util.List getItems()
          Returns the list of items retrieved by runing the associated query.
 BPCListHandler.PagingHelper getPagingHelper()
           
 com.ibm.bpc.clientcore.Query getQuery()
          Returns the registered query object.
 Message getQueryMessage()
          Returns Messages indication problems during the execution of the query.
 java.util.List getSelectedItems()
          Returns all selected items in the list.
 BPCListHandler.SelectionHelper getSelectionHelper()
           
 BPCListHandler.SortHelper getSortHelper()
           
 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 on this instance.
 void setItemListener(java.util.List list)
          Sets the list of ItemListener.
 void setQuery(com.ibm.bpc.clientcore.Query newQuery)
          Sets the query used for retrieving 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
This is the name of the component attribute that determines which row will be used when sorting the result. 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()

getItems

public java.util.List getItems()
Returns the list of items retrieved by runing 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 can be used Faces Action Method.

Returns:
null which means stay on this page.

refreshList

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

Returns:
null which means stay on this page.

setQuery

public void setQuery(com.ibm.bpc.clientcore.Query newQuery)
Sets the query used for retrieving 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 TODO Review(aschoen,Brian): Is it appropriate to throw an assertion ??

getQuery

public com.ibm.bpc.clientcore.Query getQuery()
Returns the registered query object.

Returns:
the query used for retrieving the list of items.

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 not manadatory.

Parameters:
typeName - The model type TODO Review(aschoen,Brian): Is it appropriate to throw an assertion ??

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 out of an action method that is referenced using the action attribute of the ColumnTag. If called out of differed context the item might not valid any more.

Returns:
the currently selected item.

getSelectedItems

public java.util.List getSelectedItems()
Returns all selected items in the list. In contrast to getItem, this method returnes the items whose checkboxes in the list are selected. While getItem returns the single item which 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.

Returns:
List of ItemListener

setItemListener

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

Parameters:
list - The list of ItemListener

addItemListener

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

Parameters:
listener - A 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 filed, the error messages will be shown in the associated List Component.

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

setErrors

public void setErrors(java.util.Map errors)
Sets the errors map on this instance. If errors for items in the list have been filed, it will be displayed by the DetailsComponent.

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

getQueryMessage

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

Returns:
The Message

getPagingHelper

public BPCListHandler.PagingHelper getPagingHelper()

getSelectionHelper

public BPCListHandler.SelectionHelper getSelectionHelper()

getSortHelper

public BPCListHandler.SortHelper getSortHelper()