Methods Summary |
---|
com.sun.perseus.j2d.Box | addNodeBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t)
checkLayout();
return addNodeBBox(bbox, t, firstChunk);
|
com.sun.perseus.j2d.Box | addNodeBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t, GlyphLayout fc)
GlyphLayout c = fc;
while (c != null) {
ownerDocument.bboxChunkTxf.setTransform(t);
c.applyTransform(this, ownerDocument.bboxChunkTxf);
bbox = c.addBBox(bbox, ownerDocument.bboxChunkTxf);
c = c.nextSibling;
}
return bbox;
|
public void | appendTextChild(java.lang.String text)
if (text == null || text.length() == 0) {
return;
}
if (content == null) {
setContent(text);
} else {
setContent(content + text);
}
|
protected int | applyXMLSpace(char[] s)Applies the xml:space policy
switch (getXMLSpace()) {
case XML_SPACE_DEFAULT:
case XML_SPACE_INHERIT:
return applyXMLSpaceDefault(s);
default:
return applyXMLSpacePreserve(s);
}
|
protected int | applyXMLSpaceDefault(char[] s)Applies the xml:space="default" policy
** SPECIFICATION TEXT, SECTION 10.15 **
When xml:space="default", the SVG user agent will do
the following using a copy of the original character
data content. First, it will remove all newline characters.
Then it will convert all tab characters into space characters.
Then, it will strip off all leading and trailing space
characters. Then, all contiguous space characters will be
consolidated
int j = 0;
// Remove newline characters and
// convert tabs to white spaces.
// Output to s.
int i = 0;
for (; i < s.length; i++) {
if (s[i] != '\n") {
if (s[i] == '\t") {
s[i] = ' ";
}
s[j++] = s[i];
}
}
int length = j;
// Now, consolidate white spaces
// Trim leading spaces
for (i = 0; i < length; i++) {
if (s[i] != ' ") {
break;
}
}
// Consolidate spaces
j = 0;
s[j++] = s[i++];
for (; i < length; i++) {
// Keep all non-space characters
if (s[i] != ' ") {
s[j++] = s[i];
} else {
// Only keep space character if
// previous character is not a ' '
if (s[j - 1] != ' ") {
s[j++] = ' ";
}
}
}
// Trim trailing space
length = j;
if (s[j - 1] == ' ") {
length = j - 1;
}
return length;
|
protected int | applyXMLSpacePreserve(char[] s)Applies the xml:space="preserve" policy
** SPECIFICATION TEXT, SECTION 10.15 **
When xml:space="preserve", the SVG user agent will do the
following using a copy of the original character data content.
It will convert all newline and tab characters into space
characters. Then, it will draw all space characters, including
leading, trailing and multiple contiguous space characters.
Thus, when drawn with xml:space="preserve", the string "a b"
(three spaces between "a" and "b") will produce a
larger separation between "a" and "b" than "a b" (one space
between "a" and "b").
for (int i = 0; i < s.length; i++) {
if (s[i] == '\n" || s[i] == '\t") {
s[i] = ' ";
}
}
return s.length;
|
ElementNodeProxy | buildProxy()
return new TextProxy(this);
|
void | checkLayout()Checks that the text's layout has been computed and computes it in
case it was not.
if (firstChunk == null) {
firstChunk = layoutText(this);
GlyphLayout cur = firstChunk;
while (cur.nextSibling != null) {
cur = cur.nextSibling;
}
lastChunk = (GlyphLayout) cur;
}
|
protected void | clearLastRenderedTile()After calling this method, getLastRenderedTile should always return null.
renderingManager.clearLastRenderedTile();
|
public void | clearLayouts()Clears all cached layout information. Because the computed transform
property on text depends on the layout, clearLayouts on Text
also clears the transform and property cache.
clearLayouts(true);
|
protected void | clearLayouts(boolean notif)Implementations. Clears layouts but does not generate a
modification notification.
if (notif) {
modifyingNode();
}
clearLayoutsQuiet();
if (notif) {
modifiedNode();
}
|
protected void | clearLayoutsQuiet()Clears all cached layout information
but does not generate modification
events for this node.
firstChunk = null;
lastChunk = null;
//
// Now, clear the proxies layouts
//
ElementNodeProxy p = firstProxy;
while (p != null) {
((TextProxy) p).clearLayoutsQuiet();
p = p.nextProxy;
}
|
protected void | computeRenderingTile(com.sun.perseus.j2d.Tile tile)This method is overridden for elements which has special renderings,
such as the ShapeNodes.
checkLayout();
computeRenderingTile(tile, txf, this, firstChunk);
|
protected final void | computeRenderingTile(com.sun.perseus.j2d.Tile tile, com.sun.perseus.j2d.Transform t, com.sun.perseus.j2d.TextRenderingProperties trp, GlyphLayout fc)The rendering tile of a Text node is the union of the rendering tile of
its layouts.
GlyphLayout gl = fc;
Tile glt = null;
while (gl != null) {
ownerDocument.bboxChunkTxf.setTransform(t);
gl.applyTransform(trp, ownerDocument.bboxChunkTxf);
glt = gl.addRenderingTile(glt, trp, ownerDocument.bboxChunkTxf);
gl = (GlyphLayout) gl.nextSibling;
}
if (glt != null) {
tile.setTile(glt);
} else {
tile.setEmptyTile();
}
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_ROTATE_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else if (SVGConstants.SVG_TEXT_PSEUDO_ATTRIBUTE == traitName) {
return new StringTraitAnim(this, NULL_NS, traitName);
} else {
return super.createTraitAnimImpl(traitName);
}
|
void | drawText(com.sun.perseus.j2d.RenderGraphics rg, com.sun.perseus.j2d.Transform tx, GlyphLayout fc)Draws text.
GlyphLayout c = fc;
while (c != null) {
ownerDocument.paintChunkTxf.setTransform(tx);
c.applyTransform(rg, ownerDocument.paintChunkTxf);
c.drawText(rg, ownerDocument.paintChunkTxf);
c = c.nextSibling;
}
|
void | fillText(com.sun.perseus.j2d.RenderGraphics rg, com.sun.perseus.j2d.Transform tx, GlyphLayout fc)Fills text.
GlyphLayout c = fc;
while (c != null) {
ownerDocument.paintChunkTxf.setTransform(tx);
c.applyTransform(rg, ownerDocument.paintChunkTxf);
c.fillText(rg, ownerDocument.paintChunkTxf);
c = c.nextSibling;
}
|
public org.w3c.dom.svg.SVGRect | getBBox()
return addNodeBBox(null, null);
|
public java.lang.String | getContent()
return content;
|
float | getFloatTraitImpl(java.lang.String name)Text handles x, y float traits.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return getX()[0];
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return getY()[0];
} else {
return super.getFloatTraitImpl(name);
}
|
protected com.sun.perseus.j2d.Tile | getLastRenderedTile()
return renderingManager.getLastRenderedTile();
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_TEXT_TAG;
|
public boolean | getPaintNeedsLoad()
return true;
|
protected com.sun.perseus.j2d.Tile | getRenderingTile()
return renderingManager.getRenderingTile();
|
public float[] | getRotate()
return rotate;
|
public org.w3c.dom.svg.SVGRect | getScreenBBox()
// There is no screen bounding box if the element is not hooked
// into the main tree.
if (!inDocumentTree()) {
return null;
}
return addNodeBBox(null, txf);
|
public java.lang.String | getTraitImpl(java.lang.String name)Text handles x, y, and #text traits.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return toStringTrait(getX());
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return toStringTrait(getY());
} else if (SVGConstants.SVG_ROTATE_ATTRIBUTE == name) {
if (rotate == null) {
return "";
}
/*
float[] rt = new float[rotate.length];
for (int i = 0; i < rt.length; i++) {
rt[i] = MathSupport.toDegrees(rotate[i]);
}
*/
System.err.println(">>>>>>>>>>>>>>>>>> getTraitImpl("
+ name + ") : '"
+ toStringTrait(rotate) + "'");
return toStringTrait(rotate);
} else if (SVGConstants.SVG_TEXT_PSEUDO_ATTRIBUTE == name) {
if (content == null) {
return "";
}
return getContent();
} else {
return super.getTraitImpl(name);
}
|
public float[] | getX()
return x;
|
public float[] | getY()
return y;
|
public boolean | hasDescendants()
return super.hasDescendants()
||
content != null && !("".equals(content));
|
public boolean | hasNodeRendering()An Text has something to render
return true;
|
protected boolean | isHitVP(float[] pt, com.sun.perseus.j2d.TextRenderingProperties trp, com.sun.perseus.j2d.Transform itx, GlyphLayout lc)Returns true if this node is hit by the input point. The input point
is in viewport space. By default, a node is not hit, not
matter what the input coordinate is.
// Node has to be visible to be a hit target
if (!trp.getVisibility()) {
return false;
}
GlyphLayout c = lc;
while (c != null) {
// Initialize hitChunkTransform to be from viewport space to the
// chunk's user space. This is why we apply the inverse transform
// second and why we invoke applyInverseTransform on the GlyphLayout
// instance.
ownerDocument.hitChunkTxf.setTransform(1, 0, 0, 1, 0, 0);
c.applyInverseTransform(trp, ownerDocument.hitChunkTxf);
ownerDocument.hitChunkTxf.mMultiply(itx);
if (c.isHitVP(pt, this, ownerDocument.hitChunkTxf)) {
return true;
}
c = c.prevSibling;
}
return false;
|
public GlyphLayout | layoutText(com.sun.perseus.j2d.TextProperties tp)Invoked when text layout should be performed
or checked.
// There is always at least one, possibly empty
// text chunk.
GlyphLayout startChunk = new GlyphLayout(ownerDocument);
GlyphLayout chunk = startChunk;
chunk.x = x[0];
chunk.y = y[0];
// Stop now if there is not actual content
if (content == null || "".equals(content)) {
return startChunk;
}
// Take care of white space handling
char[] s = content.toCharArray();
int length = applyXMLSpace(s);
// First, build the list of font faces which match the font properties
// for this text node. FontFace resolution is done through the root
// node element which holds the FontFace data base.
FontFace.Match defaultMatch = ownerDocument.resolveFontFaces(tp);
FontFace.Match firstMatch = defaultMatch.next;
FontFace.Match curMatch = null;
Glyph missingGlyph = defaultMatch.fontFace.getMissingGlyph();
// Now, for each character in the content string, find a matching
// font. The fontFace that matches can match up to n characters.
int cur = 0; // Current index in character array 's'
Glyph glyph = null;
GlyphProxy proxy = null, prevProxy = null;
float curAdv = 0;
float fontSize = tp.getFontSize();
while (cur < length) {
// =================================================================
// Check if we need to create a new text chunk
if (cur > 0 && (cur < x.length || cur < y.length)) {
// Create a new chunk. The current chunk becomes the
// previous chunk.
GlyphLayout prevChunk = chunk;
chunk = new GlyphLayout(ownerDocument);
prevProxy = null;
// We have finished computing the advance of
// the now previous chunk
prevChunk.advance = curAdv;
curAdv = 0;
if (cur < x.length) {
chunk.x = x[cur];
} else {
chunk.x = prevChunk.x + fontSize * prevChunk.advance;
}
if (cur < y.length) {
chunk.y = y[cur];
} else {
chunk.y = prevChunk.y;
}
// Chain the new chunk with the previous one
prevChunk.nextSibling = chunk;
chunk.prevSibling = prevChunk;
}
// =================================================================
// Find a matching glyph or default to the missing glyph.
glyph = null;
curMatch = firstMatch;
while (curMatch != null) {
if ((glyph = curMatch.fontFace.canDisplay(s, cur))
!=
null) {
break;
}
curMatch = curMatch.next;
}
if (glyph == null) {
if ((glyph = defaultMatch.fontFace.canDisplay(s, cur))
==
null) {
glyph = missingGlyph;
}
}
// Create a proxy for the glyph
proxy = new GlyphProxy(glyph);
// =================================================================
// Add the proxy to the current text chunk
chunk.add(proxy);
// Account for kerning, only if the previous glyph is part of
// the same text chunk.
if (prevProxy != null) {
float adjust =
((Font) proxy.proxied.parent)
.getHKern(prevProxy.proxied,
proxy.proxied);
curAdv -= adjust;
}
proxy.setX(curAdv);
if (rotate != null && cur < rotate.length) {
// The rotation is in the text coordinate system
proxy.setRotate(rotate[cur]);
}
cur += glyph.getLength();
// Increment the advance *in the text coordinate system*.
//
// IMPORTANT NOTE: it is very important to use the
// glyph's advance in the text coordinate space. It
// is not possible to work in the em square coordinate
// space for the advance because the em square may be
// different for each glyph in the text string (when
// different fonts are used).
curAdv += glyph.getTextHorizontalAdvanceX();
prevProxy = proxy;
}
chunk.advance = curAdv;
return startChunk;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype Text .
return new Text(doc);
|
public ModelNode | nodeHitAt(float[] pt)Returns the ModelNode , if any, hit by the
point at coordinate x/y.
// If a node does not render, it is never hit
if (canRenderState != 0) {
return null;
}
checkLayout();
if (isHitVP(pt, this, getInverseTransformState(), lastChunk)) {
return this;
}
return null;
|
void | nodeHookedInDocumentTree()To be overriddent by derived classes, such as TimedElementNode,
if they need to perform special operations when hooked into the
document tree.
super.nodeHookedInDocumentTree();
renderingDirty();
|
protected void | nodeRendered()Simply notifies the RenderingManager.
if (DirtyAreaManager.ON) {
renderingManager.rendered();
}
|
void | nodeUnhookedFromDocumentTree()To be overriddent by derived classes, such as TimedElementNode,
if they need to perform special operations when unhooked from the
document tree.
super.nodeUnhookedFromDocumentTree();
renderingDirty();
|
public void | paint(com.sun.perseus.j2d.RenderGraphics rg)Paints this node into the input RenderGraphics . A
Text node renders its associated GlyphLayout
children.
if (canRenderState != 0) {
return;
}
checkLayout();
if (DirtyAreaManager.ON) {
Tile primitiveTile = getRenderingTile();
if (primitiveTile == null
||
rg.getRenderingTile().isHit(primitiveTile)) {
// rg.setPrimitiveTile(primitiveTile);
paintRendered(rg, this, txf, firstChunk);
// nodeRendered is called seperately from paintRendered
// because paintRendered is used in different contexts,
// for example by proxy nodes to render, using their
// proxied node's paintRendered method.
nodeRendered();
}
} else {
paintRendered(rg, this, txf, firstChunk);
}
|
public void | paintRendered(com.sun.perseus.j2d.RenderGraphics rg, com.sun.perseus.j2d.TextRenderingProperties trc, com.sun.perseus.j2d.Transform tx, GlyphLayout fc)Paints this node into the input RenderGraphics, assuming the node
is rendered.
if (!trc.getVisibility()) {
return;
}
rg.setPaintTarget(this);
rg.setPaintTransform(tx);
rg.setFontSize(trc.getFontSize());
rg.setTextAnchor(trc.getTextAnchor());
// Fill text. Only apply the fill properties
if (trc.getFill() != null) {
rg.setFillRule(trc.getFillRule());
rg.setFill(trc.getFill());
rg.setFillOpacity(trc.getFillOpacity());
fillText(rg, tx, fc);
}
// Stroke text. Only apply the stroke properties
if (trc.getStroke() != null) {
// We divide the strokeWidth by the fontSize to account
// for the additional scale factor (by fontSize). The
// additional scale factor is applied when rendering
// GlyphLayouts.
// See #GlyphLayout.applyTransform
rg.setStrokeWidth(trc.getStrokeWidth() / trc.getFontSize());
// do the same for dashArray and dashOffset if necessary
float[] dashArray = trc.getStrokeDashArray();
float[] trDashArray = null;
float trDashOffset = 0;
if (dashArray != null) {
float fontSize = trc.getFontSize();
if ((helperDashArray == null) ||
(helperDashArray.length != dashArray.length)) {
helperDashArray = new float[dashArray.length];
}
trDashArray = helperDashArray;
for (int i = 0; i < dashArray.length; ++i) {
trDashArray[i] = dashArray[i] / fontSize;
}
trDashOffset = trc.getStrokeDashOffset() / fontSize;
}
rg.setStrokeDashArray(trDashArray);
rg.setStrokeDashOffset(trDashOffset);
rg.setStroke(trc.getStroke());
rg.setStrokeOpacity(trc.getStrokeOpacity());
rg.setStrokeLineCap(trc.getStrokeLineCap());
rg.setStrokeLineJoin(trc.getStrokeLineJoin());
rg.setStrokeMiterLimit(trc.getStrokeMiterLimit());
drawText(rg, tx, fc);
}
|
protected void | propagateFloatPropertyState(int propertyIndex, float parentPropertyValue)Called when the computed value of the given float property has changed.
As we do not render any text children, this does not propage changes any
further.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy)
.proxiedFloatPropertyStateChange(propertyIndex,
parentPropertyValue);
proxy = proxy.nextProxy;
}
}
|
protected void | propagatePackedPropertyState(int propertyIndex, int parentPropertyValue)Called when the computed value of the given packed property has changed.
As we do not render any text children, this does not propage changes any
further.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy)
.proxiedPackedPropertyStateChange(propertyIndex,
parentPropertyValue);
proxy = proxy.nextProxy;
}
}
|
protected void | propagatePropertyState(int propertyIndex, java.lang.Object parentPropertyValue)Called when the computed value of the given property has changed.
As we do not render any text children, this does not propage changes any
further.
// Propagate to proxies.
if (firstProxy != null) {
ElementNodeProxy proxy = firstProxy;
while (proxy != null) {
((CompositeGraphicsNodeProxy) proxy).proxiedPropertyStateChange(
propertyIndex, parentPropertyValue);
proxy = proxy.nextProxy;
}
}
|
ModelNode | proxyNodeHitAt(float[] pt, ElementNodeProxy proxy)Returns the ModelNode , if any, hit by the
point at coordinate x/y in the proxy tree starting at
proxy.
// If a node does not render, it is never hit
if (canRenderState != 0) {
return null;
}
TextProxy tp = (TextProxy) proxy;
tp.checkLayout();
if (isHitVP(pt, tp, tp.inverseTxf, tp.lastChunk)) {
return proxy;
}
return null;
|
protected void | recomputeTransformState(com.sun.perseus.j2d.Transform parentTransform)Recomputes the transform cache, if one exists.
txf = appendTransform(parentTransform, txf);
computeCanRenderTransformBit(txf);
inverseTxf = null;
// inverseTxf = computeInverseTransform(txf, parentTransform,
// inverseTxf);
renderingDirty();
|
final void | renderingDirty()Should be called whenever this node's rendering becomes dirty.
if (DirtyAreaManager.ON) {
renderingManager.dirty();
}
|
void | setComputedDisplay(boolean newDisplay)
super.setComputedDisplay(newDisplay);
renderingDirty();
|
void | setComputedFill(com.sun.perseus.j2d.PaintServer newFill)
this.fill = newFill;
renderingDirty();
|
void | setComputedFillOpacity(float newFillOpacity)
super.setComputedFillOpacity(newFillOpacity);
if (fill != null) {
renderingDirty();
}
|
void | setComputedFontFamily(java.lang.String[] newFontFamily)
this.fontFamily = newFontFamily;
clearLayoutsQuiet();
if (stroke != null || fill != null) {
renderingDirty();
}
|
void | setComputedFontSize(float newFontSize)
this.fontSize = newFontSize;
if (stroke != null || fill != null) {
renderingDirty();
}
computeCanRenderFontSizeBit(newFontSize);
|
void | setComputedFontStyle(int newFontStyle)
super.setComputedFontStyle(newFontStyle);
clearLayoutsQuiet();
if (stroke != null || fill != null) {
renderingDirty();
}
|
void | setComputedFontWeight(int newFontWeight)
super.setComputedFontWeight(newFontWeight);
clearLayoutsQuiet();
if (stroke != null || fill != null) {
renderingDirty();
}
|
void | setComputedStroke(com.sun.perseus.j2d.PaintServer newStroke)
this.stroke = newStroke;
renderingDirty();
|
void | setComputedStrokeDashArray(float[] newStrokeDashArray)
strokeDashArray = newStrokeDashArray;
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeDashOffset(float newStrokeDashOffset)
strokeDashOffset = newStrokeDashOffset;
if (stroke != null && strokeDashArray != null) {
renderingDirty();
}
|
void | setComputedStrokeLineCap(int newStrokeLineCap)
super.setComputedStrokeLineCap(newStrokeLineCap);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeLineJoin(int newStrokeLineJoin)
super.setComputedStrokeLineJoin(newStrokeLineJoin);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeMiterLimit(float newStrokeMiterLimit)
strokeMiterLimit = newStrokeMiterLimit;
if (stroke != null && getStrokeLineJoin() == JOIN_MITER) {
renderingDirty();
}
|
void | setComputedStrokeOpacity(float newStrokeOpacity)
super.setComputedStrokeOpacity(newStrokeOpacity);
if (stroke != null) {
renderingDirty();
}
|
void | setComputedStrokeWidth(float newStrokeWidth)
strokeWidth = newStrokeWidth;
// Only dirty rendering if the object is actually stroked.
if (stroke != null) {
renderingDirty();
}
|
void | setComputedTextAnchor(int newTextAnchor)Sets the value of the computed text anchor property.
super.setComputedTextAnchor(newTextAnchor);
if (stroke != null || fill != null) {
renderingDirty();
}
|
void | setComputedVisibility(boolean newVisibility)
super.setComputedVisibility(newVisibility);
renderingDirty();
|
public void | setContent(java.lang.String newContent)
if (equal(newContent, content)) {
return;
}
modifyingNode();
this.content = newContent;
clearLayouts(false);
modifiedNode();
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(toTraitFloatArray(value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(toTraitFloatArray(value));
} else if (SVGConstants.SVG_ROTATE_ATTRIBUTE == name) {
setRotate(toTraitFloatArray(value));
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)Text handles x, y float traits.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(new float[] {value});
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(new float[] {value});
} else {
super.setFloatTraitImpl(name, value);
}
|
public void | setRotate(float[] newRotate)
if (equal(newRotate, rotate)) {
return;
}
modifyingNode();
this.rotate = newRotate;
clearLayoutsQuiet();
modifiedNode();
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)Text handles x, y and #text traits.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(parseFloatArrayTrait(name, value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(parseFloatArrayTrait(name, value));
} else if (SVGConstants.SVG_ROTATE_ATTRIBUTE == name) {
float[] rt = parseFloatArrayTrait(name, value);
/*
if (rt != null) {
for (int i = 0; i < rt.length; i++) {
rt[i] = MathSupport.toRadians(rt[i]);
}
}
*/
setRotate(rt);
} else if (SVGConstants.SVG_TEXT_PSEUDO_ATTRIBUTE == name) {
if (value == null) {
throw illegalTraitValue(name, value);
}
setContent(value);
} else {
super.setTraitImpl(name, value);
}
|
public void | setX(float[] newX)
if (equal(newX, x)) {
return;
}
modifyingNode();
if (newX == null || newX.length == 0) {
this.x = new float[1];
this.x[0] = 0;
} else {
this.x = newX;
}
clearLayoutsQuiet();
renderingDirty();
modifiedNode();
|
public void | setY(float[] newY)
if (equal(newY, y)) {
return;
}
modifyingNode();
if (newY == null || newY.length == 0) {
this.y = new float[1];
this.y[0] = 0;
} else {
this.y = newY;
}
clearLayoutsQuiet();
renderingDirty();
modifiedNode();
|
boolean | supportsTrait(java.lang.String traitName)Text handles x, y, and #text traits.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_ROTATE_ATTRIBUTE == traitName
||
SVGConstants.SVG_TEXT_PSEUDO_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
public java.lang.String | toString()Debug helper.
String xStr = "x[";
for (int i = 0; i < x.length; i++) {
xStr += x[i] + ", ";
}
xStr = xStr.substring(0, xStr.length() - 2);
xStr += "]";
String yStr = "y[";
for (int i = 0; i < y.length; i++) {
yStr += y[i] + ", ";
}
yStr = yStr.substring(0, yStr.length() - 2);
yStr += "]";
return super.toString() + "[\"" + content + "\"] " + xStr + " " + yStr;
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_X_ATTRIBUTE == name
||
SVGConstants.SVG_Y_ATTRIBUTE == name) {
float[] v = new float[value.length];
for (int i = 0; i < value.length; i++) {
v[i] = value[i][0];
}
return toStringTrait(v);
} else if (SVGConstants.SVG_ROTATE_ATTRIBUTE == name) {
float[] v = new float[value.length];
for (int i = 0; i < value.length; i++) {
v[i] = value[i][0];
}
return toStringTrait(v);
} else {
return super.toStringTrait(name, value);
}
|
public float[][] | validateFloatArrayTrait(java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return toAnimatedFloatArray(parseFloatArrayTrait(traitName, value));
} else if (SVGConstants.SVG_ROTATE_ATTRIBUTE == traitName) {
float[][] v = toAnimatedFloatArray(parseFloatArrayTrait(traitName,
value));
// Convert from degrees to radians
/*
for (int i = 0; i < v.length; i++) {
v[i][0] = MathSupport.toRadians(v[i][0]);
}
*/
return v;
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|