Class 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:
  • Field Details

    • NO_MARKUP

      public static final Markup NO_MARKUP
      Placeholder that indicates no markup
  • Constructor Details

    • Markup

      public Markup(MarkupResourceStream markupResourceStream)
      Constructor
      Parameters:
      markupResourceStream - The associated Markup
  • Method Details

    • 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 markup
      wicketNamespace - 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

      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

      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 class AbstractMarkupFragment
    • 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:
    • iterator

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