cox.jmatt.java.MathTools.markup.html
Class ListTag

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.Tag
      extended by cox.jmatt.java.MathTools.markup.html.BaseHTag
          extended by cox.jmatt.java.MathTools.markup.html.ListTag

public class ListTag
extends BaseHTag

This class provides the <ul> and <ol> tags. Ordered or unordered is determined by the constructor, otherwise the two are identical. The only content permitted is <li> tags (LITag class) so that is all that can be added. There is a method to add an item directly (defaults apply) and another to add a pre-constructed instance.

NOTE: Both types of list tags can contain sublists. To do this construct a separate ListTag for the sublist, add it to a <li> tag, and add that tag to this one. The addList() method here also provides that function provided the <li> holding the sublist can function with default settings.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
BaseHTag.TagKeys
 
Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Constructor Summary
ListTag(boolean isOrderedList)
          Standard constructor for an empty list tag.
 
Method Summary
 ListTag addItem(LITag pTag)
          Add a pre-constructed LITag.
 ListTag addItem(java.lang.String pItemText)
          Add an item directly to the tag and return a self-reference.
 ListTag addList(ListTag pSubList)
          Add a sub-list to the current list.
 ListTag copyOf()
          Return a copy of this tag.
static ListTag createList(boolean bIsOrdered, java.lang.Object[] pList, java.lang.String pItemID)
          Create a list, ordered or unordered, from an Object[] array.
 ListTag newList(boolean bOrdered, java.lang.Object[] pList, java.lang.String pID)
          Instance version of createList().
 ListTag setStart(int pStart)
          Set the starting number for an ordered list.
 ListTag setType(char pType)
          Set the 'type=' attribute of an ordered list.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
_addTag, _content, _enableCopy, _setContent, addCDATA, addContent, getID, getRawContent, getTagKey, getTagName, isInBody, setClicked, setCSS, setName, setStyle
 
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTag, configureTagFromGlobalPizza, makeTag, openTag, reset, setID, toString, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListTag

public ListTag(boolean isOrderedList)
Standard constructor for an empty list tag.

Parameters:
isOrderedList - true for an <ol> tag, false for <ul>.
Method Detail

createList

public static final ListTag createList(boolean bIsOrdered,
                                       java.lang.Object[] pList,
                                       java.lang.String pItemID)

Create a list, ordered or unordered, from an Object[] array. If the array sent in is null or empty the return is null. If an element is null it is skipped. The item ID prefix, if defined, is used to generate an ID for each item. The prefix is prepended to the item count number; the item number not counting any skipped items. Non-null Object entries are toString()'ed for the item value.

Parameters:
pList - The list item array.
pItemID - The item ID prefix. Ignored if null.
bIsOrdered - true for an ordered list, false for unordered.

newList

public ListTag newList(boolean bOrdered,
                       java.lang.Object[] pList,
                       java.lang.String pID)
Instance version of createList().


addItem

public ListTag addItem(java.lang.String pItemText)
Add an item directly to the tag and return a self-reference. This does create a <li> tag internally. Ignored if null or blank.


addItem

public ListTag addItem(LITag pTag)
Add a pre-constructed LITag. Ignored if null.


addList

public ListTag addList(ListTag pSubList)
Add a sub-list to the current list. It is automatically wrapped in a default <li> tag. A self-reference is returned and the list is ignored if null.


copyOf

public ListTag copyOf()
Return a copy of this tag.


setType

public ListTag setType(char pType)
Set the 'type=' attribute of an ordered list. This has no effect on an unordered list. The type parameter is set as char and equals one of the defined values: '1, A, a, I, i'. Case does matter and any value other than one of these clears the attribute.


setStart

public ListTag setStart(int pStart)
Set the starting number for an ordered list. Ignored for unordered lists and no value-clamping is performed.