All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class xm.xm_DocumentModel

java.lang.Object
   |
   +----com.sun.java.swing.text.AbstractDocument
           |
           +----com.sun.java.swing.text.DefaultStyledDocument
                   |
                   +----xm.xm_DocumentModel

public class xm_DocumentModel
extends DefaultStyledDocument
implements xm_ParseListener
A model for working with an XML document, capable of supporting multiple simultaneous views of a single document (source editor, tree, etc.). Note that while this class is a 'document' in the Swing sense (inheriting from DefaultStyledDocument), it is *not* a document in the xg_Document sense (indeed, it *contains* one of those). Thus, to avoid getting confused over which of these two different types of document this is, it has been called something other than a 'document'. Also, calling this a *model* makes clear its intended place in an MVC design.


Constructor Index

 o xm_DocumentModel(xm_XmlEngine)
Constructor.

Method Index

 o clear()
Clear this document, ready to start afresh.
 o endNode(xg_Node, int)
The end of a node has been parsed.
 o endParseSuccessful()
The parse has completed successfully.
 o endParseUnsuccessful()
The parse has completed, but not successfully.
 o getCurrentDocument()
Get the last XML document which was parsed.
 o getDefaultRootElement()
Get the default root element.
 o getDocumentTreeModel()
Get the tree model of the current document.
 o getFont(AttributeSet)
Get the font from an attribute set.
 o getForeground(AttributeSet)
Get the color to be used for the foreground, based on the value of the 'color' attribute in the InputAttributeSet.
 o getRootElements()
Get all the root elements which are defined.
 o getSourceString()
Get the current source in the form of a string.
 o getStatusBar()
Get the status bar.
 o getStyledEditModeFlag()
Get the styled edit mode flag.
 o getXmlEngine()
Get the XML processor.
 o save(String)
Save this document to the named file.
 o saveFromSource(String)
Save the source of this document to the named file.
 o setStatusBar(xm_StatusBar)
Set the status bar for displaying parse progress.
 o setStyledEditModeFlag(boolean)
Set the styled edit mode flag.
 o setXmlEngine(xm_XmlEngine)
Set the XML processor to be used to process this document.
 o startNode(xg_Node, int)
The start of a node has been parsed.

Constructors

 o xm_DocumentModel
 public xm_DocumentModel(xm_XmlEngine InputXmlEngine)
Constructor.

Methods

 o clear
 public void clear()
Clear this document, ready to start afresh.

 o save
 public void save(String InputFilePathnameString) throws IOException
Save this document to the named file.

Parameters:
InputFilePathnameString - The pathname of the file to which the document is to be saved
Throws: IOException
Error writing to FileWriter
 o saveFromSource
 public void saveFromSource(String InputFilePathnameString) throws IOException
Save the source of this document to the named file.

Parameters:
InputFilePathnameString - The pathname of the file to which the document is to be saved
Throws: IOException
Error writing to FileWriter
 o setXmlEngine
 public void setXmlEngine(xm_XmlEngine InputXmlEngine)
Set the XML processor to be used to process this document.

Parameters:
InputXmlEngine - The XML processor
 o setStatusBar
 public void setStatusBar(xm_StatusBar InputStatusBar)
Set the status bar for displaying parse progress.

Parameters:
InputStatusBar - The status bar for displaying parse progress
 o setStyledEditModeFlag
 public void setStyledEditModeFlag(boolean InputStyledEditModeFlag)
Set the styled edit mode flag.

Parameters:
InputStyledEditModeFlag - true means we are in styled edit mode; false means we're not
 o getCurrentDocument
 public xg_Document getCurrentDocument()
Get the last XML document which was parsed.

Returns:
The last XML document parsed
 o getSourceString
 public String getSourceString()
Get the current source in the form of a string.

Returns:
A string representation of the current source
 o getDocumentTreeModel
 public DefaultTreeModel getDocumentTreeModel()
Get the tree model of the current document.

Returns:
The tree model of the current document
 o getXmlEngine
 public xm_XmlEngine getXmlEngine()
Get the XML processor.

Returns:
The XML processor
 o getStatusBar
 public xm_StatusBar getStatusBar()
Get the status bar.

Returns:
The status bar
 o getStyledEditModeFlag
 public boolean getStyledEditModeFlag()
Get the styled edit mode flag.

Returns:
true means we are in styled edit mode; false means we're not
 o getDefaultRootElement
 public Element getDefaultRootElement()
Get the default root element.

Returns:
The default root element
Overrides:
getDefaultRootElement in class DefaultStyledDocument
 o getRootElements
 public Element[] getRootElements()
Get all the root elements which are defined.

Returns:
An array of all root elements
Overrides:
getRootElements in class AbstractDocument
 o getForeground
 public Color getForeground(AttributeSet InputAttributeSet)
Get the color to be used for the foreground, based on the value of the 'color' attribute in the InputAttributeSet.

Parameters:
InputAttributeSet - The attribute set
Returns:
The foreground color
Overrides:
getForeground in class DefaultStyledDocument
 o getFont
 public Font getFont(AttributeSet InputAttributeSet)
Get the font from an attribute set.

Parameters:
InputAttributeSet - The attribute set
Returns:
The resulting font
Overrides:
getFont in class DefaultStyledDocument
 o startNode
 public void startNode(xg_Node InputNewNode,
                       int InputStartOffset)
The start of a node has been parsed.

Parameters:
InputNode - The node whose start has just been parsed
InputStartOffset - The offset from the start of the source at which this node starts
 o endNode
 public void endNode(xg_Node InputNewNode,
                     int InputEndPosition)
The end of a node has been parsed.

Parameters:
InputNewNode - The node which has just been parsed
InputEndPosition - The offset from the start of the source at which this node ends
 o endParseSuccessful
 public void endParseSuccessful()
The parse has completed successfully.

 o endParseUnsuccessful
 public void endParseUnsuccessful()
The parse has completed, but not successfully.


All Packages  Class Hierarchy  This Package  Previous  Next  Index