T
- The model object typepublic class CheckBoxMultipleChoice<T> extends ListMultipleChoice<T>
Java:
List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" }); // Add a set of checkboxes uses Input's 'site' property to designate the // current selections, and that uses the SITES list for the available options. form.add(new CheckBoxMultipleChoice("site", SITES));HTML:
<span valign="top" wicket:id="site"> <input type="checkbox">site 1</input> <input type="checkbox">site 2</input> </span>
AbstractChoice.LabelPosition
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR
ENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
Constructor and Description |
---|
CheckBoxMultipleChoice(String id)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends Collection<T>> model,
IModel<? extends List<? extends T>> choices)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends Collection<T>> model,
IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends Collection<T>> model,
List<? extends T> choices)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends Collection<T>> model,
List<? extends T> choices,
IChoiceRenderer<? super T> renderer)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends List<? extends T>> choices)
Constructor
|
CheckBoxMultipleChoice(String id,
IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
Constructor
|
CheckBoxMultipleChoice(String id,
List<? extends T> choices)
Constructor
|
CheckBoxMultipleChoice(String id,
List<? extends T> choices,
IChoiceRenderer<? super T> renderer)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendOptionHtml(AppendingStringBuffer buffer,
T choice,
int index,
String selected)
Generates and appends html for a single choice into the provided buffer
|
protected IValueMap |
getAdditionalAttributes(int index,
T choice)
You may subclass this method to provide additional attributes to the <input ..> tag.
|
protected String |
getCheckBoxMarkupId(String id)
Creates markup id for the input tag used to generate the checkbox for the element with the
specified
id . |
String |
getPrefix() |
protected String |
getPrefix(int index,
T choice) |
String |
getSuffix() |
protected String |
getSuffix(int index,
T choice) |
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag.
|
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body.
|
CheckBoxMultipleChoice<T> |
setLabelPosition(AbstractChoice.LabelPosition labelPosition)
Sets the preferred position of the <label> for each choice
|
CheckBoxMultipleChoice<T> |
setPrefix(String prefix) |
CheckBoxMultipleChoice<T> |
setSuffix(String suffix) |
convertChoiceIdsToChoices, convertValue, getModelValue, isRetainDisabledSelected, isSelected, setMaxRows, setRetainDisabledSelected, updateModel
detachModel, escapeOptionHtml, getChoiceRenderer, getChoices, getChoicesModel, getDefaultChoice, isDisabled, localizeDisplayValues, setChoiceRenderer, setChoices, setChoices, setOptionAttributes, setType
add, add, checkRequired, clearInput, convertInput, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onDetach, onDisabled, onInvalid, onRequired, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
getLabel
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, 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, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, 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
public CheckBoxMultipleChoice(String id)
id
- See ComponentComponent.Component(String)
,
AbstractChoice.AbstractChoice(String)
public CheckBoxMultipleChoice(String id, List<? extends T> choices)
id
- See Componentchoices
- The collection of choices in the radio choiceComponent.Component(String)
,
AbstractChoice.AbstractChoice(String, java.util.List)
public CheckBoxMultipleChoice(String id, List<? extends T> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentrenderer
- The rendering enginechoices
- The collection of choices in the radio choiceComponent.Component(String)
,
AbstractChoice.AbstractChoice(String,
java.util.List,org.apache.wicket.markup.html.form.IChoiceRenderer)
public CheckBoxMultipleChoice(String id, IModel<? extends Collection<T>> model, List<? extends T> choices)
id
- See Componentmodel
- See Componentchoices
- The collection of choices in the radio choiceComponent.Component(String, org.apache.wicket.model.IModel)
,
AbstractChoice.AbstractChoice(String, org.apache.wicket.model.IModel, java.util.List)
public CheckBoxMultipleChoice(String id, IModel<? extends Collection<T>> model, List<? extends T> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentmodel
- See Componentchoices
- The collection of choices in the radio choicerenderer
- The rendering engineComponent.Component(String, org.apache.wicket.model.IModel)
,
AbstractChoice.AbstractChoice(String, org.apache.wicket.model.IModel,
java.util.List,org.apache.wicket.markup.html.form.IChoiceRenderer)
public CheckBoxMultipleChoice(String id, IModel<? extends List<? extends T>> choices)
id
- See Componentchoices
- The collection of choices in the radio choiceComponent.Component(String)
,
AbstractChoice.AbstractChoice(String, org.apache.wicket.model.IModel)
public CheckBoxMultipleChoice(String id, IModel<? extends Collection<T>> model, IModel<? extends List<? extends T>> choices)
id
- See Componentmodel
- The model that is updated with changes in this component. See Componentchoices
- The collection of choices in the radio choiceAbstractChoice.AbstractChoice(String,
org.apache.wicket.model.IModel,org.apache.wicket.model.IModel)
,
Component.Component(String, org.apache.wicket.model.IModel)
public CheckBoxMultipleChoice(String id, IModel<? extends List<? extends T>> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentchoices
- The collection of choices in the radio choicerenderer
- The rendering engineAbstractChoice.AbstractChoice(String,
org.apache.wicket.model.IModel,org.apache.wicket.markup.html.form.IChoiceRenderer)
,
Component.Component(String)
public CheckBoxMultipleChoice(String id, IModel<? extends Collection<T>> model, IModel<? extends List<? extends T>> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentmodel
- The model that is updated with changes in this component. See Componentchoices
- The collection of choices in the radio choicerenderer
- The rendering engineComponent.Component(String, org.apache.wicket.model.IModel)
,
AbstractChoice.AbstractChoice(String, org.apache.wicket.model.IModel,
org.apache.wicket.model.IModel,org.apache.wicket.markup.html.form.IChoiceRenderer)
public String getPrefix()
protected String getPrefix(int index, T choice)
index
- index of the choicechoice
- the choice itselfgetPrefix()
. Override to have a prefix dependent on the choice item.protected String getSuffix(int index, T choice)
index
- index of the choicechoice
- the choice itselfgetSuffix()
. Override to have a prefix dependent on the choice item.public final CheckBoxMultipleChoice<T> setPrefix(String prefix)
prefix
- Prefix to use before choicepublic String getSuffix()
public final CheckBoxMultipleChoice<T> setSuffix(String suffix)
suffix
- Separator to use between radio optionspublic CheckBoxMultipleChoice<T> setLabelPosition(AbstractChoice.LabelPosition labelPosition)
labelPosition
- The preferred position for the labelthis
instance, for chainingprotected void onComponentTag(ComponentTag tag)
FormComponent
onComponentTag
in class ListMultipleChoice<T>
tag
- Tag to modifyListMultipleChoice.onComponentTag(org.apache.wicket.markup.ComponentTag)
public final void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
AbstractChoice
onComponentTagBody
in class AbstractChoice<Collection<T>,T>
markupStream
- The markup streamopenTag
- The open tag for the bodyComponent.onComponentTagBody(org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
protected void appendOptionHtml(AppendingStringBuffer buffer, T choice, int index, String selected)
appendOptionHtml
in class AbstractChoice<Collection<T>,T>
buffer
- Appending string buffer that will have the generated html appendedchoice
- Choice objectindex
- The index of this optionselected
- The currently selected string valueprotected IValueMap getAdditionalAttributes(int index, T choice)
index
- choice
- protected String getCheckBoxMarkupId(String id)
id
.
NOTE It is useful to override this method if the contract for the generated ids should be fixed, for example in cases when the id generation pattern in this method is used to predict ids by some external javascript. If the contract is fixed in the user's code then upgrading wicket versions will guarantee not to break it should the default contract be changed at a later time.
id
- Copyright © 2006–2016 Apache Software Foundation. All rights reserved.