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.
-
xm_DocumentModel(xm_XmlEngine)
- Constructor.
-
clear()
- Clear this document, ready to start afresh.
-
endNode(xg_Node, int)
- The end of a node has been parsed.
-
endParseSuccessful()
- The parse has completed successfully.
-
endParseUnsuccessful()
- The parse has completed, but not successfully.
-
getCurrentDocument()
- Get the last XML document which was parsed.
-
getDefaultRootElement()
- Get the default root element.
-
getDocumentTreeModel()
- Get the tree model of the current document.
-
getFont(AttributeSet)
- Get the font from an attribute set.
-
getForeground(AttributeSet)
- Get the color to be used for the foreground, based on the value of the
'color' attribute in the InputAttributeSet.
-
getRootElements()
- Get all the root elements which are defined.
-
getSourceString()
- Get the current source in the form of a string.
-
getStatusBar()
- Get the status bar.
-
getStyledEditModeFlag()
- Get the styled edit mode flag.
-
getXmlEngine()
- Get the XML processor.
-
save(String)
- Save this document to the named file.
-
saveFromSource(String)
- Save the source of this document to the named file.
-
setStatusBar(xm_StatusBar)
- Set the status bar for displaying parse progress.
-
setStyledEditModeFlag(boolean)
- Set the styled edit mode flag.
-
setXmlEngine(xm_XmlEngine)
- Set the XML processor to be used to process this document.
-
startNode(xg_Node, int)
- The start of a node has been parsed.
xm_DocumentModel
public xm_DocumentModel(xm_XmlEngine InputXmlEngine)
- Constructor.
clear
public void clear()
- Clear this document, ready to start afresh.
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
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
setXmlEngine
public void setXmlEngine(xm_XmlEngine InputXmlEngine)
- Set the XML processor to be used to process this document.
- Parameters:
- InputXmlEngine - The XML processor
setStatusBar
public void setStatusBar(xm_StatusBar InputStatusBar)
- Set the status bar for displaying parse progress.
- Parameters:
- InputStatusBar - The status bar for displaying parse progress
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
getCurrentDocument
public xg_Document getCurrentDocument()
- Get the last XML document which was parsed.
- Returns:
- The last XML document parsed
getSourceString
public String getSourceString()
- Get the current source in the form of a string.
- Returns:
- A string representation of the current source
getDocumentTreeModel
public DefaultTreeModel getDocumentTreeModel()
- Get the tree model of the current document.
- Returns:
- The tree model of the current document
getXmlEngine
public xm_XmlEngine getXmlEngine()
- Get the XML processor.
- Returns:
- The XML processor
getStatusBar
public xm_StatusBar getStatusBar()
- Get the status bar.
- Returns:
- The status bar
getStyledEditModeFlag
public boolean getStyledEditModeFlag()
- Get the styled edit mode flag.
- Returns:
- true means we are in styled edit mode; false means we're not
getDefaultRootElement
public Element getDefaultRootElement()
- Get the default root element.
- Returns:
- The default root element
- Overrides:
- getDefaultRootElement in class DefaultStyledDocument
getRootElements
public Element[] getRootElements()
- Get all the root elements which are defined.
- Returns:
- An array of all root elements
- Overrides:
- getRootElements in class AbstractDocument
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
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
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
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
endParseSuccessful
public void endParseSuccessful()
- The parse has completed successfully.
endParseUnsuccessful
public void endParseUnsuccessful()
- The parse has completed, but not successfully.
All Packages Class Hierarchy This Package Previous Next Index