|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.markup.MarkupStream
public class MarkupStream
A stream of MarkupElement
s, subclasses of which are
ComponentTag
and RawMarkup
. A
markup stream has a current index in the list of markup elements. The next markup element can be
retrieved and the index advanced by calling next(). If the index hits the end, hasMore() will
return false.
The current markup element can be accessed with get() and as a ComponentTag with getTag().
The stream can be sought to a particular location with setCurrentIndex().
Convenience methods also exist to skip component tags (and any potentially nested markup) or raw markup.
Several boolean methods of the form at*() return true if the markup stream is positioned at a tag with a given set of characteristics.
The resource from which the markup was loaded can be retrieved with getResource().
Constructor Summary | |
---|---|
MarkupStream(IMarkupFragment markup)
Constructor |
Method Summary | |
---|---|
boolean |
atCloseTag()
|
boolean |
atOpenCloseTag()
|
boolean |
atOpenCloseTag(String componentId)
|
boolean |
atOpenTag()
|
boolean |
atOpenTag(String id)
|
boolean |
atTag()
|
boolean |
equalMarkup(MarkupStream markupStream)
True, if associate markup is the same. |
boolean |
equalTo(MarkupStream that)
Compare this markup stream with another one |
MarkupElement |
get()
|
MarkupElement |
get(int index)
|
Class<? extends Component> |
getContainerClass()
Get the component/container's Class which is directly associated with the stream. |
int |
getCurrentIndex()
|
String |
getEncoding()
Gets the markup encoding. |
IMarkupFragment |
getMarkupFragment()
|
ComponentTag |
getPreviousTag()
Sometime its necessary to get the previous markup element versus the current one. |
IResourceStream |
getResource()
|
ComponentTag |
getTag()
|
String |
getTagAttribute(String name,
boolean withWicketNamespace)
Gets the attribute with 'name' for the tag at the current position |
String |
getWicketNamespace()
Get the wicket namespace valid for this specific markup |
boolean |
hasMore()
|
boolean |
isMergedMarkup()
|
MarkupElement |
next()
Note: |
MarkupElement |
nextOpenTag()
Note: |
MarkupStream |
setCurrentIndex(int currentIndex)
|
void |
skipComponent()
Skips this component and all nested components |
void |
skipRawMarkup()
Skips any raw markup at the current position |
void |
skipToMatchingCloseTag(ComponentTag openTag)
Renders markup until a closing tag for openTag is reached. |
boolean |
skipUntil(Class<? extends MarkupElement> clazz)
Skip until an element of type 'clazz' is found |
void |
skipUntil(String wicketTagName)
Skips any markup at the current position until the wicket tag name is found. |
void |
throwMarkupException(String message)
Throws a new markup exception |
String |
toHtmlDebugString()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MarkupStream(IMarkupFragment markup)
markup
- List of markup elementsMethod Detail |
---|
public boolean atCloseTag()
public boolean atOpenCloseTag()
public boolean atOpenCloseTag(String componentId)
componentId
- Required component name attribute
public boolean atOpenTag()
public boolean atOpenTag(String id)
id
- Required component id attribute
public boolean atTag()
public boolean equalTo(MarkupStream that)
that
- The other markup stream
public final boolean equalMarkup(MarkupStream markupStream)
markupStream
- The markup stream to compare with.
public MarkupElement get()
public MarkupElement get(int index)
index
- The index of a markup element
public final Class<? extends Component> getContainerClass()
public int getCurrentIndex()
public final String getEncoding()
public IResourceStream getResource()
public ComponentTag getTag()
public final String getWicketNamespace()
public boolean hasMore()
public final boolean isMergedMarkup()
public MarkupElement next()
public MarkupElement nextOpenTag()
public MarkupStream setCurrentIndex(int currentIndex)
currentIndex
- New current index in the stream
public final void skipComponent()
public void skipRawMarkup()
public boolean skipUntil(Class<? extends MarkupElement> clazz)
clazz
-
public void skipUntil(String wicketTagName)
wicketTagName
- wicket tag name to seekpublic void skipToMatchingCloseTag(ComponentTag openTag)
openTag
- The open tagpublic final IMarkupFragment getMarkupFragment()
public final String getTagAttribute(String name, boolean withWicketNamespace)
name
- withWicketNamespace
-
public final ComponentTag getPreviousTag()
public void throwMarkupException(String message)
message
- The exception message
MarkupException
public String toHtmlDebugString()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |