|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jeuclid.dom.AbstractPartialNodeImpl
net.sourceforge.jeuclid.dom.AbstractPartialElementImpl
net.sourceforge.jeuclid.dom.AbstractChangeTrackingElement
net.sourceforge.jeuclid.elements.AbstractJEuclidElement
public abstract class AbstractJEuclidElement
The basic class for all math elements. Every element class inherits from this class. It provides basic functionality for drawing.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sourceforge.jeuclid.dom.AbstractPartialElementImpl |
|---|
AbstractPartialElementImpl.AttributeNodeMap, AbstractPartialElementImpl.AttrImpl |
| Nested classes/interfaces inherited from class net.sourceforge.jeuclid.dom.AbstractPartialNodeImpl |
|---|
AbstractPartialNodeImpl.NodeList |
| Field Summary | |
|---|---|
static String |
ALIGN_AXIS
value for axis alignment. |
static String |
ALIGN_BASELINE
value for baseline alignment. |
static String |
ALIGN_BOTTOM
value for bottom alignment. |
static String |
ALIGN_CENTER
value for center alignment. |
static String |
ALIGN_LEFT
value for left alignment. |
static String |
ALIGN_RIGHT
value for right alignment. |
static String |
ALIGN_TOP
value for top alignment. |
static String |
ATTR_CLASS
Constant for class attribute. |
static String |
ATTR_DEPRECATED_BACKGROUND
Constant for background attribute. |
static String |
ATTR_DEPRECATED_COLOR
Constant for color attribute. |
static String |
ATTR_DEPRECATED_FONTFAMILY
Constant for fontfamily attribute. |
static String |
ATTR_DEPRECATED_FONTSIZE
Constant for fontsize attribute. |
static String |
ATTR_DEPRECATED_FONTSTYLE
Constant for fontstyle attribute. |
static String |
ATTR_DEPRECATED_FONTWEIGHT
Constant for fontweight attribute. |
static String |
ATTR_HREF
Constant for href attribute. |
static String |
ATTR_ID
Constant for id attribute. |
static String |
ATTR_MATHBACKGROUND
The mathbackground attribute. |
static String |
ATTR_MATHCOLOR
Constant for mathcolor attribute. |
static String |
ATTR_MATHSIZE
Constant for mathsize attribute. |
static String |
ATTR_MATHVARIANT
Constant for mathvariant attribute. |
static String |
ATTR_STYLE
Constant for style attribute. |
static String |
ATTR_XREF
Constant for xref attribute. |
static int |
TRIVIAL_SPACE_MAX
largest value for all trivial spaces (= spaces that can be ignored / shortened). |
static String |
URI
The URI from MathML. |
| Constructor Summary | |
|---|---|
AbstractJEuclidElement(MathBase base)
Creates a math element. |
|
| Method Summary | |
|---|---|
void |
addMathElement(MathMLElement child)
Add a math element as a child. |
void |
addText(String text)
Add the content of a String to this element. |
abstract float |
calculateAscentHeight(Graphics2D g)
Returns the current height of the upper part (over the base line). |
abstract float |
calculateDescentHeight(Graphics2D g)
Calculates descent height (under the base line) of the element. |
float |
calculateHeight(Graphics2D g)
Calculates the current height of the element. |
abstract float |
calculateWidth(Graphics2D g)
Caculates width of the element. |
protected void |
changeHook()
Called on any change. |
void |
debug(Graphics2D g,
float posX,
float posY)
Paints a border around this element as debug information. |
protected int |
getAbsoluteScriptLevel()
Retrieve the absolute script level. |
float |
getAscentHeight(Graphics2D g)
Returns the current height of the upper part of this component from the baseline. |
Color |
getBackgroundColor()
Returns background color of the element. |
String |
getClassName()
The class attribute of the element. |
MathMLNodeList |
getContents()
Returns the children as a MathML NodeList. |
float |
getDescentHeight(Graphics2D g)
Returns the current height of the lower part of this component from the baseline. |
Font |
getFont()
Gets the used font. |
FontMetrics |
getFontMetrics(Graphics2D g)
Gets the font metrics of the used font. |
float |
getFontsizeInPoint()
Gets the size of the actual font used (including scriptsizemultiplier). |
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. |
float |
getHeight(Graphics2D g)
Return the current height of this element. |
String |
getHref()
The xlink:href attribute of the element. |
String |
getId()
The element's identifier. |
int |
getIndexOfMathElement(JEuclidElement element)
Gets index of child element. |
protected int |
getInheritedScriptlevel()
Retrieves the scriptlevel from the parent node. |
protected String |
getMathAttribute(String attrName)
retrieve an attribute from the MathML or default namespace. |
String |
getMathbackground()
Returns value of mathbackground attribute. |
MathBase |
getMathBase()
Gets the math base. |
String |
getMathcolor()
Returns value of mathcolor attribute. |
JEuclidElement |
getMathElement(int index)
Gets a child from this element. |
int |
getMathElementCount()
Returns the count of childs from this element. |
String |
getMathElementStyle()
A string identifying the element's style attribute. |
String |
getMathsize()
Retrieve the mathsize attribute. |
float |
getMathsizeInPoint()
Get the actual mathsize in points. |
String |
getMathvariant()
Returns value of mathvariant attribute (style of the element). |
MathVariant |
getMathvariantAsVariant()
Gets the current mathvariant. |
float |
getMiddleShift(Graphics2D g)
Returns the distance of the baseline and the middleline. |
MathMLMathElement |
getOwnerMathElement()
The MathMLMathElement corresponding to the nearest math element ancestor of this element. |
float |
getPaintedPosX()
Returns the last X position this node was painted on. |
float |
getPaintedPosY()
Returns the last Y position this node was painted on. |
JEuclidElement |
getParent()
Returns parent of this element. |
int |
getScriptlevelForChild(JEuclidElement child)
Retrieves the scriptlevel for a certain child. |
float |
getScriptSizeMultiplier()
Gets value of scriptsize attribute. |
String |
getText()
Returns the text content of this element. |
float |
getWidth(Graphics2D g)
Returns the current width of this element. |
float |
getXCenter(Graphics2D g)
Returns the center X coordinate of the content. |
String |
getXref()
The xref attribute of the element. |
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 |
paint(Graphics2D g,
float posX,
float posY)
Paints this element. |
protected void |
recalculateSize()
Reset element sizes. |
void |
setCalculatingSize(boolean ncalculatingSize)
|
void |
setClassName(String className)
setter for the className attribute. |
protected void |
setDefaultMathAttribute(String key,
String value)
Sets default values for math attributes. |
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 |
setHref(String href)
setter for the href attribute. |
void |
setId(String id)
setter for the id attribute. |
void |
setMathAttributes(AttributeMap attributes)
convenience method to set multiple attributes at once. |
void |
setMathbackground(String mathbackground)
Sets the value of the machbackground attribute. |
void |
setMathBase(MathBase base)
Sets the base for this element. |
void |
setMathcolor(String mathcolor)
Sets value of math color attribute. |
void |
setMathElement(int index,
MathMLElement newElement)
Sets a specific child to the newElement, creating other subelements as necessary. |
void |
setMathElementStyle(String mathElementStyle)
setter for the mathElementStyle attribute. |
void |
setMathsize(String mathsize)
Sets mathsize to a new value. |
void |
setMathvariant(String mathvariant)
Sets value of mathvariant attribute (style of the element). |
void |
setScriptSizeMultiplier(float scriptsizemultiplier)
Sets value of scriptsize attribute. |
void |
setXref(String xref)
setter for the xref attribute. |
| Methods inherited from class net.sourceforge.jeuclid.dom.AbstractChangeTrackingElement |
|---|
addListener, appendChild, fireChanged, fireChangeForSubTree, replaceChild, setAttribute, setTextContent |
| Methods inherited from class net.sourceforge.jeuclid.dom.AbstractPartialElementImpl |
|---|
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getElementsByTagName, getElementsByTagNameNS, getLocalName, getNodeName, getNodeType, getSchemaTypeInfo, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, toString |
| Methods inherited from class net.sourceforge.jeuclid.dom.AbstractPartialNodeImpl |
|---|
cloneNode, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, setNodeValue, setPrefix, setUserData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 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.dom.ChangeTrackingInterface |
|---|
addListener, fireChanged, fireChangeForSubTree |
| Field Detail |
|---|
public static final String ATTR_MATHVARIANT
public static final String ATTR_MATHCOLOR
public static final String ATTR_MATHSIZE
public static final String ATTR_DEPRECATED_FONTFAMILY
public static final String ATTR_DEPRECATED_FONTSTYLE
public static final String ATTR_DEPRECATED_FONTWEIGHT
public static final String ATTR_DEPRECATED_FONTSIZE
public static final String ATTR_DEPRECATED_COLOR
public static final String ATTR_DEPRECATED_BACKGROUND
public static final String ATTR_CLASS
public static final String ATTR_STYLE
public static final String ATTR_ID
public static final String ATTR_HREF
public static final String ATTR_XREF
public static final String ATTR_MATHBACKGROUND
public static final String ALIGN_TOP
public static final String ALIGN_BOTTOM
public static final String ALIGN_CENTER
public static final String ALIGN_BASELINE
public static final String ALIGN_AXIS
public static final String ALIGN_LEFT
public static final String ALIGN_RIGHT
public static final int TRIVIAL_SPACE_MAX
public static final String URI
| Constructor Detail |
|---|
public AbstractJEuclidElement(MathBase base)
base - The base for the math element tree.| Method Detail |
|---|
protected void recalculateSize()
protected void changeHook()
changeHook in class AbstractChangeTrackingElementpublic float getFontsizeInPoint()
getFontsizeInPoint in interface JEuclidNodepublic Font getFont()
public MathVariant getMathvariantAsVariant()
getMathvariantAsVariant in interface JEuclidElementprotected int getAbsoluteScriptLevel()
getInheritedScriptlevel()protected int getInheritedScriptlevel()
public int getScriptlevelForChild(JEuclidElement child)
getScriptlevelForChild in interface JEuclidElementchild - element node of the child.
public final void addMathElement(MathMLElement child)
child - Math element object.public JEuclidElement getMathElement(int index)
Please note, that unlike the MathML DOM model functions this function uses a 0-based index.
getMathElement in interface JEuclidElementindex - Index of the child (0-based).
public void setMathElement(int index,
MathMLElement newElement)
setMathElement in interface JEuclidElementindex - the index to set (0=the firt child)newElement - new element to be set as child.public int getIndexOfMathElement(JEuclidElement element)
getIndexOfMathElement in interface JEuclidElementelement - Child element.
public int getMathElementCount()
getMathElementCount in interface JEuclidElementpublic void addText(String text)
text - String with text of this object.public String getText()
public void setMathBase(MathBase base)
base - Math base object.public MathBase getMathBase()
getMathBase in interface JEuclidElementpublic void setFakeParent(JEuclidElement parent)
setFakeParent in interface JEuclidElementparent - Parent elementpublic JEuclidElement getParent()
getParent in interface JEuclidElementpublic void setMathvariant(String mathvariant)
mathvariant - Value of mathvariant.public String getMathvariant()
public float getScriptSizeMultiplier()
public void setScriptSizeMultiplier(float scriptsizemultiplier)
scriptsizemultiplier - Value of scriptsize attribute.public FontMetrics getFontMetrics(Graphics2D g)
g - Graphics2D context to use.
public void setMathcolor(String mathcolor)
mathcolor - Color object.public String getMathcolor()
public String getMathsize()
public void setMathsize(String mathsize)
mathsize - value of mathsize.public float getMathsizeInPoint()
getMathsizeInPoint in interface JEuclidNode
protected void setDefaultMathAttribute(String key,