Module org.apache.wicket.core
Class EnumLabel<T extends Enum<T>>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.markup.html.WebComponent
-
- org.apache.wicket.markup.html.basic.EnumLabel<T>
-
- Type Parameters:
T
- enum type
- All Implemented Interfaces:
Serializable
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IGenericComponent<T,EnumLabel<T>>
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IRequestableComponent
,org.apache.wicket.util.IHierarchical<Component>
,org.apache.wicket.util.io.IClusterable
public class EnumLabel<T extends Enum<T>> extends WebComponent implements IGenericComponent<T,EnumLabel<T>>
A Label component that is used to render an enum value. The value rendered will be the result of a i18n resource lookup of the following form:<value.getClass().getSimpleName()>.<value.name()>
, this format can be changed by overridingresourceKey(Enum)
- Author:
- igor.vaynberg
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
nullValue()
protected void
onComponentTag(ComponentTag tag)
Processes the component tag.void
onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
Processes the body.protected String
resourceKey(T value)
Converts enum value into a resource key that should be used to lookup the text the label will display-
Methods inherited from class org.apache.wicket.markup.html.WebComponent
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession, onRender
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, get, 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, getMarkupTag, 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, internalInitialize, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModel, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, toString, toString, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
-
-
-
-
Constructor Detail
-
EnumLabel
public EnumLabel(String id)
Constructor- Parameters:
id
- See Component
-
EnumLabel
public EnumLabel(String id, T value)
Convenience constructor. Same as Label(String, new Model<String>(String))- Parameters:
id
- See Componentvalue
- Enum value to render- See Also:
Component(String, IModel)
-
EnumLabel
public EnumLabel(String id, IModel<T> model)
- Parameters:
id
-model
-- See Also:
Component(String, IModel)
-
-
Method Detail
-
onComponentTagBody
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
Description copied from class:Component
Processes the body.- Overrides:
onComponentTagBody
in classComponent
- Parameters:
markupStream
- The markup streamopenTag
- The open tag for the body
-
resourceKey
protected String resourceKey(T value)
Converts enum value into a resource key that should be used to lookup the text the label will display- Parameters:
value
-- Returns:
- resource key
-
nullValue
protected String nullValue()
- Returns:
- value that should be displayed if model object is
null
-
onComponentTag
protected void onComponentTag(ComponentTag tag)
Description copied from class:Component
Processes the component tag. Overrides of this method most likely should call the super implementation.- Overrides:
onComponentTag
in classComponent
- Parameters:
tag
- Tag to modify
-
-