org.apache.wicket.markup
Class Markup

java.lang.Object
  extended by org.apache.wicket.markup.Markup
All Implemented Interfaces:
java.lang.Iterable<MarkupElement>, IMarkupFragment
Direct Known Subclasses:
MergedMarkup

public class Markup
extends java.lang.Object
implements IMarkupFragment

The content of a markup file, consisting of a list of markup elements.

Author:
Juergen Donnerstag
See Also:
MarkupResourceStream, MarkupElement, ComponentTag, RawMarkup

Field Summary
static Markup NO_MARKUP
          Placeholder that indicates no markup
 
Constructor Summary
Markup(MarkupResourceStream markupResourceStream)
          Constructor
 
Method Summary
 void addMarkupElement(int pos, MarkupElement markupElement)
          Add a MarkupElement
 void addMarkupElement(MarkupElement markupElement)
          Add a MarkupElement
 IMarkupFragment find(java.lang.String id)
          Find the markup fragment of the component with 'path'
 MarkupElement 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.
 java.util.Iterator<MarkupElement> iterator()
           
 java.util.Iterator<MarkupElement> iterator(int startIndex, int size)
           
 java.lang.String locationAsString()
           
 void makeImmutable()
          Make all tags immutable and the list of elements unmodifiable.
static Markup of(java.lang.String markup)
          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.
 java.lang.String toString()
           
 java.lang.String toString(boolean markupOnly)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_MARKUP

public static final Markup NO_MARKUP
Placeholder that indicates no markup

Constructor Detail

Markup

public Markup(MarkupResourceStream markupResourceStream)
Constructor

Parameters:
markupResourceStream - The associated Markup
Method Detail

of

public static Markup of(java.lang.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 -
Returns:
Markup

get

public final MarkupElement get(int index)
Description copied from interface: IMarkupFragment
Get the MarkupElement at the index provided.

Specified by:
get in interface IMarkupFragment
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.

Specified by:
getMarkupResourceStream in interface IMarkupFragment
Returns:
The underlying markup resource stream

replace

public final void replace(int index,
                          MarkupElement elem)
Parameters:
index -
elem -

locationAsString

public java.lang.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.

Specified by:
size in interface IMarkupFragment
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(java.lang.String id)
Description copied from interface: IMarkupFragment
Find the markup fragment of the component with 'path'

Specified by:
find in interface IMarkupFragment
Parameters:
id - The component's id to search for
Returns:
-1, if not found

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public final java.lang.String toString(boolean markupOnly)
Specified by:
toString in interface IMarkupFragment
Parameters:
markupOnly - True, if only the markup shall be returned
Returns:
String

iterator

public final java.util.Iterator<MarkupElement> iterator()
Specified by:
iterator in interface java.lang.Iterable<MarkupElement>
See Also:
Iterable.iterator()

iterator

public final java.util.Iterator<MarkupElement> iterator(int startIndex,
                                                        int size)
Parameters:
startIndex -
size -
Returns:
Iterator


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.