Auto Complete

When a user starts typing in an input text field, a list of suggestions drop down for the user to select. By default, input of a PersistenceEntity instance is auto complete enabled. For example, Employee is a PersistenceEntity, so typing partial employee id or name will trigger drop down of suggestions.

Property annotation


	@Property(...
		autoComplete=false, minQueryLength=1, forceSelection=false)
By default, autoComplete is not enabled except for PersistenceEntity type. minQueryLength specifies how many characters will triger ajax drop down of suggestions, and forceSelection specifies whether the selection from suggestions is required. For PersistenceEntity type, the query criteria of suggestions for a EntityProperty is built from the following Property selectPropertyQueryElements is used to build the query criteria for its value selections, and it can be specified using property annotations:

	@Property(...
		dynamicSelectQuery=false, selectQuery={PropertyCriterion})
If property selectQuery is dynamic, its EntityBackingBean needs to override

	public CriteriaElement[] getDynamicSelectPropertyQueryElements(PersistenceDataBackingBean<T> backingBean, 
		T entity, EntityProperty<T> property) throws SystemException {
		// return an array of CriteriaElements that is used to build query criteria
	}
By default, entity property id and name are used to match the user input. Its EntityBackingBean can override the following method to provide the CriteriaElement to retrieve entities as suggestions.

	@Override
	public <E extends PersistenceEntity> CriteriaExpression getAutoCompleteQueryElement(
			PersistenceDataBackingBean<E> backingBean, E entity, 
			EntityProperty<E> property, String userInput) throws SystemException {
	}
For non-PersistenceEntity type, its EntityBackingBean needs to override the method to provide a list of suggestion for the user input.

	@Override
	public List<String> getAutoCompleteSuggestions(PersistenceDataBackingBean<T> backingBean, T entity, 
			EntityProperty<T> property, String userInput) throws SystemException {
		// return a list of string as suggestions
	}