org.ujorm.wicket.component.form.fields
Class ComboField<T extends Ujo>

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.panel.Panel
                  extended by org.apache.wicket.markup.html.panel.GenericPanel<T>
                      extended by org.ujorm.wicket.component.form.fields.Field<T>
                          extended by org.ujorm.wicket.component.form.fields.ComboField<T>
All Implemented Interfaces:
Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IConverterLocator, org.apache.wicket.IGenericComponent<T>, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, org.apache.wicket.util.io.IClusterable

public class ComboField<T extends Ujo>
extends Field<T>

CheckBox field with a Label including a feedback message.

Author:
Pavel Ponec
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ujorm.wicket.component.form.fields.Field
behaviors, CSS_REQUIRED, cssClass, DEFAULT_DELAY, feedback, key, PROPERTY_PREFIX, validators
 
Fields inherited from class org.apache.wicket.markup.html.panel.Panel
PANEL
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
ComboField(Key<U,T> key, List<T> items, Key<T,?> selectId, Key<T,?> display)
           
ComboField(String componentId, Key<U,T> key, List<T> items, Key<T,?> selectId, Key<T,?> display, String cssClass)
           
 
Method Summary
protected  org.apache.wicket.ajax.AjaxEventBehavior createChangeBehaviour(String action, String jsEvent)
          Create new AjaxFormComponentUpdatingBehavior with delay 300 ms.
protected  org.apache.wicket.markup.html.form.FormComponent createInput(String componentId, org.apache.wicket.model.IModel<T> model)
          Create Form inputComponent
protected  Object getComboDisplayValue(T object)
          Get the value for displaying to an end user.
protected  String getComboIdValue(T object, int index)
          This method is called to get the id value of an object (used as the value attribute of a choice element) The id can be extracted from the object like a primary key, or if the list is stable you could just return a toString of the index.
 List<T> getItems()
          Get component items
 Key<T,?> getKeyDisplay()
          Get a key to display
 Key<T,?> getKeyId()
          Get the indentifier key
static
<T extends OrmUjo>
ComboField<T>
of(Key<?,T> key, org.ujorm.criterion.Criterion<T> items, Key<T,?> display)
          Create new ComboField using database request
static
<T extends OrmUjo>
ComboField<T>
of(Key<?,T> key, Query<T> query, Key<T,?> display)
          Create new ComboField using database request
 void onChange(String action)
          Create an Updating Behavior with "keyup" event
 
Methods inherited from class org.ujorm.wicket.component.form.fields.Field
addBehaviour, addBehaviourOnBlur, addMaxLength, addValidator, addValidator, createLabel, createLabelModel, getCssClass, getInput, getKey, getModelValue, getResourceLabelKey, getValidators, getVisibleModel, isRequired, onConfigure, onInitialize, onSuperInitialize, requestFocus, setFeedbackMessage, setModelValue, setVisibleModel, toString
 
Methods inherited from class org.apache.wicket.markup.html.panel.GenericPanel
getModel, getModelObject, setModel, setModelObject
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
newMarkupSourcingStrategy
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest, getWebResponse, getWebSession
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onDetach, onEvent, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComboField

public ComboField(Key<U,T> key,
                  List<T> items,
                  Key<T,?> selectId,
                  Key<T,?> display)

ComboField

public ComboField(String componentId,
                  Key<U,T> key,
                  List<T> items,
                  Key<T,?> selectId,
                  Key<T,?> display,
                  String cssClass)
Method Detail

createInput

protected org.apache.wicket.markup.html.form.FormComponent createInput(String componentId,
                                                                       org.apache.wicket.model.IModel<T> model)
Create Form inputComponent

Overrides:
createInput in class Field<T extends Ujo>

getComboDisplayValue

protected Object getComboDisplayValue(T object)
Get the value for displaying to an end user.

Parameters:
object - the actual object
Returns:
the value meant for displaying to an end user

getComboIdValue

protected String getComboIdValue(T object,
                                 int index)
This method is called to get the id value of an object (used as the value attribute of a choice element) The id can be extracted from the object like a primary key, or if the list is stable you could just return a toString of the index.

Note that the given index can be -1 if the object in question is not contained in the available choices.

Parameters:
object - The object for which the id should be generated
index - The index of the object in the choices list.
Returns:
String

getItems

public List<T> getItems()
Get component items


getKeyId

public final Key<T,?> getKeyId()
Get the indentifier key


getKeyDisplay

public final Key<T,?> getKeyDisplay()
Get a key to display


onChange

public void onChange(String action)
Create an Updating Behavior with "keyup" event

Overrides:
onChange in class Field<T extends Ujo>
Parameters:
field - Field is not used by default, however it can be a switch for different results for example.

createChangeBehaviour

protected org.apache.wicket.ajax.AjaxEventBehavior createChangeBehaviour(String action,
                                                                         String jsEvent)
Create new AjaxFormComponentUpdatingBehavior with delay 300 ms.

Overrides:
createChangeBehaviour in class Field<T extends Ujo>

of

public static <T extends OrmUjo> ComboField<T> of(Key<?,T> key,
                                                  org.ujorm.criterion.Criterion<T> items,
                                                  Key<T,?> display)
Create new ComboField using database request


of

public static <T extends OrmUjo> ComboField<T> of(Key<?,T> key,
                                                  Query<T> query,
                                                  Key<T,?> display)
Create new ComboField using database request



Copyright © 2014. All Rights Reserved.