Class CheckGroup<T>

  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.form.LabeledWebMarkupContainer
                  extended by org.apache.wicket.markup.html.form.FormComponent<java.util.Collection<T>>
                      extended by org.apache.wicket.markup.html.form.CheckGroup<T>
Type Parameters:
T - The model object type
All Implemented Interfaces:, java.lang.Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IRequestListener, IFormModelUpdateListener, IFormVisitorParticipant, ILabelProvider<java.lang.String>, IOnChangeListener, IHeaderContributor, IRequestableComponent, IHierarchical<Component>

public class CheckGroup<T>
extends FormComponent<java.util.Collection<T>>
implements IOnChangeListener

Component used to connect instances of Check components into a group. Instances of Check have to be in the component hierarchy somewhere below the group component. The model of the CheckGroup component has to be an instance of java.util.Collection. The model collection of the group is filled with model objects of all selected Check components. ie ... choice 1 ... choice 2 ...

Igor Vaynberg
See Also:

Note: This component does not support cookie persistence, Serialized Form

Field Summary
Fields inherited from class org.apache.wicket.markup.html.form.FormComponent
Fields inherited from class org.apache.wicket.Component
Fields inherited from interface org.apache.wicket.markup.html.form.IOnChangeListener
Constructor Summary
CheckGroup(java.lang.String id)
          Constructor that will create a default model collection
CheckGroup(java.lang.String id, java.util.Collection<T> collection)
          Constructor that wraps the provided collection with the org.apache.wicket.model.Model object
CheckGroup(java.lang.String id, IModel<? extends java.util.Collection<T>> model)
Method Summary
protected  java.util.Collection<T> convertValue(java.lang.String[] values)
          Subclasses should overwrite this if the conversion is not done through the type field and the IConverter.
protected  boolean getStatelessHint()
          Returns whether the component can be stateless.
protected  void onComponentTag(ComponentTag tag)
          Processes the component tag.
 void onSelectionChanged()
          Called when a selection changes.
protected  void onSelectionChanged(java.util.Collection<? extends T> newSelection)
          Template method that can be overridden by clients that implement IOnChangeListener to be notified by onChange events of a select element.
 void updateModel()
          See FormComponent.updateCollectionModel(FormComponent) for details on how the model is updated.
protected  boolean wantOnSelectionChangedNotifications()
          This method should be overridden to return true if it is desirable to have on-selection-changed notification.
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent
add, add, checkRequired, clearInput, convertInput, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
getLabel, setLabelInternal
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, 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, getFeedbackMessage, 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, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onInitialize, 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, warn, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public CheckGroup(java.lang.String id)
Constructor that will create a default model collection

id - component id


public CheckGroup(java.lang.String id,
                  java.util.Collection<T> collection)
Constructor that wraps the provided collection with the org.apache.wicket.model.Model object

id - component id
collection - collection to be used as the model


public CheckGroup(java.lang.String id,
                  IModel<? extends java.util.Collection<T>> model)
id -
model -
See Also:
WebMarkupContainer.WebMarkupContainer(String, IModel)
Method Detail


protected java.util.Collection<T> convertValue(java.lang.String[] values)
                                        throws ConversionException
Description copied from class: FormComponent
Subclasses should overwrite this if the conversion is not done through the type field and the IConverter. WARNING: this method may be removed in future versions. If conversion fails then a ConversionException should be thrown

convertValue in class FormComponent<java.util.Collection<T>>
values - The value can be the getInput() or through a cookie
The converted value. default returns just the given value
ConversionException - If input can't be converted


public void updateModel()
See FormComponent.updateCollectionModel(FormComponent) for details on how the model is updated.

Specified by:
updateModel in interface IFormModelUpdateListener
updateModel in class FormComponent<java.util.Collection<T>>


protected void onComponentTag(ComponentTag tag)
Description copied from class: FormComponent
Processes the component tag.

onComponentTag in class FormComponent<java.util.Collection<T>>
tag - Tag to modify
See Also:


public final void onSelectionChanged()
Called when a selection changes.

Specified by:
onSelectionChanged in interface IOnChangeListener


protected void onSelectionChanged(java.util.Collection<? extends T> newSelection)
Template method that can be overridden by clients that implement IOnChangeListener to be notified by onChange events of a select element. This method does nothing by default.

Called when a Check is clicked in a CheckGroup that wants to be notified of this event. This method is to be implemented by clients that want to be notified of selection events.

newSelection - The new selection of the CheckGroup. NOTE this is the same as you would get by calling getModelObject() if the new selection were current


protected boolean wantOnSelectionChangedNotifications()
This method should be overridden to return true if it is desirable to have on-selection-changed notification.

true if component should receive on-selection-changed notifications, false otherwise


protected boolean getStatelessHint()
Description copied from class: Component
Returns whether the component can be stateless. Also the component behaviors must be stateless, otherwise the component will be treat as stateful. In order for page to be stateless (and not to be stored in session), all components (and component behaviors) must be stateless.

getStatelessHint in class Component
whether the component can be stateless

Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.