wicket.markup.html.form
Class AbstractChoice

java.lang.Object
  extended bywicket.Component
      extended bywicket.MarkupContainer
          extended bywicket.markup.html.WebMarkupContainer
              extended bywicket.markup.html.form.FormComponent
                  extended bywicket.markup.html.form.AbstractChoice
All Implemented Interfaces:
IAjaxListener, IHeaderContributor, IRequestListener, java.io.Serializable
Direct Known Subclasses:
AbstractSingleSelectChoice, ListMultipleChoice

abstract class AbstractChoice
extends FormComponent

Abstract base class for all choice (html select) options.

Author:
Jonathan Locke, Eelco Hillenius, Johan Compagner

Nested Class Summary
 
Nested classes inherited from class wicket.markup.html.form.FormComponent
FormComponent.IVisitor
 
Nested classes inherited from class wicket.Component
Component.ComponentModelChange, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.markup.html.form.FormComponent
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, NO_INVALID_INPUT
 
Fields inherited from class wicket.Component
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4
 
Constructor Summary
AbstractChoice(java.lang.String id)
          Constructor.
AbstractChoice(java.lang.String id, IModel choices)
          Constructor.
AbstractChoice(java.lang.String id, IModel choices, IChoiceRenderer renderer)
          Constructor.
AbstractChoice(java.lang.String id, IModel model, IModel choices)
          Constructor.
AbstractChoice(java.lang.String id, IModel model, IModel choices, IChoiceRenderer renderer)
          Constructor.
AbstractChoice(java.lang.String id, IModel model, java.util.List choices)
          Constructor.
AbstractChoice(java.lang.String id, IModel model, java.util.List choices, IChoiceRenderer renderer)
          Constructor.
AbstractChoice(java.lang.String id, java.util.List choices)
          Constructor.
AbstractChoice(java.lang.String id, java.util.List choices, IChoiceRenderer renderer)
          Constructor.
 
Method Summary
protected  void appendOptionHtml(java.lang.StringBuffer buffer, java.lang.Object choice, int index)
          Generats and appends html for a single choice into the provided buffer
protected  void detachModel()
          Detaches the model for this component if it is detachable.
 IChoiceRenderer getChoiceRenderer()
           
 java.util.List getChoices()
           
protected  java.lang.String getDefaultChoice(java.lang.Object selected)
           
protected abstract  boolean isSelected(java.lang.Object object, int index)
          Gets whether the given value represents the current selection.
protected  void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
          Handle the container's body.
 void setChoiceRenderer(IChoiceRenderer renderer)
          Set the choice renderer to be used.
 void setChoices(java.util.List choices)
          Sets the list of choices.
protected  boolean supportsPersistence()
           
abstract  void updateModel()
          Updates the model of this component from the request.
 
Methods inherited from class wicket.markup.html.form.FormComponent
add, getForm, getInput, getInputName, getLabel, getModelValue, getValidationType, getValidators, getValue, inputAsInt, inputAsInt, inputAsIntArray, inputAsStringArray, invalid, isMultiPart, isPersistent, isValid, isValidated, onComponentTag, onInvalid, onModelChanged, onValid, setLabel, setModelValue, setPersistent, valid, validate
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, onRender, renderHead
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, iterator, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, add, addStateChange, checkComponentTag, checkComponentTagAttribute, debug, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxHandlers, getApplication, getApplicationPages, getApplicationSettings, getClassRelativePath, getComparator, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getId, getLocale, getLocalizer, getModel, getModelObject, getModelObjectAsString, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResource, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnBeginRequest, internalOnEndRequest, internalOnModelChanged, internalOnModelChanging, isAncestorOf, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onBeginRequest, onEndRequest, onModelChanging, onRequest, onSessionAttach, redirectTo, remove, render, renderComponent, renderComponentTag, rendered, replaceComponentTagBody, sameRootModel, sameRootModel, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setModelObject, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractChoice

