Constructors Summary |
---|
public TimedElementNode(DocumentNode ownerDocument, String localName)Builds a new timed element that belongs to the given
document. This TimedElementNode will belong
to the DocumentNode 's time container.
this(ownerDocument, new TimedElementSupport(), localName);
|
public TimedElementNode(DocumentNode ownerDocument)Builds a new timed element that belongs to the given
document. This TimedElementNode will belong
to the DocumentNode 's time container.
this(ownerDocument, new TimedElementSupport());
|
protected TimedElementNode(DocumentNode ownerDocument, TimedElementSupport timedElementSupport)Constructor used by derived classes.
this(ownerDocument,
timedElementSupport,
// <!> IMPL NOTE : DO THIS WHILE THE REST OF THE ANIMATION
// IMPLEMENTATION IS PENDING.
SVGConstants.SVG_SET_TAG);
|
protected TimedElementNode(DocumentNode ownerDocument, TimedElementSupport timedElementSupport, String localName)Constructor used by derived classes.
super(ownerDocument);
if (timedElementSupport == null) {
throw new IllegalArgumentException();
}
if (localName == null) {
throw new IllegalArgumentException();
}
this.timedElementSupport = timedElementSupport;
this.localName = localName;
timedElementSupport.animationElement = this;
|
Methods Summary |
---|
public void | beginElement()Creates a begin instance time for the current time.
timedElementSupport.beginAt(0);
|
public void | beginElementAt(float offset)
timedElementSupport.beginAt((long) (offset * 1000));
|
public void | endElement()Creates an end instance time for the current time.
timedElementSupport.endAt(0);
|
public void | endElementAt(float offset)
timedElementSupport.endAt((long) (offset * 1000));
|
public java.lang.String[][] | getDefaultTraits()The default value for the begin attribute is '0s'.
return new String[][] { {SVGConstants.SVG_BEGIN_ATTRIBUTE, "0s"} };
|
public boolean | getElementPaused()
throw new Error("NOT IMPLEMENTED");
|
public java.lang.String | getLocalName()
return localName;
|
public TimedElementSupport | getTimedElementSupport()
return timedElementSupport;
|
public java.lang.String | getTraitImpl(java.lang.String name)
if (SVGConstants.SVG_BEGIN_ATTRIBUTE == name) {
if (timedElementSupport.beginConditions.size() == 0) {
return "0s";
}
return TimeCondition.toStringTrait(
timedElementSupport.beginConditions);
} else if (SVGConstants.SVG_END_ATTRIBUTE == name) {
if (timedElementSupport.endConditions.size() == 0) {
return SVGConstants.SVG_INDEFINITE_VALUE;
}
return TimeCondition.toStringTrait(
timedElementSupport.endConditions);
} else if (SVGConstants.SVG_DUR_ATTRIBUTE == name) {
return Time.toStringTrait(timedElementSupport.dur);
} else if (SVGConstants.SVG_MIN_ATTRIBUTE == name) {
return Time.toStringTrait(timedElementSupport.min);
} else if (SVGConstants.SVG_MAX_ATTRIBUTE == name) {
return Time.toStringTrait(timedElementSupport.max);
} else if (SVGConstants.SVG_RESTART_ATTRIBUTE == name) {
switch (timedElementSupport.restart) {
case TimedElementSupport.RESTART_ALWAYS:
return SVGConstants.SVG_ALWAYS_VALUE;
case TimedElementSupport.RESTART_WHEN_NOT_ACTIVE:
return SVGConstants.SVG_WHEN_NOT_ACTIVE_VALUE;
case TimedElementSupport.RESTART_NEVER:
return SVGConstants.SVG_NEVER_VALUE;
default:
throw new IllegalStateException();
}
} else if (SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE == name) {
if (Float.isNaN(timedElementSupport.repeatCount)) {
return null; // Unspecified
} else if (timedElementSupport.repeatCount == Float.MAX_VALUE) {
return SVGConstants.SVG_INDEFINITE_VALUE;
}
return Float.toString(timedElementSupport.repeatCount);
} else if (SVGConstants.SVG_REPEAT_DUR_ATTRIBUTE == name) {
return Time.toStringTrait(timedElementSupport.repeatDur);
} else if (SVGConstants.SVG_FILL_ATTRIBUTE == name) {
switch (timedElementSupport.fillBehavior) {
case TimedElementSupport.FILL_BEHAVIOR_REMOVE:
return SVGConstants.SVG_REMOVE_VALUE;
case TimedElementSupport.FILL_BEHAVIOR_FREEZE:
return SVGConstants.SVG_FREEZE_VALUE;
default:
throw new IllegalStateException();
}
} else {
return super.getTraitImpl(name);
}
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype TimedElementNode .
return new TimedElementNode(doc, new TimedElementSupport(), localName);
|
void | nodeHookedInDocumentTree()When a TimedElementNode is hooked into the document tree, it needs
to register with the closest ancestor TimeContainerNode it can
find. If none, it must register with the root time container.
super.nodeHookedInDocumentTree();
ModelNode p = parent;
while (p != ownerDocument && p != null) {
if (p instanceof TimeContainerNode) {
timedElementSupport.setTimeContainer
(((TimeContainerNode) p).timeContainerSupport);
break;
}
p = p.parent;
}
if (p == ownerDocument) {
timedElementSupport.setTimeContainer
(ownerDocument.timeContainerRootSupport);
}
|
void | nodeUnhookedFromDocumentTree()When a TimedElementNode is unhooked from the document tree, it
needs to unregister from its TimeContainer node. Extentions, such
as Animation, may have to perform additional operations, such as
removing themselves from TraitAnim.
timedElementSupport.setTimeContainer(null);
timedElementSupport.reset();
|
protected void | parseTimeConditionsTrait(java.lang.String traitName, java.lang.String value, boolean isBegin)Parses the input value an creates TimeCondition instances for the
current instance.
try {
ownerDocument.timeConditionParser.parseBeginEndAttribute(value,
this,
isBegin);
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
throw illegalTraitValue(traitName, value);
}
|
public void | pauseElement()Pauses the element. If the element is already paused, this method has no
effect. See the SMIL 2 specification for a description of pausing
elements.
throw new Error("NOT IMPLEMENTED");
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)
if (SVGConstants.SVG_BEGIN_ATTRIBUTE == name) {
checkWriteLoading(name);
timedElementSupport.beginConditions.removeAllElements();
parseTimeConditionsTrait(name, value, true);
} else if (SVGConstants.SVG_END_ATTRIBUTE == name) {
checkWriteLoading(name);
timedElementSupport.endConditions.removeAllElements();
parseTimeConditionsTrait(name, value, false);
} else if (SVGConstants.SVG_DUR_ATTRIBUTE == name) {
checkWriteLoading(name);
// Ignore 'media'
if (SVGConstants.SVG_MEDIA_VALUE.equals(value)) {
return;
}
timedElementSupport.setDur(parseClockTrait(name, value));
} else if (SVGConstants.SVG_MIN_ATTRIBUTE == name) {
checkWriteLoading(name);
// Ignore 'media'
if (SVGConstants.SVG_MEDIA_VALUE.equals(value)) {
return;
}
timedElementSupport.setMin(parseMinMaxClock(name, value, true));
} else if (SVGConstants.SVG_MAX_ATTRIBUTE == name) {
checkWriteLoading(name);
// Ignore 'media'
if (SVGConstants.SVG_MEDIA_VALUE.equals(value)) {
return;
}
timedElementSupport.setMax(parseMinMaxClock(name, value, false));
} else if (SVGConstants.SVG_RESTART_ATTRIBUTE == name) {
checkWriteLoading(name);
if (SVGConstants.SVG_ALWAYS_VALUE.equals(value)) {
timedElementSupport.restart =
TimedElementSupport.RESTART_ALWAYS;
} else if (SVGConstants.SVG_WHEN_NOT_ACTIVE_VALUE.equals(value)) {
timedElementSupport.restart =
TimedElementSupport.RESTART_WHEN_NOT_ACTIVE;
} else if (SVGConstants.SVG_NEVER_VALUE.equals(value)) {
timedElementSupport.restart =
TimedElementSupport.RESTART_NEVER;
} else {
throw illegalTraitValue(name, value);
}
} else if (SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE == name) {
checkWriteLoading(name);
if (SVGConstants.SVG_INDEFINITE_VALUE.equals(value)) {
timedElementSupport.repeatCount = Float.MAX_VALUE;
} else {
timedElementSupport.repeatCount =
parseFloatTrait(name, value);
}
} else if (SVGConstants.SVG_REPEAT_DUR_ATTRIBUTE == name) {
checkWriteLoading(name);
if (SVGConstants.SVG_INDEFINITE_VALUE.equals(value)) {
timedElementSupport.repeatDur = Time.INDEFINITE;
} else {
timedElementSupport.setRepeatDur(parseClockTrait(name, value));
}
} else if (SVGConstants.SVG_FILL_ATTRIBUTE == name) {
checkWriteLoading(name);
if (SVGConstants.SVG_REMOVE_VALUE.equals(value)) {
timedElementSupport.fillBehavior
= TimedElementSupport.FILL_BEHAVIOR_REMOVE;
} else if (SVGConstants.SVG_FREEZE_VALUE.equals(value)) {
timedElementSupport.fillBehavior
= TimedElementSupport.FILL_BEHAVIOR_FREEZE;
} else {
throw illegalTraitValue(name, value);
}
} else {
super.setTraitImpl(name, value);
}
|
boolean | supportsTrait(java.lang.String traitName)TimedElementNode supports the begin, end, dur, min, max, restart,
repeatCount, repeatDur and fill attributes.
if (SVGConstants.SVG_BEGIN_ATTRIBUTE == traitName
||
SVGConstants.SVG_END_ATTRIBUTE == traitName
||
SVGConstants.SVG_DUR_ATTRIBUTE == traitName
||
SVGConstants.SVG_MIN_ATTRIBUTE == traitName
||
SVGConstants.SVG_MAX_ATTRIBUTE == traitName
||
SVGConstants.SVG_RESTART_ATTRIBUTE == traitName
||
SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE == traitName
||
SVGConstants.SVG_REPEAT_DUR_ATTRIBUTE == traitName
||
SVGConstants.SVG_FILL_ATTRIBUTE == traitName) {
return true;
}
return super.supportsTrait(traitName);
|
public void | unpauseElement()Unpauses the element if it was paused. If the element was not paused,
this method has no effect. See the SMIL 2 specification for a description
of pausing
elements.
throw new Error("NOT IMPLEMENTED");
|