Package org.apache.wicket.markup
Class Markup
- java.lang.Object
-
- org.apache.wicket.markup.AbstractMarkupFragment
-
- org.apache.wicket.markup.Markup
-
- All Implemented Interfaces:
Iterable<MarkupElement>
,IMarkupFragment
- Direct Known Subclasses:
MergedMarkup
public class Markup extends AbstractMarkupFragment
The content of a markup file, consisting of a list of markup elements.- Author:
- Juergen Donnerstag
- See Also:
MarkupResourceStream
,MarkupElement
,ComponentTag
,RawMarkup
-
-
Constructor Summary
Constructors Constructor Description Markup(MarkupResourceStream markupResourceStream)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMarkupElement(int pos, MarkupElement markupElement)
Add a MarkupElementvoid
addMarkupElement(MarkupElement markupElement)
Add a MarkupElementIMarkupFragment
find(String id)
Finds a markup fragment that spans a tagMarkupElement
get(int index)
Get the MarkupElement at the index provided.MarkupResourceStream
getMarkupResourceStream()
Get the underlying markup resource stream, which might contain more than just the markup portion represented by the IMarkupFragment.Iterator<MarkupElement>
iterator()
Iterator<MarkupElement>
iterator(int startIndex, int size)
String
locationAsString()
void
makeImmutable()
Make all tags immutable and the list of elements unmodifiable.static Markup
of(String markup)
Take the markup string, parse it and return the Markup (list of MarkupElements).static Markup
of(String markup, String wicketNamespace)
Take the markup string, parse it and return the Markup (list of MarkupElements).void
replace(int index, MarkupElement elem)
int
size()
The number of markup elements.String
toString()
String
toString(boolean markupOnly)
-
Methods inherited from class org.apache.wicket.markup.AbstractMarkupFragment
find
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Markup
public Markup(MarkupResourceStream markupResourceStream)
Constructor- Parameters:
markupResourceStream
- The associated Markup
-
-
Method Detail
-
of
public static Markup of(String markup)
Take the markup string, parse it and return the Markup (list of MarkupElements).Limitation: Please note that MarkupFactory is NOT used and thus no caching is used (which doesn't matter for Strings anyway), but what might matter is that your own MarkupFilters are not applied, which you might have registered with MarkupFactory.
- Parameters:
markup
- the string to use as markup- Returns:
- Markup The parsed markup
-
of
public static Markup of(String markup, String wicketNamespace)
Take the markup string, parse it and return the Markup (list of MarkupElements).Limitation: Please note that MarkupFactory is NOT used and thus no caching is used (which doesn't matter for Strings anyway), but what might matter is that your own MarkupFilters are not applied, which you might have registered with MarkupFactory.
- Parameters:
markup
- the string to use as markupwicketNamespace
- the namespace for Wicket elements and attributes- Returns:
- Markup The parsed markup
-
get
public final MarkupElement get(int index)
Description copied from interface:IMarkupFragment
Get the MarkupElement at the index provided.- Parameters:
index
- Index into markup list- Returns:
- Markup element
-
getMarkupResourceStream
public final MarkupResourceStream getMarkupResourceStream()
Description copied from interface:IMarkupFragment
Get the underlying markup resource stream, which might contain more than just the markup portion represented by the IMarkupFragment.- Returns:
- The underlying markup resource stream
-
replace
public final void replace(int index, MarkupElement elem)
- Parameters:
index
-elem
-
-
locationAsString
public String locationAsString()
- Returns:
- The fixed location as a string, e.g. the file name or the URL. Return null to avoid caching the markup.
-
size
public final int size()
Description copied from interface:IMarkupFragment
The number of markup elements.- Returns:
- Number of markup elements
-
addMarkupElement
public final void addMarkupElement(MarkupElement markupElement)
Add a MarkupElement- Parameters:
markupElement
-
-
addMarkupElement
public final void addMarkupElement(int pos, MarkupElement markupElement)
Add a MarkupElement- Parameters:
pos
-markupElement
-
-
makeImmutable
public final void makeImmutable()
Make all tags immutable and the list of elements unmodifiable.
-
find
public final IMarkupFragment find(String id)
Description copied from interface:IMarkupFragment
Finds a markup fragment that spans a tag- Parameters:
id
- the wicket:id attribute in the tag- Returns:
- the markup fragment that spans the complete found tag
-
toString
public final String toString()
- Overrides:
toString
in classAbstractMarkupFragment
-
toString
public final String toString(boolean markupOnly)
- Parameters:
markupOnly
- True, if only the markup shall be returned- Returns:
- String
-
iterator
public final Iterator<MarkupElement> iterator()
- See Also:
Iterable.iterator()
-
iterator
public final Iterator<MarkupElement> iterator(int startIndex, int size)
- Parameters:
startIndex
-size
-- Returns:
- Iterator
-
-