public AbstractChoice(java.lang.String id)
Constructor.

Parameters:
id - See Component
See Also:
Component.Component(String)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      java.util.List choices)
Constructor.

Parameters:
id - See Component
choices - The collection of choices in the dropdown
See Also:
Component.Component(String)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      java.util.List choices,
                      IChoiceRenderer renderer)
Constructor.

Parameters:
id - See Component
renderer - The rendering engine
choices - The collection of choices in the dropdown
See Also:
Component.Component(String)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel model,
                      java.util.List choices)
Constructor.

Parameters:
id - See Component
model - See Component
choices - The collection of choices in the dropdown
See Also:
Component.Component(String, IModel)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel model,
                      java.util.List choices,
                      IChoiceRenderer renderer)
Constructor.

Parameters:
id - See Component
model - See Component
choices - The drop down choices
renderer - The rendering engine
See Also:
Component.Component(String, IModel)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel choices)
Constructor.

Parameters:
id - See Component
choices - The collection of choices in the dropdown
See Also:
Component.Component(String)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel choices,
                      IChoiceRenderer renderer)
Constructor.

Parameters:
id - See Component
renderer - The rendering engine
choices - The collection of choices in the dropdown
See Also:
Component.Component(String)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel model,
                      IModel choices)
Constructor.

Parameters:
id - See Component
model - See Component
choices - The collection of choices in the dropdown
See Also:
Component.Component(String, IModel)

AbstractChoice

public AbstractChoice(java.lang.String id,
                      IModel model,
                      IModel choices,
                      IChoiceRenderer renderer)
Constructor.

Parameters:
id - See Component
model - See Component
renderer - The rendering engine
choices - The drop down choices
See Also:
Component.Component(String, IModel)
Method Detail

getChoices

public java.util.List getChoices()
Returns:
The collection of object that this choice has

setChoices

public final void setChoices(java.util.List choices)
Sets the list of choices.

Parameters:
choices - the list of choices

getChoiceRenderer

public final IChoiceRenderer getChoiceRenderer()
Returns:
The IChoiceRenderer used for rendering the data objects

setChoiceRenderer

public final void setChoiceRenderer(IChoiceRenderer renderer)
Set the choice renderer to be used.

Parameters:
renderer -

detachModel

protected void detachModel()
Description copied from class: Component
Detaches the model for this component if it is detachable.

Overrides:
detachModel in class Component
See Also:
Component.detachModel()

getDefaultChoice

protected java.lang.String getDefaultChoice(java.lang.Object selected)
Parameters:
selected - The object that's currently selected
Returns:
Any default choice, such as "Choose One", depending on the subclass

isSelected

protected abstract boolean isSelected(java.lang.Object object,
                                      int index)
Gets whether the given value represents the current selection.

Parameters:
object - The object to check
index - The index in the choices collection this object is in.
Returns:
Whether the given value represents the current selection

onComponentTagBody

protected void onComponentTagBody(MarkupStream markupStream,
                                  ComponentTag openTag)
Handle the container's body.

Overrides:
onComponentTagBody in class MarkupContainer
Parameters:
markupStream - The markup stream
openTag - The open tag for the body
See Also:
Component.onComponentTagBody(MarkupStream, ComponentTag)

appendOptionHtml

protected void appendOptionHtml(java.lang.StringBuffer buffer,
                                java.lang.Object choice,
                                int index)
Generats and appends html for a single choice into the provided buffer

Parameters:
buffer - string buffer that will have the generated html appended
choice - choice object
index -

supportsPersistence

protected boolean supportsPersistence()
Overrides:
supportsPersistence in class FormComponent
Returns:
True if this type of FormComponent can be persisted.
See Also:
FormComponent.supportsPersistence()

updateModel

public abstract void updateModel()
Updates the model of this component from the request.

Specified by:
updateModel in class FormComponent
See Also:
FormComponent.updateModel()


Copyright © 2004-2006 Wicket developers. All Rights Reserved.