org.apache.wicket.markup
Class MarkupFragment

java.lang.Object
  extended by org.apache.wicket.markup.MarkupFragment
All Implemented Interfaces:
java.lang.Iterable<MarkupElement>, IMarkupFragment

public class MarkupFragment
extends java.lang.Object
implements IMarkupFragment

Represents a portion of a markup file, but always spans a complete tag. E.g.

 open-body-close: <span>body</span>
 open-close:      <span/>
 open-no-close:   <input ...>body
 

Author:
Juergen Donnerstag
See Also:
Markup, MarkupElement

Constructor Summary
MarkupFragment(IMarkupFragment markup, int startIndex)
          Construct.
 
Method Summary
 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.
 Markup getRootMarkup()
           
 java.util.Iterator<MarkupElement> iterator()
           
 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
 

Constructor Detail

MarkupFragment

public MarkupFragment(IMarkupFragment markup,
                      int startIndex)
Construct.

Parameters:
markup - The parent markup. May not be null.
startIndex - The start index of the child markup
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
Method Detail

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

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

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

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

getRootMarkup

public final Markup getRootMarkup()
Returns:
The Markup representing the underlying markup file with all its content

toString

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

toString

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

iterator

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


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