com.nwoods.jgo
Interface DomDoc

All Known Implementing Classes:
DefaultDocument

public interface DomDoc

An interface similar to org.w3c.dom.Document used for SVG XML serialization.

This interface allows the com.nwoods.jgo package to provide methods that manipulate org.w3c.dom.Document objects while not requiring the org.w3c.dom.Document class to be present in order to build com.nwoods.jgo.


Method Summary
 DomCDATASection createCDATASection(java.lang.String s)
           
 DomElement createElement(java.lang.String s)
          Creates an DomElement of the type specified.
 DomElement createJGoClassElement(java.lang.String className, DomElement parent)
          Creates an JGoClass DomElement.
 DomText createText(java.lang.String s)
          Creates a DomText node given the specified string.
 double getJGoSVGVersion()
          Return the JGo SVG version number associated with this document.
 boolean isDisabledDrawing()
          Determines if output of SVG visible elements by superclass is currently disabled
 boolean isGenerateJGoXML()
          Determines if output of JGo XML extensions to SVG is enabled.
 boolean isGenerateSVG()
          Determines if output of any SVG elements to the generated XML is enabled.
 boolean isRegisteredReference(java.lang.Object obj)
          Determines whether a reference to a particular object has already been regigistered by registerReferencingNode().
 boolean isSVGTooltips()
          Dermines if SVG tooltips along with associated tooltip scripts should be generated.
 boolean JGoXMLOutputEnabled()
          Compute whether the output of JGo XML extensions is currently allowed.
 void registerObject(java.lang.Object obj, DomElement node)
          Register the DomElement associated with an Object.
 void registerReferencingNode(DomElement referencingNode, java.lang.String refName, java.lang.Object referencedObj)
          Register the attribute name and referenced Object associated with a referencing DomElement.
 void registerReferencingObject(java.lang.Object obj, java.lang.String attr, java.lang.String refTag)
          Register the attribute name and referenced identifier associated with a referencing Object.
 void registerTag(java.lang.String tag, java.lang.Object obj)
          Register the Object associated with a DomElement id attribute.
 void setDisabledDrawing(boolean disable)
          Disable the output of any visible SVG elements by superclass.
 void setGenerateJGoXML(boolean enable)
          Enable the output of JGo XML extensions to SVG.
 void setGenerateSVG(boolean enable)
          Enable the output of SVG elements to the generated XML.
 void setSVGTooltips(boolean enable)
          Enable the generation of SVG tooltips along with associated tooltip scripts.
 boolean SVGOutputEnabled()
          Compute whether the output of SVG elements is currently allowed.
 void SVGTraverseChildren(JGoDocument jGoDoc, DomNode svgNode, JGoArea parent, boolean addToDoc)
          Traverse the DomNode children of a DomNode.
 

Method Detail

getJGoSVGVersion

public double getJGoSVGVersion()
Return the JGo SVG version number associated with this document. The version number is stored as in the jgosvgversion attribute of the svg element in any extended SVG document written by JGo. This version number is used by Northwoods to track changes to the extended SVG document structure and should not be modified by users. Users wishing to track the version number of their own extensions to the JGo extended SVG should create and use a separate attribute for this purpose.

Returns:
the JGo SVG version number associated with this document.

createJGoClassElement

public DomElement createJGoClassElement(java.lang.String className,
                                        DomElement parent)
Creates an JGoClass DomElement.

Create a JGoClass DomElement with the specified className value for the class attribute and append it as the next child node of the specified parent. Note that the className supplied must be accurate and complete as it will be used to create an object of the correct type when the SVG XML file is read.

Parameters:
className - the class name JGoObject this JGoClass DomElement represents
parent - the parent <g> to which to append the newly created DomElement that contains the definition of this JGoObject
Returns:
the created DomElement
See Also:
DefaultDocument.SVGWriteDoc(java.io.OutputStream, com.nwoods.jgo.JGoDocument), com.nwoods.jgo

createElement

public DomElement createElement(java.lang.String s)
Creates an DomElement of the type specified.

Parameters:
s - the name of the element type to instantiate.
Returns:
the created DomElement
See Also:
DefaultDocument.SVGWriteDoc(java.io.OutputStream, com.nwoods.jgo.JGoDocument), com.nwoods.jgo

createText

public DomText createText(java.lang.String s)
Creates a DomText node given the specified string.

Parameters:
s - data for the new DomText node.
Returns:
the created DomText
See Also:
DefaultDocument.SVGWriteDoc(java.io.OutputStream, com.nwoods.jgo.JGoDocument), com.nwoods.jgo

createCDATASection

public DomCDATASection createCDATASection(java.lang.String s)

registerObject

public void registerObject(java.lang.Object obj,
                           DomElement node)
