net.sourceforge.jeuclid.elements
Interface JEuclidElement

All Superinterfaces:
ChangeTrackingInterface, DisplayableNode, Element, JEuclidNode, MathMLElement, Node
All Known Implementing Classes:
AbstractContainer, AbstractElementWithDelegates, AbstractInvisibleJEuclidElement, AbstractJEuclidElement, AbstractMathElementWithChildren, AbstractRoot, AbstractRowLike, AbstractScriptElement, AbstractSubSuper, AbstractTokenWithStandardLayout, AbstractTokenWithTextLayout, AbstractUnderOver, Annotation, Maction, Maligngroup, Malignmark, MathImpl, Menclose, Menclose.AbstractRowLikeNotation, Menclose.Downdiagonalstrike, Menclose.Longdiv, Menclose.Updiagonalstrike, Merror, Mfenced, Mfrac, Mglyph, Mi, Mlabeledtr, Mmultiscripts, Mn, Mo, Mover, Mpadded, Mphantom, Mprescripts, Mroot, Mrow, Ms, Mspace, Msqrt, Mstyle, Msub, Msubsup, Msup, Mtable, Mtd, Mtext, Mtr, Munder, Munderover, None, Semantics

public interface JEuclidElement
extends MathMLElement, DisplayableNode, JEuclidNode

Interface for all MathElements within JEuclid.

Version:
$Revision: 310 $
Author:
Max Berger

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
 
Method Summary
 float calculateAscentHeight(Graphics2D g)
          Returns the current height of the upper part (over the base line).
 float calculateDescentHeight(Graphics2D g)
          Calculates descent height (under the base line) of the element.
 Color getBackgroundColor()
          Returns background color of the element.
 Color getForegroundColor()
          Gets the color that this element is supposed to use for rendering its foreground elements.
 float getGlobalLineCorrector()
          Returns value of the vertical shift for the specific elements in the line.
 int getIndexOfMathElement(JEuclidElement element)
          Gets index of child element.
 MathBase getMathBase()
          Gets the math base.
 JEuclidElement getMathElement(int index)
          Gets a child from this element.
 int getMathElementCount()
          Returns the count of childs from this element.
 MathVariant getMathvariantAsVariant()
          Gets the current mathvariant.
 JEuclidElement getParent()
          Returns parent of this element.
 int getScriptlevelForChild(JEuclidElement child)
          Retrieves the scriptlevel for a certain child.
 boolean hasChildPostscripts(JEuclidElement child)
          returns true is the child has postscripts attached to it.
 boolean hasChildPrescripts(JEuclidElement child)
          returns true is the child has prescripts attached to it.
 boolean isCalculatingSize()
          returns true if the parent is currently calculating its size.
 boolean isChildBlock(JEuclidElement child)
          Returns true if the child should be displayed as a block (not inline).
 void setCalculatingSize(boolean calculatingSize)
           
 void setFakeParent(JEuclidElement parent)
          Sets the parent of this element.
 void setGlobalLineCorrector(float corrector)
          Sets value of the vertical shift for the specific elements in the line.
 void setMathAttributes(AttributeMap attributes)
          convenience method to set multiple attributes at once.
 void setMathElement(int index, MathMLElement newElement)
          Sets a specific child to the newElement, creating other subelements as necessary.
 
Methods inherited from interface org.w3c.dom.mathml.MathMLElement
getClassName, getHref, getId, getMathElementStyle, getOwnerMathElement, getXref, setClassName, setHref, setId, setMathElementStyle, setXref
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
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
 
Methods inherited from interface net.sourceforge.jeuclid.elements.DisplayableNode
getAscentHeight, getDescentHeight, getHeight, getPaintedPosX, getPaintedPosY, getWidth, getXCenter, paint
 
Methods inherited from interface net.sourceforge.jeuclid.elements.JEuclidNode
getFontsizeInPoint, getMathsizeInPoint
 
Methods inherited from interface net.sourceforge.jeuclid.dom.ChangeTrackingInterface
addListener, fireChanged, fireChangeForSubTree
 

Method Detail

setFakeParent

void setFakeParent(JEuclidElement parent)
Sets the parent of this element.

Parameters:
parent - Parent element

setMathAttributes

void setMathAttributes(AttributeMap attributes)
convenience method to set multiple attributes at once.

Parameters:
attributes - List of attribute names and values.

isCalculatingSize

boolean isCalculatingSize()
returns true if the parent is currently calculating its size.

Returns:
true if parent is calculating size.

calculateAscentHeight

float calculateAscentHeight(Graphics2D g)
Returns the current height of the upper part (over the base line).

Parameters:
g - Graphics2D context to use.
Returns:
Height of the upper part.

calculateDescentHeight

float calculateDescentHeight(Graphics2D g)
Calculates descent height (under the base line) of the element.

Parameters:
g - Graphics2D context to use.
Returns:
Descent height value.

setCalculatingSize

void setCalculatingSize(boolean calculatingSize)
Parameters:
calculatingSize - the calculatingSize to set

getBackgroundColor

Color getBackgroundColor()
Returns background color of the element.

Returns:
Color object.

getForegroundColor

Color getForegroundColor()
Gets the color that this element is supposed to use for rendering its foreground elements.

Returns:
a color.

getGlobalLineCorrector

float getGlobalLineCorrector()
Returns value of the vertical shift for the specific elements in the line. This applies to "munderover", "msubsup", "mover", etc.. In case such elements contains enlarged operator, other elements on the right should be positioned in the center of the line. Value of the shift is stored in the top-level element of the line.

Returns:
Value of the corrector of the line.
See Also:
setGlobalLineCorrector(float)

getIndexOfMathElement

int getIndexOfMathElement(JEuclidElement element)
Gets index of child element.

Parameters:
element - Child element.
Returns:
Index of the element, -1 if element was not found

getMathvariantAsVariant

MathVariant getMathvariantAsVariant()
Gets the current mathvariant.

Returns:
the current MathVariant

setGlobalLineCorrector

void setGlobalLineCorrector(float corrector)
Sets value of the vertical shift for the specific elements in the line. This applies to "munderover", "msubsup", "mover", etc.. In case such elements containes enlarged operator, other elements on the right should be positioned in the center of the line regarding such elements. Value of the shift is stored in the top-level element of the line.

Parameters:
corrector - Value of corrector.
See Also:
getGlobalLineCorrector()

getMathElement

JEuclidElement getMathElement(int index)
Gets a child from this element.

Please note, that unlike the MathML DOM model functions this function uses a 0-based index.

Parameters:
index - Index of the child (0-based).
Returns:
The child MathElement object.

setMathElement

void setMathElement(int index,
                    MathMLElement newElement)
Sets a specific child to the newElement, creating other subelements as necessary.

Parameters:
index - the index to set (0=the firt child)
newElement - new element to be set as child.

getScriptlevelForChild

int getScriptlevelForChild(JEuclidElement child)
Retrieves the scriptlevel for a certain child. Some attributes increase the scriptlevel for some of their children.

Parameters:
child - element node of the child.
Returns:
the scriptlevel for this particular child.

getParent

JEuclidElement getParent()
Returns parent of this element.

Returns:
Parent element.

isChildBlock

boolean isChildBlock(JEuclidElement child)
Returns true if the child should be displayed as a block (not inline). Roughly corresponds to the "displaystyle" property (3.2.5.9)

Parameters:
child - child to test
Returns:
true if child is block.

hasChildPrescripts

boolean hasChildPrescripts(JEuclidElement child)
returns true is the child has prescripts attached to it. In this case, there should be no extra space on the left.

Parameters:
child - child to test
Returns:
true if there are attached prescripts

hasChildPostscripts

boolean hasChildPostscripts(JEuclidElement child)
returns true is the child has postscripts attached to it. In this case, there should be no extra space on the left.

Parameters:
child - child to test
Returns:
true if there are attached postscripts

getMathElementCount

int getMathElementCount()
Returns the count of childs from this element.

Returns:
Count of childs.

getMathBase

MathBase getMathBase()
Gets the math base.

Returns:
Math base object.


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