net.sourceforge.jeuclid.elements.generic
Class DocumentElement

java.lang.Object
  extended by net.sourceforge.jeuclid.dom.AbstractPartialNodeImpl
      extended by net.sourceforge.jeuclid.dom.AbstractPartialDocumentImpl
          extended by net.sourceforge.jeuclid.elements.generic.DocumentElement
All Implemented Interfaces:
ChangeTrackingInterface, DisplayableNode, JEuclidNode, Document, MathMLDocument, Node

public class DocumentElement
extends AbstractPartialDocumentImpl
implements MathMLDocument, JEuclidNode, ChangeTrackingInterface, DisplayableNode

Class for MathML Document Nodes.

Version:
$Revision: 310 $
Author:
Max Berger

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.jeuclid.dom.AbstractPartialNodeImpl
AbstractPartialNodeImpl.NodeList
 
Field Summary
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
DocumentElement(MathBase base)
          Creates a math element.
 
Method Summary
 void addListener(ChangeTrackingInterface listener)
          Adds a change listener to this element.
 void fireChanged(boolean propagate)
          Called when the element has changed.
 void fireChangeForSubTree()
          fires a change on this element and all its children, but no listeners and parents.
 float getAscentHeight(Graphics2D g)
          Returns the current height of the upper part of this component from the baseline.
 float getDescentHeight(Graphics2D g)
          Returns the current height of the lower part of this component from the baseline.
 String getDomain()
          The domain name of the server that served the document, or null if the server cannot be identified by a domain name, or if it is not available.
 float getFontsizeInPoint()
          Gets the size of the actual font used (including scriptsizemultiplier).
 float getHeight(Graphics2D g)
          Return the current height of this element.
 float getMathsizeInPoint()
          Get the actual mathsize in points.
 float getPaintedPosX()
          Returns the last X position this node was painted on.
 float getPaintedPosY()
          Returns the last Y position this node was painted on.
 String getReferrer()
          The URI of the page that linked to this document, if available.
 String getURI()
          The complete URI of this document.
 float getWidth(Graphics2D g)
          Returns the current width of this element.
 float getXCenter(Graphics2D g)
          Returns the center X coordinate of the content.
 void paint(Graphics2D g, float posX, float posY)
          Paints the whole MathML document.
 void setMathBase(MathBase base)
          Set the MathBase to use within this document tree.
 
Methods inherited from class net.sourceforge.jeuclid.dom.AbstractPartialDocumentImpl
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getNodeName, getNodeType, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
Methods inherited from class net.sourceforge.jeuclid.dom.AbstractPartialNodeImpl
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Document
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Constructor Detail

DocumentElement

public DocumentElement(MathBase base)
Creates a math element.

Parameters:
base - The base for the math element tree.
Method Detail

getDomain

public String getDomain()
The domain name of the server that served the document, or null if the server cannot be identified by a domain name, or if it is not available. If this is not a stand-alone MathML document (e.g. is embedded in an XHTML document), this may be retrieved from the parent Document if available.

Specified by:
getDomain in interface MathMLDocument
Returns:
value of the domain attribute.

getReferrer

public String getReferrer()
The URI of the page that linked to this document, if available. This is null if the user navigated directly to the page. If this is not a stand-alone MathML document (e.g. is embedded in an XHTML document), this may be retrieved from the parent Document if available.

Specified by:
getReferrer in interface MathMLDocument
Returns:
value of the referrer attribute.

getURI

public String getURI()
The complete URI of this document. This is null if this is not a stand-alone MathML document.

Specified by:
getURI in interface MathMLDocument
Returns:
value of the URI attribute.

paint

public void paint(Graphics2D g,
                  float posX,
                  float posY)
Paints the whole MathML document.

Specified by:
paint in interface DisplayableNode
Parameters:
g - Graphics2D context.
posX - x-offset to start from.
posY - y-offset to start from.

getWidth

public float getWidth(Graphics2D g)
Returns the current width of this element.

Specified by:
getWidth in interface DisplayableNode
Parameters:
g - Graphics2D context to use.
Returns:
Width of this element.

getAscentHeight

public float getAscentHeight(Graphics2D g)
Returns the current height of the upper part of this component from the baseline.

Specified by:
getAscentHeight in interface DisplayableNode
Parameters:
g - Graphics2D context to use.
Returns:
Height of the upper part

getDescentHeight

public float getDescentHeight(Graphics2D g)
Returns the current height of the lower part of this component from the baseline.

Specified by:
getDescentHeight in interface DisplayableNode
Parameters:
g - Graphics2D context to use.
Returns:
Height of the lower part.

setMathBase

public void setMathBase(MathBase base)
Set the MathBase to use within this document tree.

Parameters:
base - the MathBase object to use.

getMathsizeInPoint

public float getMathsizeInPoint()
Get the actual mathsize in points. This does not include scriptsizemultiplier.

Specified by:
getMathsizeInPoint in interface JEuclidNode
Returns:
mathsize in points.

getFontsizeInPoint

public float getFontsizeInPoint()
Gets the size of the actual font used (including scriptsizemultiplier).

Specified by:
getFontsizeInPoint in interface JEuclidNode
Returns:
size of the current font.

addListener

public void addListener(ChangeTrackingInterface listener)
Adds a change listener to this element.

Specified by:
addListener in interface ChangeTrackingInterface
Parameters:
listener - the element to be notified in case of changes (if propagate is set).

fireChanged

public void fireChanged(boolean propagate)
Called when the element has changed.

Specified by:
fireChanged in interface ChangeTrackingInterface
Parameters:
propagate - if set to true, change is also fired on parent and registered listeners.

fireChangeForSubTree

public void fireChangeForSubTree()
fires a change on this element and all its children, but no listeners and parents.

Specified by:
fireChangeForSubTree in interface ChangeTrackingInterface

getHeight

public float getHeight(Graphics2D g)
Return the current height of this element.

Specified by:
getHeight in interface DisplayableNode
Parameters:
g - Graphics2D context to use.
Returns:
Height of this element

getPaintedPosX

public float getPaintedPosX()
Returns the last X position this node was painted on. May return -1 if the node was not painted recently.

Specified by:
getPaintedPosX in interface DisplayableNode
Returns:
the x position.

getPaintedPosY

public float getPaintedPosY()
Returns the last Y position this node was painted on. May return -1 if the node was not painted recently.

Specified by:
getPaintedPosY in interface DisplayableNode
Returns:
the y position.

getXCenter

public float getXCenter(Graphics2D g)
Returns the center X coordinate of the content. In most cases, this will be width/2. In some cases, an element may have extra space on one side, therefore moving the content.

Specified by:
getXCenter in interface DisplayableNode
Parameters:
g - X-offset of the horizontal center of the actual content.
Returns:
Graphics2D context to use.


Copyright © 2002-2008 The JEuclid project. All Rights Reserved.