dsto.dfc.swing.text
Class TermCustomizer.Document

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.DefaultStyledDocument
          extended by javax.swing.text.html.HTMLDocument
              extended by dsto.dfc.swing.text.TermCustomizer.Document
All Implemented Interfaces:
Serializable, Document, StyledDocument
Enclosing class:
TermCustomizer

protected class TermCustomizer.Document
extends HTMLDocument

The document used for the text display. Provides a series of methods for building the document from the term list.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.html.HTMLDocument
HTMLDocument.BlockElement, HTMLDocument.HTMLReader, HTMLDocument.Iterator, HTMLDocument.RunElement
 
Nested classes/interfaces inherited from class javax.swing.text.DefaultStyledDocument
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement
 
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
protected  DefaultStyledDocument.ElementSpec content
           
protected  SimpleAttributeSet contentAttrs
           
protected  DefaultStyledDocument.ElementSpec endPara
           
protected  SimpleAttributeSet indentParaAttrs
           
protected  SimpleAttributeSet paraAttrs
           
protected  DefaultStyledDocument.ElementSpec startPara
           
 
Fields inherited from class javax.swing.text.html.HTMLDocument
AdditionalComments
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
TermCustomizer.Document()
           
 
Method Summary
 void addButton(ArrayList currentBuffer, String imageUrl, String text, String link)
          Add a button.
protected  void addContent(ArrayList currentBuffer, String text)
           
 void addDeleteTermButton(ArrayList currentBuffer, int index)
          Add a 'delete term' button to a buffer.
 void addLink(String text, String link)
           
 void addNewTermButton(ArrayList currentBuffer, int index)
          Add an 'new term' button to a buffer.
 void addTerm(ArrayList currentBuffer, Term term, int index, int level)
          Insert the ElementSpec's for a term into a buffer.
 void addText(String text)
           
 void addText(String text, AttributeSet attrs)
           
protected  MutableAttributeSet createButtonAttrs(Color color, String link)
           
protected  MutableAttributeSet createLinkAttrs(String link)
           
 void insert(List myBuffer)
          Insert a list of ElementSpec's from a list into the document.
 void newIndentedParagraph(ArrayList currentBuffer, int indent)
          Insert a new indented para ElementSpec into a buffer.
 void newParagraph()
          Insert a new para ElementSpec into a buffer.
protected  void parseFormat(ArrayList currentBuffer, String format, int termRow)
          Parse the customizer format for a Condtion, generating a stream of ElementSpec's to a buffer.
 
Methods inherited from class javax.swing.text.html.HTMLDocument
create, createBranchElement, createDefaultRoot, createLeafElement, fireChangedUpdate, fireUndoableEditUpdate, getBase, getElement, getElement, getIterator, getParser, getPreservesUnknownTags, getReader, getReader, getStyleSheet, getTokenThreshold, insert, insertAfterEnd, insertAfterStart, insertBeforeEnd, insertBeforeStart, insertUpdate, processHTMLFrameHyperlinkEvent, setBase, setInnerHTML, setOuterHTML, setParagraphAttributes, setParser, setPreservesUnknownTags, setTokenThreshold
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, styleChanged
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createPosition, dump, fireInsertUpdate, fireRemoveUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, insertString, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeUndoableEditListener, render
 

Field Detail

paraAttrs

protected SimpleAttributeSet paraAttrs

indentParaAttrs

protected SimpleAttributeSet indentParaAttrs

contentAttrs

protected SimpleAttributeSet contentAttrs

startPara

protected DefaultStyledDocument.ElementSpec startPara

content

protected DefaultStyledDocument.ElementSpec content

endPara

protected DefaultStyledDocument.ElementSpec endPara
Constructor Detail

TermCustomizer.Document

public TermCustomizer.Document()
Method Detail

insert

public void insert(List myBuffer)
            throws BadLocationException
Insert a list of ElementSpec's from a list into the document.

Throws:
BadLocationException

newIndentedParagraph

public void newIndentedParagraph(ArrayList currentBuffer,
                                 int indent)
Insert a new indented para ElementSpec into a buffer.


newParagraph

public void newParagraph()
                  throws BadLocationException
Insert a new para ElementSpec into a buffer.

Throws:
BadLocationException

addText

public void addText(String text)
             throws BadLocationException
Throws:
BadLocationException

addText

public void addText(String text,
                    AttributeSet attrs)
             throws BadLocationException
Throws:
BadLocationException

addLink

public void addLink(String text,
                    String link)
             throws BadLocationException
Throws:
BadLocationException

addTerm

public void addTerm(ArrayList currentBuffer,
                    Term term,
                    int index,
                    int level)
             throws BadLocationException
Insert the ElementSpec's for a term into a buffer.

Parameters:
currentBuffer - The buffer to add to.
term - The term to add.
index - The index of the term.
level - The level of indent for the term.
Throws:
BadLocationException

addNewTermButton

public void addNewTermButton(ArrayList currentBuffer,
                             int index)
                      throws BadLocationException
Add an 'new term' button to a buffer.

Throws:
BadLocationException

addDeleteTermButton

public void addDeleteTermButton(ArrayList currentBuffer,
                                int index)
                         throws BadLocationException
Add a 'delete term' button to a buffer.

Throws:
BadLocationException

addButton

public void addButton(ArrayList currentBuffer,
                      String imageUrl,
                      String text,
                      String link)
               throws BadLocationException
Add a button.

Parameters:
currentBuffer - Buffer to add element specs to.
imageUrl - An image URL.
text - The text content for the image.
link - The link to attach to the image.
Throws:
BadLocationException

addContent

protected void addContent(ArrayList currentBuffer,
                          String text)

createLinkAttrs

protected MutableAttributeSet createLinkAttrs(String link)

createButtonAttrs

protected MutableAttributeSet createButtonAttrs(Color color,
                                                String link)

parseFormat

protected void parseFormat(ArrayList currentBuffer,
                           String format,
                           int termRow)
Parse the customizer format for a Condtion, generating a stream of ElementSpec's to a buffer.

Parameters:
currentBuffer - The buffer to add to.
format - The customizer format (see Term.getCustomizerFormat()).


Copyright © 2008 Commonwealth of Australia