protected class AnimatableAngleOrIdentFactory extends CSSValueFactory {
protected AnimatableValue createAnimatableValue(AnimationTarget target,
String pn, Value v) {
if (v instanceof StringValue) {
return new AnimatableAngleOrIdentValue(target,
v.getStringValue());
}
FloatValue fv = (FloatValue) v;
short unit;
switch (fv.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_NUMBER:
case CSSPrimitiveValue.CSS_DEG:
unit = SVGAngle.SVG_ANGLETYPE_DEG;
break;
case CSSPrimitiveValue.CSS_RAD:
unit = SVGAngle.SVG_ANGLETYPE_RAD;
break;
case CSSPrimitiveValue.CSS_GRAD:
unit = SVGAngle.SVG_ANGLETYPE_GRAD;
break;
default:
// XXX Do something better than returning null.
return null;
}
return new AnimatableAngleOrIdentValue(target, fv.getFloatValue(),
unit);
}