|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.batik.dom.AbstractNode org.apache.batik.dom.AbstractParentNode org.apache.batik.dom.AbstractParentChildNode org.apache.batik.dom.AbstractElement org.apache.batik.dom.AbstractElementNS org.apache.batik.dom.GenericElementNS 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 org.apache.batik.dom.AbstractElement |
---|
AbstractElement.ElementTypeInfo, AbstractElement.Entry, AbstractElement.NamedNodeHashMap |
Nested classes/interfaces inherited from class org.apache.batik.dom.AbstractParentNode |
---|
AbstractParentNode.ChildNodes, AbstractParentNode.ElementsByTagName, AbstractParentNode.ElementsByTagNameNS |
Field Summary | |
---|---|
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. |
Fields inherited from class org.apache.batik.dom.GenericElementNS |
---|
nodeName, readonly |
Fields inherited from class org.apache.batik.dom.AbstractElementNS |
---|
namespaceURI |
Fields inherited from class org.apache.batik.dom.AbstractElement |
---|
attributes, typeInfo |
Fields inherited from class org.apache.batik.dom.AbstractParentChildNode |
---|
nextSibling, parentNode, previousSibling |
Fields inherited from class org.apache.batik.dom.AbstractParentNode |
---|
childNodes |
Fields inherited from class org.apache.batik.dom.AbstractNode |
---|
DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, EMPTY_NODE_LIST, eventSupport, managerData, ownerDocument, userData, userDataHandlers |
Constructor Summary | |
---|---|
AbstractJEuclidElement(String qname,
AbstractDocument odoc)
Default constructor. |
|
AbstractJEuclidElement(String nsUri,
String qname,
AbstractDocument odoc)
Constructor to explicitly set the namespace. |
Method Summary | |
---|---|
void |
addMathElement(MathMLElement child)
Add a math element as a child. |
LayoutContext |
applyLocalAttributesToContext(LayoutContext context)
Retrieve the LayoutContext valid for the current node. |
protected void |
changeHook()
Override this function to get notified whenever the contents of this element have changed. |
boolean |
dispatchEvent(Event evt)
|
LayoutContext |
getChildLayoutContext(int childNum,
LayoutContext context)
get the layout context for the given child. |
List<LayoutableNode> |
getChildrenToDraw()
|
List<LayoutableNode> |
getChildrenToLayout()
|
String |
getClassName()
The class attribute of the element. |
MathMLNodeList |
getContents()
Returns the children as a MathML NodeList. |
Font |
getFont(LayoutContext context)
Gets the used font. |
FontMetrics |
getFontMetrics(Graphics2D g,
LayoutContext context)
Gets the font metrics of the used font. |
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 String |
getMathAttribute(String attrName)
retrieve an attribute from the MathML or default name space, returning the default value if the attribute is not set. |
protected String |
getMathAttribute(String attrName,
boolean useDefault)
retrieve an attribute from the MathML or default name space. |
String |
getMathbackground()
Returns value of mathbackground attribute. |
String |
getMathcolor()
Returns value of mathcolor attribute. |
protected JEuclidElement |
getMathElement(int index)
Gets a child from this element. |
int |
getMathElementCount()
Returns the count of children for this element. |
String |
getMathElementStyle()
A string identifying the element's style attribute. |
String |
getMathsize()
Retrieve the mathsize attribute. |
String |
getMathvariant()
Returns value of mathvariant attribute (style of the element). |
MathVariant |
getMathvariantAsVariant()
Gets the current mathvariant. |
float |
getMiddleShift(Graphics2D g,
LayoutContext context)
Returns the distance of the baseline and the middleline. |
MathMLMathElement |
getOwnerMathElement()
The MathMLMathElement corresponding to the nearest math element ancestor of this element. |
JEuclidElement |
getParent()
Returns parent of this element. |
String |
getText()
Returns the text content of this element. |
String |
getXref()
The xref attribute of the element. |
boolean |
hasChildPostscripts(JEuclidElement child,
LayoutContext context)
returns true is the child has postscripts attached to it. |
boolean |
hasChildPrescripts(JEuclidElement child)
returns true is the child has prescripts attached to it. |
void |
layoutStage1(LayoutView view,
LayoutInfo info,
LayoutStage childMinStage,
LayoutContext context)
context insensitive layout. |
void |
layoutStage2(LayoutView view,
LayoutInfo info,
LayoutContext context)
context sensitive layout. |
protected void |
layoutStageInvariant(LayoutView view,
LayoutInfo info,
LayoutStage stage,
LayoutContext context)
Layout for elements which are stage independent. |
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 |
setHref(String href)
setter for the href attribute. |
void |
setId(String id)
setter for the id attribute. |
void |
setMathbackground(String mathbackground)
Sets the value of the machbackground attribute. |
void |
setMathcolor(String mathcolor)
Sets value of math color attribute. |
protected 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 |
setXref(String xref)
setter for the xref attribute. |
Methods inherited from class org.apache.batik.dom.GenericElementNS |
---|
copyInto, deepCopyInto, deepExport, export, getNodeName, isReadonly, newNode, setNodeName, setReadonly |
Methods inherited from class org.apache.batik.dom.AbstractElementNS |
---|
getNamespaceURI |
Methods inherited from class org.apache.batik.dom.AbstractParentChildNode |
---|
getNextSibling, getParentNode, getPreviousSibling, setNextSibling, setParentNode, setPreviousSibling |
Methods inherited from class org.apache.batik.dom.AbstractParentNode |
---|
appendChild, checkAndRemove, fireDOMNodeInsertedEvent, fireDOMNodeInsertedIntoDocumentEvent, fireDOMNodeRemovedEvent, fireDOMNodeRemovedFromDocumentEvent, fireDOMSubtreeModifiedEvent, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getLastChild, getTextContent, hasChildNodes, insertBefore, removeChild, replaceChild |
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.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 |
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 int TRIVIAL_SPACE_MAX
public static final String URI
Constructor Detail |
---|
public AbstractJEuclidElement(String qname, AbstractDocument odoc)
qname
- Qualified name.odoc
- Owner Document.public AbstractJEuclidElement(String nsUri, String qname, AbstractDocument odoc)
nsUri
- Namespace URI.qname
- Qualified name.odoc
- Owner Document.Method Detail |
---|
public Font getFont(LayoutContext context)
context
- LayoutContext to use.
public MathVariant getMathvariantAsVariant()
getMathvariantAsVariant
in interface JEuclidElement
public final void addMathElement(MathMLElement child)
child
- Math element object.protected JEuclidElement getMathElement(int index)
Please note, that unlike the MathML DOM model functions this function uses a 0-based index.
index
- Index of the child (0-based).
protected void setMathElement(int index, MathMLElement newElement)
index
- the index to set (0=the first child)newElement
- new element to be set as child.public int getIndexOfMathElement(JEuclidElement element)
getIndexOfMathElement
in interface JEuclidElement
element
- Child element.
public int getMathElementCount()
getMathElementCount
in interface JEuclidElement
public String getText()
public void setFakeParent(JEuclidElement parent)
setFakeParent
in interface JEuclidElement
parent
- Parent elementpublic JEuclidElement getParent()
getParent
in interface JEuclidElement
public void setMathvariant(String mathvariant)
mathvariant
- Value of mathvariant.public String getMathvariant()
public FontMetrics getFontMetrics(Graphics2D g, LayoutContext context)
context
- LayoutContext to use.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.protected void setDefaultMathAttribute(String key, String value)
key
- the attribute to set.value
- value of the attribute.protected String getMathAttribute(String attrName)
attrName
- the name of the attribute
getMathAttribute(String, boolean)
protected String getMathAttribute(String attrName, boolean useDefault)
attrName
- the name of the attributeuseDefault
- is true, the default value is used if the attribute is not
set.
getMathAttribute(String)
public String getMathbackground()
public void setMathbackground(String mathbackground)
mathbackground
- a string to be used as background color.public float getMiddleShift(Graphics2D g, LayoutContext context)
context
- Layout Context to useg
- Graphics2D context to use.
public String getClassName()
getClassName
in interface MathMLElement
public void setClassName(String className)
setClassName
in interface MathMLElement
className
- new value for className.MathMLElement.getClassName()
public String getMathElementStyle()
getMathElementStyle
in interface MathMLElement
public void setMathElementStyle(String mathElementStyle)
setMathElementStyle
in interface MathMLElement
mathElementStyle
- new value for mathElementStyle.MathMLElement.getMathElementStyle()
public String getId()
getId
in interface MathMLElement
getId
in class AbstractElement
public void setId(String id)
setId
in interface MathMLElement
id
- new value for id.MathMLElement.getId()
public String getXref()
getXref
in interface MathMLElement
public void setXref(String xref)
setXref
in interface MathMLElement
xref
- new value for xref.MathMLElement.getXref()
public String getHref()
getHref
in interface MathMLElement
public void setHref(String href)
setHref
in interface MathMLElement
href
- new value for href.MathMLElement.getHref()
public MathMLMathElement getOwnerMathElement()
getOwnerMathElement
in interface MathMLElement
public boolean hasChildPrescripts(JEuclidElement child)
hasChildPrescripts
in interface JEuclidElement
child
- child to test
public boolean hasChildPostscripts(JEuclidElement child, LayoutContext context)
hasChildPostscripts
in interface JEuclidElement
child
- child to testcontext
- current layout context.
public MathMLNodeList getContents()
public LayoutContext getChildLayoutContext(int childNum, LayoutContext context)
getChildLayoutContext
in interface JEuclidNode
childNum
- 0-based number of the child to check.context
- external context.
public LayoutContext applyLocalAttributesToContext(LayoutContext context)
context
- external context.
public List<LayoutableNode> getChildrenToLayout()
getChildrenToLayout
in interface LayoutableNode
public List<LayoutableNode> getChildrenToDraw()
getChildrenToDraw
in interface LayoutableNode
protected void layoutStageInvariant(LayoutView view, LayoutInfo info, LayoutStage stage, LayoutContext context)
This function will layout an element which is layed out the same no matter what stage it is in. This is the case for most elements.
Notable exceptions are mo and tables.
view
- View Object for this layout.info
- An info object which will be filled during layout.stage
- current layout stage.context
- current LayoutContext.public void layoutStage1(LayoutView view, LayoutInfo info, LayoutStage childMinStage, LayoutContext context)
layoutStage1
in interface LayoutableNode
view
- LayoutView to use.info
- LayoutInfo to manipulate.childMinStage
- minimum stage of children. Either STAGE1 or STAGE2.context
- LayoutContext for this element.public void layoutStage2(LayoutView view, LayoutInfo info, LayoutContext context)
layoutStage2
in interface LayoutableNode
view
- LayoutView to use.info
- LayoutInfo to manipulate.context
- LayoutContext for this element.protected void changeHook()
public boolean dispatchEvent(Event evt)
dispatchEvent
in interface NodeEventTarget
dispatchEvent
in interface EventTarget
dispatchEvent
in class AbstractNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |