|
||||||||||
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);
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
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 |
getAssociatedMarkupStream(boolean throwException)
Gets a fresh markup stream that contains the (immutable) markup resource for this class. |
IMarkupFragment |
getMarkup(Component child)
Get the childs markup |
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 |
---|
findMarkupInAssociatedFileHeader, renderHead, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getMarkupStream, getMarkupType, internalAdd, iterator, iterator, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, 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, 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 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()
public IMarkupFragment getMarkup(Component child)
MarkupContainer
getMarkup
in class MarkupContainer
child
- The child component. If null, the container's markup will be returned. See Border,
Panel or Enclosure where getMarkup(null) != getMarkup().
MarkupContainer.getMarkup(org.apache.wicket.Component)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |