|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
org.apache.wicket.markup.html.panel.Fragment
public class Fragment
Usually you either have a markup file or a xml tag with wicket:id="myComponent" to associate markup with a component. However in some rare cases, especially when working with small panels it is a bit awkward to maintain tiny pieces of markup in plenty of panel markup files. Use cases are for example list views where list items are different depending on a state.
Fragments provide a means to maintain the panels tiny piece of markup. Since it can be anywhere, the component whose markup contains the fragment's markup must be provided (markup provider).
<span wicket:id="myPanel">Example input (will be removed)</span> <wicket:fragment wicket:id="frag1">panel 1</wicket:fragment> <wicket:fragment wicket:id="frag2">panel 2</wicket:fragment>
add(new Fragment("myPanel1", "frag1", myPage);
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Fragment(java.lang.String id,
java.lang.String markupId)
Deprecated. use Fragment(String, String, MarkupContainer) |
|
Fragment(java.lang.String id,
java.lang.String markupId,
IModel model)
Deprecated. use Fragment(String, String, MarkupContainer, IModel) |
|
Fragment(java.lang.String id,
java.lang.String markupId,
MarkupContainer markupProvider)
Constructor. |
|
Fragment(java.lang.String id,
java.lang.String markupId,
MarkupContainer markupProvider,
IModel model)
Constructor. |
Method Summary | |
---|---|
protected MarkupStream |
chooseMarkupStream(MarkupStream markupStream)
Get the markup stream which shall be used to search for the fragment |
MarkupStream |
findComponentIndex(java.lang.String path)
Position the markup stream at the child component relative to the provider markup |
MarkupStream |
getAssociatedMarkupStream(boolean throwException)
Gets a fresh markup stream that contains the (immutable) markup resource for this class. |
MarkupContainer |
getMarkupProvider()
Returns markup provider associated with this fragment |
boolean |
hasAssociatedMarkup()
|
protected void |
onComponentTag(ComponentTag tag)
Make sure we open up open-close tags to open-body-close |
protected void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body. |
void |
setMarkupTagReferenceId(java.lang.String markupId)
The associated markup fragment can be modified |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, getMarkupStream, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Fragment(java.lang.String id, java.lang.String markupId)
Fragment(String, String, MarkupContainer)
id
- The component idmarkupId
- The associated id of the associated markup fragmentComponent.Component(String)
public Fragment(java.lang.String id, java.lang.String markupId, IModel model)
Fragment(String, String, MarkupContainer, IModel)
id
- The component idmarkupId
- The associated id of the associated markup fragmentmodel
- The model for this fragmentComponent.Component(String)
public Fragment(java.lang.String id, java.lang.String markupId, MarkupContainer markupProvider)
id
- The component idmarkupId
- The associated id of the associated markup fragmentmarkupProvider
- The component whose markup contains the fragment's markupComponent.Component(String)
public Fragment(java.lang.String id, java.lang.String markupId, MarkupContainer markupProvider, IModel model)
id
- The component idmarkupId
- The associated id of the associated markup fragmentmarkupProvider
- The component whose markup contains the fragment's markupmodel
- The model for this fragmentComponent.Component(String)
Method Detail |
---|
public final void setMarkupTagReferenceId(java.lang.String markupId)
markupId
- protected void onComponentTag(ComponentTag tag)
onComponentTag
in class Component
tag
- Tag to modifyComponent.onComponentTag(org.apache.wicket.markup.ComponentTag)
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
MarkupContainer
onComponentTagBody
in class MarkupContainer
markupStream
- The markup streamopenTag
- The open tag for the bodyComponent.onComponentTagBody(org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
protected MarkupStream chooseMarkupStream(MarkupStream markupStream)
markupStream
- The markup stream is associated with the component (not the fragment)
public MarkupStream findComponentIndex(java.lang.String path)
path
-
public boolean hasAssociatedMarkup()
hasAssociatedMarkup
in class MarkupContainer
MarkupContainer.hasAssociatedMarkup()
public MarkupStream getAssociatedMarkupStream(boolean throwException)
MarkupContainer
getAssociatedMarkupStream
in class MarkupContainer
throwException
- If true, throw an exception, if markup could not be found
MarkupContainer.getAssociatedMarkupStream(boolean)
public final MarkupContainer getMarkupProvider()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |