| java.lang.Object org.jamwiki.parser.TableOfContents
TableOfContents | public class TableOfContents (Code) | | This class is used to generate a table of contents based on values passed in
through the parser.
|
Inner Class :class TableOfContentsEntry | |
Field Summary | |
final public static int | STATUS_NO_TOC Status indicating that the document being parsed does not allow a table of contents. | final public static int | STATUS_TOC_INITIALIZED Status indicating that this TOC object has been initialized. | final public static int | STATUS_TOC_UNINITIALIZED Status indicating that this TOC object has not yet been initialized. |
Method Summary | |
public void | addEntry(String name, String text, int level) Add a new table of contents entry to the table of contents object.
The entry should contain the name to use in the HTML anchor tag,
the text to display in the table of contents, and the indentation
level for the entry within the table of contents.
Parameters: name - The name of the entry, to be used in the anchor tag name. Parameters: text - The text to display for the table of contents entry. Parameters: level - The level of the entry. | public String | attemptTOCInsertion() This method checks to see if a TOC is allowed to be inserted, and if so
returns an HTML representation of the TOC. | public String | checkForUniqueName(String name) Verify the the TOC name is unique. | public int | getStatus() Return the current table of contents status, such as "no table of contents
allowed" or "uninitialized". | public void | setForceTOC(boolean forceTOC) Force a TOC to appear, even if there are fewer than four headings. | public void | setStatus(int status) Set the current table of contents status, such as "no table of contents
allowed" or "uninitialized". | public int | size() Return the number of entries in this TOC object. | public String | toHTML() Return an HTML representation of this table of contents object. |
STATUS_NO_TOC | final public static int STATUS_NO_TOC(Code) | | Status indicating that the document being parsed does not allow a table of contents.
|
STATUS_TOC_INITIALIZED | final public static int STATUS_TOC_INITIALIZED(Code) | | Status indicating that this TOC object has been initialized. For the JFlex parser this will mean a __TOC__ tag has been added to the document being parsed.
|
STATUS_TOC_UNINITIALIZED | final public static int STATUS_TOC_UNINITIALIZED(Code) | | Status indicating that this TOC object has not yet been initialized. For the JFlex parser this will mean no __TOC__ tag has been added to the document being parsed.
|
addEntry | public void addEntry(String name, String text, int level)(Code) | | Add a new table of contents entry to the table of contents object.
The entry should contain the name to use in the HTML anchor tag,
the text to display in the table of contents, and the indentation
level for the entry within the table of contents.
Parameters: name - The name of the entry, to be used in the anchor tag name. Parameters: text - The text to display for the table of contents entry. Parameters: level - The level of the entry. If an entry is a sub-heading ofanother entry the value should be 2. If there is a sub-heading of thatentry then its value would be 3, and so forth. |
attemptTOCInsertion | public String attemptTOCInsertion()(Code) | | This method checks to see if a TOC is allowed to be inserted, and if so
returns an HTML representation of the TOC.
An HTML representation of the current table of contents object,or an empty string if the table of contents can not be inserted dueto an inadequate number of entries or some other reason. |
checkForUniqueName | public String checkForUniqueName(String name)(Code) | | Verify the the TOC name is unique. If it is already in use append
a numerical suffix onto it.
Parameters: name - The name to use in the TOC, unless it is already in use. A unique name for use in the TOC, of the form "name" or "name_1"if "name" is already in use. |
getStatus | public int getStatus()(Code) | | Return the current table of contents status, such as "no table of contents
allowed" or "uninitialized".
The current status of this table of contents object. |
setForceTOC | public void setForceTOC(boolean forceTOC)(Code) | | Force a TOC to appear, even if there are fewer than four headings.
Parameters: forceTOC - Set to true if a TOC is being forcedto appear, false otherwise. |
setStatus | public void setStatus(int status)(Code) | | Set the current table of contents status, such as "no table of contents
allowed" or "uninitialized".
Parameters: status - The current status of this table of contents object. |
size | public int size()(Code) | | Return the number of entries in this TOC object.
The number of entries in this table of contents object. |
toHTML | public String toHTML()(Code) | | Return an HTML representation of this table of contents object.
An HTML representation of this table of contents object. |
|
|