|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.markup.html.WebComponent org.apache.wicket.markup.html.basic.Label
public class Label
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; } }
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Label(String id)
Constructor |
|
Label(String id,
IModel<?> model)
|
|
Label(String id,
String label)
Convenience constructor. |
Method Summary | |
---|---|
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body. |
Methods inherited from class org.apache.wicket.markup.html.WebComponent |
---|
onRender |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Label(String id)
id
- See Componentpublic Label(String id, String label)
id
- See Componentlabel
- The label textComponent.Component(String, IModel)
public Label(String id, IModel<?> model)
id
- model
- Component.Component(String, IModel)
Method Detail |
---|
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody
in class Component
markupStream
- The markup streamopenTag
- The open tag for the bodyprotected void onComponentTag(ComponentTag tag)
onComponentTag
in class Component
tag
- Tag to modify
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |