|
||||||||||
| 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.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 use 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_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
| Constructor Summary | |
|---|---|
Fragment(String id,
String markupId,
MarkupContainer markupProvider)
Constructor. |
|
Fragment(String id,
String markupId,
MarkupContainer markupProvider,
IModel<?> model)
Constructor. |
|
| Method Summary | |
|---|---|
protected IMarkupFragment |
chooseMarkup(MarkupContainer provider)
Get the markup stream which shall be used to search for the fragment |
String |
getAssociatedMarkupId()
|
protected IMarkupSourcingStrategy |
newMarkupSourcingStrategy()
If Component.getMarkupSourcingStrategy() returns null, this method will be called. |
| 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, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Fragment(String id,
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(String id,
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 |
|---|
protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
Component.getMarkupSourcingStrategy() returns null, this method will be called. By default
it returns null, which means that a default markup strategy will be attached to the
component.
Please note that markup source strategies are not persisted. Instead they get re-created by calling this method again. That's ok since markup sourcing strategies usually do not maintain a state.
newMarkupSourcingStrategy in class Componentprotected IMarkupFragment chooseMarkup(MarkupContainer provider)
provider -
public final String getAssociatedMarkupId()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||