org.bejug.javacareers.common.ajax
Class TextField

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended byjavax.faces.component.UIOutput
              extended byjavax.faces.component.UIInput
                  extended byjavax.faces.component.html.HtmlInputText
                      extended byorg.bejug.javacareers.common.ajax.TextField
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder

public class TextField
extends javax.faces.component.html.HtmlInputText

Completion-capable JSF text field. The component has a completionMethod which is called repeatedly (asynchronously) and is in charge of registering completion results (which will be populated in the completion dialog for this field).

The component will render CSS and JavaScript into the page. These JavaScript and CSS class names could potentially interact with your own JSP contents if there is a name conflict so if you observe strange results, try changing your method names or style classes.

Author:
Tor Norbye Todo Pick more unique namespace names for the style classes and the javascript methods - perhaps prefixed by "ajax" or "ajtf" (ajax text field), or maybe even "blueprints" ? Todo Add property "maxResults", setting the max number of completion items shown in the completion popup Todo Add property "Delay (milliseconds)" - an optional timer delay before popup should appear or get updated after keystrokes Todo Add property "showOnFocus", which when set will cause the completion dialog to be shown showing the first possible matches even before the user has typed anything into the text field

Field Summary
 
Fields inherited from class javax.faces.component.html.HtmlInputText
COMPONENT_TYPE
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
TextField()
          constructor.
 
Method Summary
 java.lang.String getCompletionMethod()
           
 int getMaxCount()
          Return the maximum number of results returned from this text field
 java.lang.String getOnchoose()
           
 java.lang.String getOndisplay()
           
 java.lang.String getText()
          Render a textual textfield.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
          to restore the state of the textfield.
 java.lang.Object saveState(javax.faces.context.FacesContext context)
          to save the state of the textfield.
 void setCompletionMethod(java.lang.String completionMethod)
           
 void setOnchoose(java.lang.String onchoose)
           
 void setOndisplay(java.lang.String ondisplay)
           
 void setText(java.lang.String text)
           
 
Methods inherited from class javax.faces.component.html.HtmlInputText
getAccesskey, getAlt, getDir, getLang, getMaxlength, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getSize, getStyle, getStyleClass, getTabindex, getTitle, isDisabled, isReadonly, setAccesskey, setAlt, setDir, setDisabled, setLang, setMaxlength, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setReadonly, setSize, setStyle, setStyleClass, setTabindex, setTitle
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, compareValues, decode, getConvertedValue, getFamily, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValue, setValueChangeListener, updateModel, validate, validateValue
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, getValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter
 

Constructor Detail

TextField

public TextField()
constructor.

Method Detail

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
to save the state of the textfield.

Parameters:
context - the FacesContext.
Returns:
an array containing the possible states of the textfield.

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
to restore the state of the textfield.

Parameters:
context - the FacesContext.
state - the state to restore.

setOnchoose

public void setOnchoose(java.lang.String onchoose)
Parameters:
onchoose - a String containing the onchoose to set.

getOnchoose

public java.lang.String getOnchoose()
Returns:
the onchoose.

setOndisplay

public void setOndisplay(java.lang.String ondisplay)
Parameters:
ondisplay - the ondisplay, as a string, to set.

getOndisplay

public java.lang.String getOndisplay()
Returns:
the ondisplay.

setCompletionMethod

public void setCompletionMethod(java.lang.String completionMethod)
Parameters:
completionMethod - the completionmethod as a string.

getCompletionMethod

public java.lang.String getCompletionMethod()
Returns:
the completionmethod.

getText

public java.lang.String getText()

Render a textual textfield.

Returns:
a String containing the rendering of a textfield.

setText

public void setText(java.lang.String text)
Parameters:
text - is text to set
See Also:
getText()

getMaxCount

public int getMaxCount()
Return the maximum number of results returned from this text field

Returns:
A numberf indicating the maximum number of completion matches that should be returned/displayed


Copyright © 2005-2006 BeJUG. All Rights Reserved.