|
||||||||||
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 final 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(Markup 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 |
int |
findComponentIndex(String path,
String id)
Find the markup element index of the component with 'path' |
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. |
IResourceStream |
getResource()
|
ComponentTag |
getTag()
|
String |
getWicketNamespace()
Get the wicket namespace valid for this specific markup |
String |
getXmlDeclaration()
Return the XML declaration string, in case if found in the markup. |
boolean |
hasMore()
|
boolean |
isMergedMarkup()
|
MarkupElement |
next()
The correct way of using MarkupStream is like: |
void |
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. |
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(Markup 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 final int findComponentIndex(String path, String id)
path
- The component path expressionid
- The component's id to search for
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 String getXmlDeclaration()
public boolean hasMore()
public final boolean isMergedMarkup()
public MarkupElement next()
while (markupStream.hasMore()) { final MarkupElement cursor = markupStream.get(); ... markupStream.next(); }
public void setCurrentIndex(int currentIndex)
currentIndex
- New current index in the streampublic final void skipComponent()
public void skipRawMarkup()
public void skipUntil(String wicketTagName)
wicketTagName
- wicket tag name to seekpublic void skipToMatchingCloseTag(ComponentTag openTag)
openTag
- The open tagpublic 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 |