Register the DomElement associated with an Object. This method will be called for any JGoObject whenever JGoObject.SVGWriteObject() is called. Subclasses of JGoObject need not directly call this method. This registration occurs so that the DomElements associated with a referenced JGoObject can be easily found and updated to include an "id" attribute when writing out an SVG XML document.

Parameters:
obj - the object to register in the map.
node - the DomElement associated with the obj
See Also:
DefaultDocument.SVGReadDoc(java.io.InputStream, com.nwoods.jgo.JGoDocument), registerReferencingNode(com.nwoods.jgo.DomElement, java.lang.String, java.lang.Object), JGoObject.SVGReadObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.JGoDocument, com.nwoods.jgo.DomElement, com.nwoods.jgo.DomElement)

registerReferencingNode

public void registerReferencingNode(DomElement referencingNode,
                                    java.lang.String refName,
                                    java.lang.Object referencedObj)
Register the attribute name and referenced Object associated with a referencing DomElement. Call this from JGoObject.SVGWriteObject() to register a reference to another Object whose DomElement may not yet have been created during the process of writing an SVG XML document using com.nwoods.jgo.svg.DefaultDocument.SVGWriteDoc(). After all DomElements have been created, all referencing DomElements will be updated to include referencing attribute of the form "jgoid#" and the JGoClass DomElement for all referenced DomElements will be update to include a referenced attribute of the form "id=jgoid#", where # is a unique number.

Parameters:
referencingNode - the DomElement containing a reference to another DomElement.
refName - the name of the reference attribute in the referencing DomElement.
referencedObj - the referenced Object
See Also:
DefaultDocument.SVGWriteDoc(java.io.OutputStream, com.nwoods.jgo.JGoDocument), com.nwoods.jgo

isRegisteredReference

public boolean isRegisteredReference(java.lang.Object obj)
Determines whether a reference to a particular object has already been regigistered by registerReferencingNode(). This is often useful to know if the first reference to an object should cause a DomElement representing that object to be genereated and subsquent references to that object should only reference the previously generated element.

Returns:
true if the referenced Object has
See Also:
DefaultDocument.SVGWriteDoc(java.io.OutputStream, com.nwoods.jgo.JGoDocument), JGoObject.SVGWriteObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.DomElement), registerReferencingNode(com.nwoods.jgo.DomElement, java.lang.String, java.lang.Object)

registerTag

public void registerTag(java.lang.String tag,
                        java.lang.Object obj)
Register the Object associated with a DomElement id attribute. This method will be called for any JGoObject whenever JGoObject.SVGReadObject() is called. Subclasses of JGoObject need not directly call this method. This registration occurs so that the JGoObjects associated with a referenced DomElement can be easily found, enabling JGoObject.SVGUpdateReference() to be called on the referencing object passing the referenced JGoObject when reading in an SVG XML document.

Parameters:
tag - the id attribute to be used as a key value for lookups
obj - the object associated with this tag id value
See Also:
DefaultDocument.SVGReadDoc(java.io.InputStream, com.nwoods.jgo.JGoDocument), JGoObject.SVGReadObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.JGoDocument, com.nwoods.jgo.DomElement, com.nwoods.jgo.DomElement), JGoObject.SVGUpdateReference(java.lang.String, java.lang.Object)

registerReferencingObject

public void registerReferencingObject(java.lang.Object obj,
                                      java.lang.String attr,
                                      java.lang.String refTag)
Register the attribute name and referenced identifier associated with a referencing Object. Call this from JGoObject.SVGReadObject() to register a reference to another Object which may not yet have been created during the process of reading an SVG XML document using com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc(). After all Objects have been created, SVGUpdateReference() will be called for all Objects registered by this method, passing in the attribute name of the reference and the referenced object.

Parameters:
obj - the Object containing a reference to another Object described by a DomElement.
attr - the name of the reference attribute in the referencing DomElement.
refTag - the unique identifier of the referenced Object as specified in the referencing DomElement.
See Also:
DefaultDocument.SVGReadDoc(java.io.InputStream, com.nwoods.jgo.JGoDocument), com.nwoods.jgo, com.nwoods.jgo

SVGTraverseChildren

public void SVGTraverseChildren(JGoDocument jGoDoc,
                                DomNode svgNode,
                                JGoArea parent,
                                boolean addToDoc)
Traverse the DomNode children of a DomNode. This method will traverse the DomElement children of an DomNode and call SVGReadElement() on them which will in turn automatically create an appropriate JGoObject and call JGoObject.SVGReadObject() for all JGoClass DomNodes representing JGoObjects.

Parameters:
jGoDoc - the JGoDocument being populated from the SVG XML document
svgNode - the DomNode whose children are to be traversed
parent - the JGoArea to which child objects should be added, or null
addToDoc - a flag indicating whether objects should be added to the JGoDocument
See Also:
DefaultDocument.SVGReadDoc(java.io.InputStream, com.nwoods.jgo.JGoDocument), DefaultDocument.SVGReadElement(com.nwoods.jgo.JGoDocument, java.lang.String, com.nwoods.jgo.DomElement, java.lang.String, com.nwoods.jgo.DomElement, com.nwoods.jgo.JGoArea, boolean), com.nwoods.jgo

setDisabledDrawing

public void setDisabledDrawing(boolean disable)
Disable the output of any visible SVG elements by superclass. This method is typically called by SVGWriteObject() in order to disable any SVG drawing operations by a JGoObject superclass. By default, superclasses of an JGoObject are allowed to add visible SVG elements to the output DomDoc. For example, any user subclass of a JGoRectangle will appear in the SVG output as a rectangle. However, it some circumstances a subclass will want to control all aspects of the SVG drawing and will want to disable any visible SVG output from being generated by the superclasses. For example, a JGoPolygon is a subclass of JGoStroke. JGoStroke segments are drawn using a <line> element while a closed JGoPolygon is drawn using a <path> element. Thus, JGoPolygon uses setDisabledDrawing() to avoid the erroneous <line> elements from being generated by its superclass. Note that SVGWriteDoc() will automatically reenable SVG drawing before calling JGoObject.SVGWriteObject() on the next JGoObject instance encountered in the JGoDocument.

Parameters:
disable - true if SVG output of visible elements is to be disabled

isDisabledDrawing

public boolean isDisabledDrawing()
Determines if output of SVG visible elements by superclass is currently disabled

Returns:
true of SVG output of visible element is currently disabled
See Also:
setDisabledDrawing(boolean)

setGenerateJGoXML

public void setGenerateJGoXML(boolean enable)
Enable the output of JGo XML extensions to SVG.

Parameters:
enable - true if JGo XML extensions to SVG are to be disabled

isGenerateJGoXML

public boolean isGenerateJGoXML()
Determines if output of JGo XML extensions to SVG is enabled.

Returns:
true of SVG output of visible element is currently disabled
See Also:
setDisabledDrawing(boolean)

setGenerateSVG

public void setGenerateSVG(boolean enable)
Enable the output of SVG elements to the generated XML.

Parameters:
enable - true if the output of any SVG elements to the generated XML is to be enabled

isGenerateSVG

public boolean isGenerateSVG()
Determines if output of any SVG elements to the generated XML is enabled.

Returns:
true if the output of any SVG elements to the generated XML is enabled
See Also:
setDisabledDrawing(boolean)

setSVGTooltips

public void setSVGTooltips(boolean enable)
Enable the generation of SVG tooltips along with associated tooltip scripts. By default, SVG tooltips are generated as elements and displayed using scripts. <P> <DD><DL> <DT><B>Returns:</B><DD>true if SVG tooltips should be generated</DL> </DD> </DL> <HR> <A NAME="isSVGTooltips()"><!-- --></A><H3> isSVGTooltips</H3> <PRE> public boolean <B>isSVGTooltips</B>()</PRE> <DL> <DD>Dermines if SVG tooltips along with associated tooltip scripts should be generated. By default, SVG tooltips are generated as <title> elements and displayed using scripts. <P> <DD><DL> <DT><B>Returns:</B><DD>true if the generation of SVG tooltips is to be enabled</DL> </DD> </DL> <HR> <A NAME="JGoXMLOutputEnabled()"><!-- --></A><H3> JGoXMLOutputEnabled</H3> <PRE> public boolean <B>JGoXMLOutputEnabled</B>()</PRE> <DL> <DD>Compute whether the output of JGo XML extensions is currently allowed. <P> <DD><DL> <DT><B>Returns:</B><DD>true if the output of JGo XML extensions is currently allowed.</DL> </DD> </DL> <HR> <A NAME="SVGOutputEnabled()"><!-- --></A><H3> SVGOutputEnabled</H3> <PRE> public boolean <B>SVGOutputEnabled</B>()</PRE> <DL> <DD>Compute whether the output of SVG elements is currently allowed. <P> <DD><DL> <DT><B>Returns:</B><DD>true if the output of SVG elements is currently allowed.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">  <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../com/nwoods/jgo/DomCDATASection.html" title="interface in com.nwoods.jgo"><B>PREV CLASS</B></A>   <A HREF="../../../com/nwoods/jgo/DomElement.html" title="interface in com.nwoods.jgo"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>    <A HREF="DomDoc.html" target="_top"><B>NO FRAMES</B></A>    <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>