Methods Summary |
---|
ElementNodeProxy | buildProxy()
return new CompositeGraphicsNodeProxy(this);
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)
if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == traitName
||
SVGConstants.SVG_OFFSET_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName,
TRAIT_TYPE_SVG_RGB_COLOR);
} else {
return super.createTraitAnimImpl(traitName);
}
|
float | getFloatTraitImpl(java.lang.String name)
if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name) {
return stopOpacity;
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
return offset;
} else {
return super.getFloatTraitImpl(name);
}
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_STOP_TAG;
|
public int | getNumberOfProperties()
return GraphicsNode.NUMBER_OF_PROPERTIES;
|
public float | getOffset()
return offset;
|
org.w3c.dom.svg.SVGRGBColor | getRGBColorTraitImpl(java.lang.String name)
// We use .equals here because name is not interned.
if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE.equals(name)) {
return stopColor;
} else {
return super.getRGBColorTraitImpl(name);
}
|
public java.lang.String[] | getRequiredTraits()
return REQUIRED_TRAITS;
|
public com.sun.perseus.j2d.RGB | getStopColor()
return stopColor;
|
public float | getStopOpacity()
return stopOpacity;
|
public java.lang.String | getTraitImpl(java.lang.String name)
if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE == name) {
return stopColor.toString();
} else if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name) {
return Float.toString(stopOpacity);
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
return Float.toString(offset);
} else {
return super.getTraitImpl(name);
}
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype Stop .
return new Stop(doc);
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float array.
if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE == name) {
setStopColor(toRGB(name, value));
} else if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name) {
if (value[0][0] < 0 || value[0][0] > 1) {
throw illegalTraitValue(name, Float.toString(value[0][0]));
}
setStopOpacity(value[0][0]);
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
setOffset(value[0][0]);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)Set the trait value as float.
Supported float traits: stroke-width, stroke-miterlimit,
stroke-dashoffset, fill-opacity, stroke-opacity.
if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name) {
setStopOpacity(value);
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
setOffset(value);
} else {
super.setFloatTraitImpl(name, value);
}
|
public void | setOffset(float newOffset)Sets the stop offset
if (newOffset == offset) {
return;
}
offset = newOffset;
updateGradient();
|
void | setRGBColorTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGRGBColor color)Set the trait value as {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor}.
Supported color traits: color, fill, stroke
try {
if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE.equals(name)) {
setStopColor((RGB) color);
} else {
super.setRGBColorTraitImpl(name, color);
}
} catch (IllegalArgumentException iae) {
throw new DOMException(DOMException.INVALID_ACCESS_ERR,
iae.getMessage());
}
|
public void | setStopColor(com.sun.perseus.j2d.RGB newStopColor)Sets the stop-color property.
if (stopColor.equals(newStopColor)) {
return;
}
stopColor = newStopColor;
updateGradient();
|
public void | setStopOpacity(float newStopOpacity)Sets the stop-opacity property.
if (newStopOpacity == stopOpacity) {
return;
}
stopOpacity = newStopOpacity;
updateGradient();
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)CompositeGraphicsNode handles the graphics node traits.
Other attributes are handled by the super class.
Supported traits: stroke-width, stroke-miterlimit, stroke-dashoffset,
fill-rule, stroke-linejoin, stroke-linecap, display, visibility,
color, fill, stroke, fill-opacity, stroke-opacity, stroke-dasharray
if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name) {
// ======================= stop-opacity ===================== //
if (SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
setStopOpacity(DEFAULT_STOP_OPACITY);
} else {
setStopOpacity(parsePositiveFloatTrait(name, value));
}
} else if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE
.equals(name)) {
// ======================== stop-color ===================== //
if (SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
setStopColor(DEFAULT_STOP_COLOR);
} else if (SVGConstants.CSS_CURRENTCOLOR_VALUE.equals(value)) {
setStopColor(getColor());
} else {
setStopColor(parseColorTrait
(SVGConstants.SVG_STOP_COLOR_ATTRIBUTE, value));
}
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
setOffset(parseFloatTrait(name, value));
} else {
super.setTraitImpl(name, value);
}
|
boolean | supportsTrait(java.lang.String traitName)
if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE == traitName
||
SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == traitName
||
SVGConstants.SVG_OFFSET_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == name
||
SVGConstants.SVG_OFFSET_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else if (SVGConstants.SVG_STOP_COLOR_ATTRIBUTE == name) {
return toRGBString(name, value);
} else {
return super.toStringTrait(name, value);
}
|
void | updateGradient()Should be called by the stop every time its parent gradient
should recompute its state.
if (parent != null) {
if (parent instanceof GradientElement) {
((GradientElement) parent).onPaintChange();
}
}
|
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_STOP_COLOR_ATTRIBUTE == traitName) {
RGB color = parseColorTrait
(SVGConstants.SVG_COLOR_ATTRIBUTE, value);
if (color == null) {
throw illegalTraitValue(traitName, value);
}
return new float[][] {
{color.getRed(), color.getGreen(), color.getBlue()}
};
} else if (SVGConstants.SVG_STOP_OPACITY_ATTRIBUTE == traitName) {
return new float[][] {{parseFloatTrait(traitName, value)}};
} else if (SVGConstants.SVG_OFFSET_ATTRIBUTE == traitName) {
return new float[][] {{parseFloatTrait(traitName, value)}};
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|