T - the generic typepublic class RadioChoicesListView<T> extends ChoicesListView<T>
IChoiceRenderer. When used in combination with a
RadioGroup, this a good alternative to Wicket's
built-in RadioChoice, because it gives you full
control over the markup and is extensible.
Your markup have to contain the following:
<input type="radio" wicket:id="radio" /> where you want the radio button to appear.
wicket:id="label" where you want the display value to appear.For example:
<wicket:container wicket:id="group">
<label wicket:id="choices">
<input type="radio" wicket:id="radio" />
<wicket:container wicket:id="label">Label</wicket:container>
</label>
</wicket:container>
add(new RadioGroup("group", selectedItemModel)
.add(new RadioChoicesListView("choices", choicesModel, renderer)));
You can also override populateItem() if you want to display
additional data per radio choice, like a description paragraph.
This class is inspired from fiftyfive.wicket.core project. Some changes with the generic types
was done. For more information read this blog:
http://
blog.55minutes.com/2011/10/how-to-implement-radio-buttons-in-wicket/
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 |
|---|
RadioChoicesListView(String id,
org.apache.wicket.model.IModel<List<T>> choices,
org.apache.wicket.markup.html.form.IChoiceRenderer<T> renderer)
Construct a list view for
Radio objects that will expose the specified
IChoiceRenderer for rendering its list items. |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.wicket.markup.html.basic.Label |
newLabel(String id,
String label)
Factory method for creating the new
Label. |
protected org.apache.wicket.markup.html.form.Radio<T> |
newRadio(String id,
org.apache.wicket.model.IModel<T> model,
int index)
Factory method for create a new
Radio. |
protected void |
populateItem(org.apache.wicket.markup.html.list.ListItem<T> item) |
getChoiceLabel, getChoiceRenderer, getChoiceValuegetList, getListItemModel, getModel, getModelObject, getReuseItems, getStartIndex, getViewSize, moveDownLink, moveUpLink, newItem, onBeginPopulateItem, onPopulate, removeLink, renderChild, renderItem, renderIterator, setList, setModel, setModelObject, setReuseItems, setStartIndex, setViewSizedequeue, getMarkup, onBeforeRender, onRendergetWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionadd, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeuePreamble, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onComponentTagBody, onDetach, onInitialize, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildrenadd, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, 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, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onComponentTag, onConfigure, onEvent, 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, wrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic RadioChoicesListView(String id, org.apache.wicket.model.IModel<List<T>> choices, org.apache.wicket.markup.html.form.IChoiceRenderer<T> renderer)
Radio objects that will expose the specified
IChoiceRenderer for rendering its list items.id - the idchoices - the list of choicesrenderer - the choice rendererprotected org.apache.wicket.markup.html.basic.Label newLabel(String id, String label)
Label. This method is invoked in the constructor
from the derived classes and can be overridden so users can provide their own version of a
new Label.id - the idlabel - the string for the labelLabelprotected org.apache.wicket.markup.html.form.Radio<T> newRadio(String id, org.apache.wicket.model.IModel<T> model, int index)
Radio. This method is invoked in the constructor from
the derived classes and can be overridden so users can provide their own version of a new
Radio.id - the idmodel - the modelindex - the indexRadio.Copyright © 2010–2016 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.