Define actions available on a search form with the actions property on the ComponentSearchPresenter object:
By default, these actions are only visible once the search has been executed. To change this behaviour, you can add the following property:
<property name="enableActionsIfDirty" value="false" />Types of action
Component creation
An action can be added to allow users to create a component from a search form. This type of action pre-indexes the component to be created based on the search criteria.
For example, if a user searches for a document in the Invoice class with a status tag whose value is paid, then the action will create a document with the same information.
Screen change
GoToPlaceActionPresenter type actions are used to switch screens.
Activation
Control when an action is available with the enablingStrategy property. Built-in strategies:
Whatever the search results (default):
AnyResultEnablingStrategy<bean class="com.flower.docs.gui.client.search.action.AnyResultEnablingStrategy" />Only if the search leads to no results:
NoResultEnablingStrategy<bean class="com.flower.docs.gui.client.search.action.NoResultEnablingStrategy" />If the user has selected a certain number of components based on an operator:
MultipleComponentsEnablingStrategyThis activation strategy has two properties:operator: The operator used to evaluate the number of components selected. The following operators are available:EQUALS_TO,GREATER_THAN,LESS_THANandDIFFERENT.componentsCount: The number of components
Example: Activating the action, if the number of selected components is equal or more than 2.
<bean class="com.flower.docs.gui.client.search.action.MultipleComponentsEnablingStrategy"> <property name="componentsCount" value="2"/> <property name="operator"> <value type="com.flower.docs.domain.search.Operators">GREATER_THAN</value> </property> </bean>