TResult - The type of the result this element will provide @author Xyanid on 28.10.2015.public abstract class SVGElementBase<TResult> extends ElementBase<SVGDataProvider,TResult,SVGElementBase<?>>
| Modifier and Type | Class and Description |
|---|---|
static class |
SVGElementBase.CoreAttribute
Contains the core attributes each svg element may have.
|
static class |
SVGElementBase.Matrix
Determines which keyword in a transform attribute of a matrix map to their corresponding javafx classes.
|
static class |
SVGElementBase.XLinkAttribute
Contains the xlink attributes each svg element may have.
|
| Constructor and Description |
|---|
SVGElementBase(String name,
Attributes attributes,
SVGElementBase<?> parent,
SVGDataProvider dataProvider)
Creates a new instance of he element using the given attributes, parent and dataProvider.
|
| Modifier and Type | Method and Description |
|---|---|
TResult |
createAndInitializeResult()
Creates a result represented by this element.
|
TResult |
createAndInitializeResult(SVGCssStyle style)
Creates a result represented by this element and uses the given supplier in order to fetch data needed to initialize the result
|
protected abstract TResult |
createResult(SVGCssStyle style)
Must be overwritten in the actual implementation to create a new result for this element based on the
information available.
|
void |
endProcessing()
Will be called when the end of the element was been reached and thus the processing is finished.
|
javafx.scene.Node |
getClipPath()
Encapsulate a call to
getClipPath(SVGCssStyle) using the getCssStyleAndResolveInheritance() as the style. |
javafx.scene.Node |
getClipPath(SVGCssStyle style)
Returns a node which represents the clip path to be applied to this element.
|
SVGCssStyle |
getCssStyle()
Returns the
SVGCssStyle of this element. |
SVGCssStyle |
getCssStyleAndResolveInheritance()
Gets the elements own
SVGCssStyle and combines it with the SVGCssStyle or the parent if there one. |
SVGCssStyle |
getCssStyleAndResolveInheritance(SVGCssStyle otherStyle)
Gets the elements own
SVGCssStyle and combines it with the givne SVGCssStyle |
SVGCssStyle |
getOwnStyle()
Gets the elements own
SVGCssStyle, which will only be available if the element has the SVGElementBase.CoreAttribute.STYLE. |
SVGCssStyle |
getPresentationCssStyle()
This method attempts to create a
SVGCssStyle by looking up all the supported SVGCssStyle.PresentationAttribute. |
SVGCssStyle |
getReferencedStyle()
Gets the elements referenced
SVGCssStyle, which will only be available if the element has the SVGElementBase.CoreAttribute.CLASS. |
TResult |
getResult()
Returns the result for the current element.
|
TResult |
getResult(SVGCssStyle style)
Gets the result if its was not yet created using the given
SVGCssStyle to create the styling. |
javafx.scene.transform.Transform |
getTransformation() |
protected abstract void |
initializeResult(TResult result,
SVGCssStyle style)
This method will be called in the
createAndInitializeResult(SVGCssStyle) and allows to modify the result such as applying a style or transformations. |
void |
processCharacterData(char[] ch,
int start,
int length)
Will be called when character data (CDATA) is read for an element.
|
void |
startProcessing()
Will be called when an element is started that represents this element.
|
getAttribute, getAttributes, getChildren, getDataProvider, getName, getParent, toStringpublic SVGElementBase(String name, Attributes attributes, SVGElementBase<?> parent, SVGDataProvider dataProvider) throws IllegalArgumentException
name - value of the elementattributes - attributes of the elementparent - parent of the elementdataProvider - dataprovider to be usedIllegalArgumentException - if either value or dataProvider are nullprotected abstract TResult createResult(SVGCssStyle style) throws SVGException
style - the element to use when data is needed.SVGException - will be thrown when an error during creation occursprotected abstract void initializeResult(TResult result, SVGCssStyle style) throws SVGException
createAndInitializeResult(SVGCssStyle) and allows to modify the result such as applying a style or transformations.
The given inheritanceResolver should be used to retrieve such data, this simply is needed because some elements can actually be referenced e.g. SVGUse and their actual parent is not
the one from which the inherited style attributes can be retrieved.result - the result which should be modified.style - the SVGCssStyle to use when data is needed.SVGException - will be thrown when an error during modificationpublic final SVGCssStyle getCssStyleAndResolveInheritance()
SVGCssStyle and combines it with the SVGCssStyle or the parent if there one.SVGCssStyle if this element combined and resolved with the parents SVGCssStyle if a parents exits.public final SVGCssStyle getCssStyleAndResolveInheritance(SVGCssStyle otherStyle)
SVGCssStyle and combines it with the givne SVGCssStyleotherStyle - the other SVGCssStyle the own style shall be combined with, can be null in which case SVGUtils.combineStylesAndResolveInheritance(SVGCssStyle, SVGCssStyle)
is not invoked, hence it will only return its own style.SVGCssStyle if this element combined and resolved with the given SVGCssStyle.public final SVGCssStyle getCssStyle()
SVGCssStyle of this element. Since an element can contain a SVGCssStyle.PresentationAttributes, an own SVGCssStyle or a
reference to an existing SVGCssStyle there need to be a rule how the SVGCssStyle is build. The rule is as follows:
SVGCssStyle.PresentationAttributes are preferred if they are present and will overwrite existing attribute of an own
SVGCssStyle or a referenced SVGCssStyle. The following example shows an element which has two
SVGCssStyle.PresentationAttributes and an own SVGCssStyle.
e.G.
circle fill="none" stroke="#808080" style="fill:#111111; stroke:#001122 fill-rule:odd"
this will result in fill = none, stroke = #808080 and fill-rule = odd. The same behavior is to be expected if the SVGCssStyle would be a reference e.g.
e.G.
.st1{fill:#111111; stroke:#001122 fill-rule:odd}
circle fill="none" stroke="#808080" class="st1"
An own SVGCssStyle is always preferred before a referenced SVGCssStyle and will overwrite existing attributes just as a
SVGCssStyle.PresentationAttribute would. The following example shows an element which has an own
SVGCssStyle and a reference to a SVGCssStyle.
e.G.
.st1{fill:none; stroke:#808080 fill-rule:odd}
circle style="fill:#111111; stroke:#001122" class="st1"
this will result in fill = 111111, stroke = #001122 and fill-rule = odd.SVGCssStyle of this element or null if no style can be determined.public final SVGCssStyle getOwnStyle()
SVGCssStyle, which will only be available if the element has the SVGElementBase.CoreAttribute.STYLE.SVGCssStyle of this element or null if there is none.public final SVGCssStyle getReferencedStyle() throws SVGException
SVGCssStyle, which will only be available if the element has the SVGElementBase.CoreAttribute.CLASS.SVGCssStyle referenced by this element or null if there is none.SVGException - if the element uses a style reference but the style was not found in the ElementBase.dataProvider.public final SVGCssStyle getPresentationCssStyle()
SVGCssStyle by looking up all the supported SVGCssStyle.PresentationAttribute. If any attribute is present a
valid
cssString is returned.SVGCssStyle containing the SVGCssStyle.PresentationAttributes of this element if any or null if not attributes are submitted.
SVGCssStyle.PresentationAttribute exists.public final javafx.scene.transform.Transform getTransformation()
throws SVGException
SVGElementBase.CoreAttribute.TRANSFORM is present.
otherwise null.SVGException - if there is a transformation which has invalid data for its matrix.public final javafx.scene.Node getClipPath()
throws SVGException
getClipPath(SVGCssStyle) using the getCssStyleAndResolveInheritance() as the style.SVGException - when there is a SVGClipPath referenced but the reference can not be found in the ElementBase.dataProvider.public final javafx.scene.Node getClipPath(SVGCssStyle style) throws SVGException
style - the SVGCssStyle which is used when inherited style attributes are to be resolvedSVGException - when there is a SVGClipPath referenced but the reference can not be found in the ElementBase.dataProvider.IllegalArgumentException - if the referenced SVGClipPath is an empty string.public final TResult getResult(SVGCssStyle style) throws SVGException
SVGCssStyle to create the styling.style - the SVGCssStyle which will be used in order to get data for styling.SVGException - if something fails during the creation of the elementpublic final TResult createAndInitializeResult() throws SVGException
SVGException - thrown when an exception during creation occurs.public final TResult createAndInitializeResult(SVGCssStyle style) throws SVGException
style - the SVGCssStyle to use when data is needed.SVGException - thrown when an exception during creation occurs.public final TResult getResult() throws SVGException
getResult in class ElementBase<SVGDataProvider,TResult,SVGElementBase<?>>SVGExceptionpublic void startProcessing()
throws SVGException
startProcessing in class ElementBase<SVGDataProvider,TResult,SVGElementBase<?>>SVGExceptionpublic void processCharacterData(char[] ch,
int start,
int length)
throws SVGException
processCharacterData in class ElementBase<SVGDataProvider,TResult,SVGElementBase<?>>ch - The characters.start - The start position in the character array.length - The number of characters to use from the
character array.SVGExceptionpublic void endProcessing()
throws SVGException
endProcessing in class ElementBase<SVGDataProvider,TResult,SVGElementBase<?>>SVGExceptionCopyright © 2016 Saxonia Systems AG. All rights reserved.