Methods Summary |
---|
protected com.sun.perseus.j2d.PaintDef | computePaint()Computes the paint in user space on use.
if (compoundColor == null) {
compoundColor = new RGB((int) (solidOpacity * 255f),
solidColor.getRed(),
solidColor.getGreen(),
solidColor.getBlue());
}
return compoundColor;
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)SolidColor handles solid-color and solid-opacity traits as
FloatTraitAnims
if (SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName,
TRAIT_TYPE_SVG_RGB_COLOR);
} else {
return super.createTraitAnimImpl(traitName);
}
|
float | getFloatTraitImpl(java.lang.String name)SolidColor handles the solid-opacity as a float trait
if (SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == name) {
return solidOpacity;
} else {
return super.getFloatTraitImpl(name);
}
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_SOLID_COLOR_TAG;
|
org.w3c.dom.svg.SVGRGBColor | getRGBColorTraitImpl(java.lang.String name)Supported color traits: solid-color
// We use .equals here because the name is not interned.
if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE.equals(name)) {
return solidColor;
} else {
return super.getRGBColorTraitImpl(name);
}
|
public java.lang.String[] | getRequiredTraits()
return REQUIRED_TRAITS;
|
public java.lang.String | getTraitImpl(java.lang.String name)SolidColor handles solid-color and solid-opacity traits.
if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == name) {
return solidColor.toString();
} else if (SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == name) {
return Float.toString(solidOpacity);
} else {
return super.getTraitImpl(name);
}
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype Rect .
return new SolidColor(doc);
|
void | onPaintChange()Updates the compound color value and notfies related
PaintServerReferences.
compoundColor = null;
notifyPaintChange();
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float array.
if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == name) {
setSolidColor(new RGB((int) value[0][0], (int) value[0][1],
(int) value[0][2]));
} else if (SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == name) {
setSolidOpacity(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_SOLID_OPACITY_ATTRIBUTE == name) {
setSolidOpacity(value);
} else {
super.setFloatTraitImpl(name, value);
}
|
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_SOLID_COLOR_ATTRIBUTE.equals(name)) {
setSolidColor((RGB) color);
} else {
super.setRGBColorTraitImpl(name, color);
}
} catch (IllegalArgumentException iae) {
throw new DOMException(DOMException.INVALID_ACCESS_ERR,
iae.getMessage());
}
|
public void | setSolidColor(com.sun.perseus.j2d.RGB newSolidColor)Sets the solid-color property.
if (solidColor.equals(newSolidColor)) {
return;
}
solidColor = newSolidColor;
onPaintChange();
|
public void | setSolidOpacity(float newSolidOpacity)Sets the solid-opacity property.
if (newSolidOpacity == solidOpacity) {
return;
}
solidOpacity = newSolidOpacity;
if (solidOpacity < 0) {
solidOpacity = 0;
} else if (solidOpacity > 1) {
solidOpacity = 1;
}
onPaintChange();
|
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_SOLID_OPACITY_ATTRIBUTE == name) {
// ======================= solid-opacity ===================== //
if (SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
setSolidOpacity(DEFAULT_SOLID_OPACITY);
} else {
setSolidOpacity(parseFloatTrait(name, value));
}
} else if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == name) {
// ======================== solid-color ===================== //
if (SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
setSolidColor(DEFAULT_SOLID_COLOR);
} else {
setSolidColor(parseColorTrait
(SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE, value));
}
} else {
super.setTraitImpl(name, value);
}
|
boolean | supportsTrait(java.lang.String traitName)SolidColor handles solid-color and solid-opacity traits.
if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == traitName
||
SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_SOLID_OPACITY_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else if (SVGConstants.SVG_SOLID_COLOR_ATTRIBUTE == name) {
return toRGBString(name, value);
} 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_SOLID_COLOR_ATTRIBUTE == traitName) {
RGB color = DEFAULT_SOLID_COLOR;
if (!SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
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_SOLID_OPACITY_ATTRIBUTE == traitName) {
float so = DEFAULT_SOLID_OPACITY;
if (!SVGConstants.CSS_INHERIT_VALUE.equals(value)) {
so = parseFloatTrait(traitName, value);
}
if (so < 0) {
so = 0;
} else if (so > 1) {
so = 1;
}
return new float[][] {{so}};
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|