GenericPicker

Document created by resplin Employee on Jun 6, 2015Last modified by alfresco-archivist on Aug 31, 2016
Version 3Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



JSF Component
Back to Component Library


Generic Picker


General Description


The Generic Picker component provides a mechanism to allow the user to define a search, show the results and then pick from those results. The component displays a simple HTML list box with a textbox for entering search text. When the user selects the Search button the component calls a query callback method which the developer will implement to return the results for the search text. The component optionally provides an Add button with action and actionListener method bindings as a hook point for interacting with the results. The component is designed to be highly flexible and most UI elements are optional and configurable.


Tag Details


<string>'
rendered='<boolean>'
showFilter='<boolean'>
showContains='<boolean'>
showAddButton='<boolean'>
filterRefresh='<boolean'>
addButtonLabel='<string>'
action='<string>'
actionListener='<method-binding>'
width='<integer>'
height='<integer>'
filters='<property-binding>'
queryCallback='<method-binding>' MANDATORY
/>

Custom tag attributes


showFilter - whether to show the optional Filter drop-down control. Default is true.

showContains - whether to show the Contains textbox search text control. Default is true.

showAddButton - whether to show the Add button control. Default is true.

filterRefresh - whether the component should immediately refresh its results when the selection in the filter drop-down control is changed. Default is false.

addButtonLabel - override for the Add button control text label. Default is to use a string from the default messages bundle.

action - command outcome action value executed when the Add button is clicked.

actionListener - command listener method binding executed when the Add button is clicked.

width - width of the results area in pixels. Default is 250.

height - height of the results area in pixels. Default is 100.

filters - bean property binding that must return an array of SelectItem objects. The objects define the list of items to be shown in the Filter drop-down control. This property is mandatory if the showFilter property is set to true.

queryCallback - bean method binding that will execute a query as appropriate for the selector. The method is passed the Contains text value entered by the user and the index of the filter drop-down selection if any. The method should return an array of SelectItem[] objects which represent the list of results to display to the user for selection.
Method signature:

  /**
   * Query callback method executed by the Generic Picker component.
   * This method is part of the contract to the Generic Picker, it is up to the backing bean
   * to execute whatever query is appropriate and return the results.
   *
   * @param filterIndex        Index of the filter drop-down selection
   * @param contains           Text from the contains textbox
   *
   * @return An array of SelectItem objects containing the results to display in the picker.
   */
  public SelectItem[] pickerCallback(int filterIndex, String contains);

Example


Example showing the component with basic defaults setup to get filters and execute a query and call the specified actionListener handler when the user presses the Add button:

<a:genericPicker filters='#{Bean.filters}' queryCallback='#{Bean.pickerCallback}'
  actionListener='#{Bean.addClicked}' />


Example showing the component with the Add button disabled and the filter drop-down selection feature set to immediately refresh the results list on change:

<a:genericPicker showAddButton='false' filters='#{Bean.filters}' queryCallback='#{Bean.mycallback}'
  filterRefresh='true' />

Screenshots


Shows the picker with basic defaults, setup to show query for Users/Groups with a filter:

GenericPicker_1.png

Picker with the Filter drop-down control removed and the Add button hidden:

GenericPicker_2.png

Outcomes