|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.click.control.AbstractControl
org.apache.click.control.Field
org.apache.click.control.TextField
org.apache.click.extras.control.AutoCompleteTextField
public abstract class AutoCompleteTextField
Provides an Auto Complete Text Field control: <input type='text'>.
Text Field |
AutoCompleteTextField nameField = new AutoCompleteTextField("name") { public List getAutoCompleteList(String criteria) { return getCustomerService().getCustomerNamesLike(criteria); } }; form.add(nameField);
Field Summary | |
---|---|
protected String |
autoCompleteOptions
The JavaScript 'script.aculo.us' Autocompleter initialization options, default value is: {minChars:1}. |
Fields inherited from class org.apache.click.control.TextField |
---|
maxLength, minLength, size, VALIDATE_TEXTFIELD_FUNCTION |
Fields inherited from class org.apache.click.control.Field |
---|
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value |
Fields inherited from class org.apache.click.control.AbstractControl |
---|
actionListener, attributes, headElements, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface org.apache.click.Control |
---|
CONTROL_MESSAGES |
Constructor Summary | |
---|---|
AutoCompleteTextField()
Create a AutoCompleteTextField with no name defined. |
|
AutoCompleteTextField(String name)
Construct the AutoCompleteTextField with the given name. |
|
AutoCompleteTextField(String name,
boolean required)
Construct the AutoCompleteTextField with the given name and required status. |
|
AutoCompleteTextField(String name,
String label)
Construct the AutoCompleteTextField with the given name and label. |
|
AutoCompleteTextField(String name,
String label,
boolean required)
Construct the AutoCompleteTextField with the given name, label and required status. |
|
AutoCompleteTextField(String name,
String label,
int size)
Construct the AutoCompleteTextField with the given name, label and size. |
Method Summary | |
---|---|
abstract List |
getAutoCompleteList(String criteria)
Return the list of suggested values for the given search criteria. |
String |
getAutoCompleteOptions()
Return the JavaScript 'script.aculo.us' Autocompleter initialization options, default value is: {}. |
List<Element> |
getHeadElements()
Return the list of HEAD elements
(resources) to be included in the page. |
void |
onInit()
Register the field with the parent page to intercept POST autocompletion requests. |
boolean |
onProcess()
Process the page request and if an auto completion POST request then render an list of suggested values. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the AutoCompleteTextField. |
protected void |
renderAutoCompleteList(List<String> autoCompleteList)
Render the suggested auto completion list to the servlet response. |
void |
setAutoCompleteOptions(String options)
Set the JavaScript 'script.aculo.us' Autocompleter initialization options, default value is: {minChars:1}. |
void |
setParent(Object parent)
|
Methods inherited from class org.apache.click.control.TextField |
---|
getControlSizeEst, getMaxLength, getMinLength, getSize, getTag, getType, getValidationJavaScript, setMaxLength, setMinLength, setSize, validate |
Methods inherited from class org.apache.click.control.Field |
---|
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getContext, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, onRender, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String autoCompleteOptions
Constructor Detail |
---|
public AutoCompleteTextField(String name)
name
- the name of the fieldpublic AutoCompleteTextField(String name, boolean required)
name
- the name of the fieldrequired
- the field required statuspublic AutoCompleteTextField(String name, String label)
name
- the name of the fieldlabel
- the label of the fieldpublic AutoCompleteTextField(String name, String label, boolean required)
name
- the name of the fieldlabel
- the label of the fieldrequired
- the field required statuspublic AutoCompleteTextField(String name, String label, int size)
name
- the name of the fieldlabel
- the label of the fieldsize
- the size of the fieldpublic AutoCompleteTextField()
Method Detail |
---|
public abstract List getAutoCompleteList(String criteria)
criteria
- the search criteria
public String getAutoCompleteOptions()
public void setAutoCompleteOptions(String options)
public void onInit() { AutoCompleteTextField cityField = new AutoCompleteTextField("cityField"); HtmlStringBuffer buffer = new HtmlStringBuffer(); buffer.append("{"); // Options opens with squiggly bracket buffer.append(stateField.getName()); buffer.append("="); buffer.append(stateField.getValue()); buffer.append("&"); buffer.append(idField.getName()); buffer.append("="); buffer.append(idField.getValue()); buffer.append("}"); // Options closes with squiggly bracket field.setAutoCompleteOptions(options.toString()); }Note that you can add any of the options specified on the Ajax-AutoCompleter wiki.
options
- the JavaScript Autocompleter initialization optionspublic void setParent(Object parent)
setParent
in interface Control
setParent
in class Field
parent
- the parent of the Control
IllegalStateException
- if AbstractControl.name
is not defined
IllegalArgumentException
- if the given parent instance is
referencing this object: if (parent == this)Field.setParent(Object)
public List<Element> getHeadElements()
elements
(resources) to be included in the page. The resources are:
getHeadElements
in interface Control
getHeadElements
in class AbstractControl
IllegalStateException
- if the field's name has not been set or
if the field is not attached to the PageControl.getHeadElements()
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class TextField
buffer
- the specified buffer to render the control's output toAbstractControl.toString()
public void onInit()
onInit
in interface Control
onInit
in class AbstractControl
Control.onInit()
public boolean onProcess()
onProcess
in interface Control
onProcess
in class Field
Control.onProcess()
protected void renderAutoCompleteList(List<String> autoCompleteList)
autoCompleteList
- the suggested list of auto completion values
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |