wicket.markup.html.basic
Class Label
java.lang.Object
wicket.Component
wicket.markup.html.WebComponent
wicket.markup.html.basic.Label
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- WicketMessageResolver.MyLabel
public class Label
- extends WebComponent
A Label component replaces its body with the String version of its model
object returned by getModelObjectAsString().
Exactly what is displayed as the body, depends on the model. The simplest
case is a Label with a static String model, which can be constructed like
this:
add(new Label("myLabel", "the string to display"))
A Label with a dynamic model can be created like this:
add(new Label("myLabel", new PropertyModel(person, "name"));
In this case, the Label component will replace the body of the tag it is
attached to with the 'name' property of the given Person object, where Person
might look like:
public class Person
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
Fields inherited from class wicket.Component |
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary |
Label(java.lang.String id)
Constructor |
Label(java.lang.String id,
IModel model)
|
Label(java.lang.String id,
java.lang.String label)
Convenience constructor. |
Methods inherited from class wicket.Component |
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupStream, setMetaData, setModel, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, toString, toString, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Label
public Label(java.lang.String id)
- Constructor
- Parameters:
id
- See Component
Label
public Label(java.lang.String id,
java.lang.String label)
- Convenience constructor. Same as Label(String, new Model(String))
- Parameters:
id
- See Componentlabel
- The label text- See Also:
Component.Component(String, IModel)
Label
public Label(java.lang.String id,
IModel model)
- See Also:
Component.Component(String, IModel)
onComponentTagBody
protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
- Description copied from class:
Component
- Processes the body.
- Overrides:
onComponentTagBody
in class Component
- Parameters:
markupStream
- The markup streamopenTag
- The open tag for the body- See Also:
Component.onComponentTagBody(wicket.markup.MarkupStream,
wicket.markup.ComponentTag)
Copyright © 2004-2007 Wicket developers. All Rights Reserved.