public abstract class TimedElement extends java.lang.Object implements SMILConstants
Modifier and Type | Field and Description |
---|---|
protected java.util.LinkedList |
beginDependents
List of TimingSpecifiers on other elements that depend on this
element's begin times.
|
protected java.util.List |
beginInstanceTimes
List of begin InstanceTimes.
|
protected TimingSpecifier[] |
beginTimes
Timing specifiers for the begin times of this element.
|
protected Interval |
currentInterval
The current Interval.
|
protected int |
currentRepeatIteration
The current repeat iteration.
|
protected boolean |
durMedia
Whether the simple duration of this element should be equal
to the implicit duration.
|
protected java.util.LinkedList |
endDependents
List of TimingSpecifiers on other elements that depend on this
element's end times.
|
protected java.util.List |
endInstanceTimes
List of end InstanceTimes.
|
protected TimingSpecifier[] |
endTimes
Timing specifiers for the end times of this element.
|
static int |
FILL_FREEZE |
static int |
FILL_REMOVE |
protected int |
fillMode
The fill mode for this element.
|
protected java.util.Map |
handledEvents
|
protected boolean |
hasParsed
Whether this timed element has parsed its timing attributes yet.
|
protected boolean |
hasPropagated
Whether an instance time update message has already been propagated to
this timed element.
|
static float |
INDEFINITE |
protected boolean |
isActive
Whether the element is currently active.
|
protected boolean |
isFrozen
Whether the element is currently frozen.
|
protected boolean |
isSampling
Whether this timed element is currently being sampled.
|
protected float |
lastIntervalEnd
The end time of the previous interval, initially
Float.NEGATIVE_INFINITY . |
protected float |
lastRepeatTime
The local active time of the last repeat.
|
protected float |
lastSampleTime
The current time of this element in local active time.
|
protected static LocalizableSupport |
localizableSupport
The localizable support for the error messages.
|
protected float |
max
The maximum active duration of this element.
|
protected boolean |
maxMedia
Whether the max value was specified as 'media'.
|
protected float |
min
The minimum active duration of this element.
|
protected boolean |
minMedia
Whether the min value was specified as 'media'.
|
protected TimeContainer |
parent
The parent time container.
|
protected Interval |
previousInterval
The previous interval.
|
protected float |
repeatCount
The number of repeats.
|
protected float |
repeatDur
The duration of repeats.
|
protected float |
repeatDuration
The computed repeat duration of the element.
|
protected static java.lang.String |
RESOURCES
The error messages bundle class name.
|
static int |
RESTART_ALWAYS |
static int |
RESTART_NEVER |
static int |
RESTART_WHEN_NOT_ACTIVE |
protected int |
restartMode
The restart mode for this element.
|
protected TimedDocumentRoot |
root
The root time container.
|
protected boolean |
shouldUpdateCurrentInterval
Whether the list of instance times should be checked to update
the current interval.
|
protected float |
simpleDur
Duration of this element, if
durMedia = false . |
static float |
UNRESOLVED |
SMIL_ACCUMULATE_ATTRIBUTE, SMIL_ADDITIVE_ATTRIBUTE, SMIL_ALWAYS_VALUE, SMIL_ANIMATE_COLOR_TAG, SMIL_ANIMATE_MOTION_TAG, SMIL_ANIMATE_TAG, SMIL_ATTRIBUTE_NAME_ATTRIBUTE, SMIL_ATTRIBUTE_TYPE_ATTRIBUTE, SMIL_AUTO_VALUE, SMIL_BEGIN_ATTRIBUTE, SMIL_BEGIN_DEFAULT_VALUE, SMIL_BEGIN_EVENT_NAME, SMIL_BY_ATTRIBUTE, SMIL_CALC_MODE_ATTRIBUTE, SMIL_CSS_VALUE, SMIL_DEFAULT_VALUE, SMIL_DISCRETE_VALUE, SMIL_DUR_ATTRIBUTE, SMIL_END_ATTRIBUTE, SMIL_END_EVENT_NAME, SMIL_FILL_ATTRIBUTE, SMIL_FREEZE_VALUE, SMIL_FROM_ATTRIBUTE, SMIL_HOLD_VALUE, SMIL_INDEFINITE_VALUE, SMIL_KEY_POINTS_ATTRIBUTE, SMIL_KEY_SPLINES_ATTRIBUTE, SMIL_KEY_TIMES_ATTRIBUTE, SMIL_LINEAR_VALUE, SMIL_MAX_ATTRIBUTE, SMIL_MEDIA_VALUE, SMIL_MIN_ATTRIBUTE, SMIL_NEVER_VALUE, SMIL_NONE_VALUE, SMIL_ORIGIN_ATTRIBUTE, SMIL_PACED_VALUE, SMIL_PATH_ATTRIBUTE, SMIL_REMOVE_VALUE, SMIL_REPEAT_COUNT_ATTRIBUTE, SMIL_REPEAT_DUR_ATTRIBUTE, SMIL_REPEAT_EVENT_ALT_NAME, SMIL_REPEAT_EVENT_NAME, SMIL_REPLACE_VALUE, SMIL_RESTART_ATTRIBUTE, SMIL_SET_TAG, SMIL_SPLINE_VALUE, SMIL_SUM_VALUE, SMIL_TO_ATTRIBUTE, SMIL_VALUES_ATTRIBUTE, SMIL_WHEN_NOT_ACTIVE_VALUE, SMIL_XML_VALUE
Constructor and Description |
---|
TimedElement()
Creates a new TimedElement.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDependent(TimingSpecifier dependent,
boolean forBegin)
Adds a dependent TimingSpecifier for this element.
|
protected float |
addInstanceTime(InstanceTime time,
boolean isBegin)
Called by a TimingSpecifier of this element when a new
InstanceTime is created.
|
void |
beginElement()
Adds a time to the begin time instance list that will cause
the element to begin immediately (if restart semantics allow it).
|
void |
beginElement(float offset)
Adds a time to the begin time instance list that will cause
the element to begin at some offset to the current time (if restart
semantics allow it).
|
boolean |
canBegin()
Returns whether this element can be begun or restarted currently.
|
boolean |
canEnd()
Returns whether this element can be ended currently.
|
protected Interval |
computeInterval(boolean first,
boolean fixedBegin,
float beginAfter,
boolean incl)
Computes an interval from the begin and end instance time lists.
|
AnimationException |
createException(java.lang.String code,
java.lang.Object[] params)
Creates and returns a new
AnimationException . |
void |
deinitialize()
Deinitializes this timed element.
|
void |
endElement()
Adds a time to the end time instance list that will cause
the element to end immediately (if restart semantics allow it).
|
void |
endElement(float offset)
Adds a time to the end time instance list that will cause
the element to end at some offset to the current time (if restart
semantics allow it).
|
protected boolean |
endHasEventConditions()
Returns whether the end timing specifier list contains any eventbase,
accesskey or repeat timing specifiers.
|
protected abstract void |
fireTimeEvent(java.lang.String eventType,
java.util.Calendar time,
int detail)
Fires a TimeEvent of the given type on this element.
|
protected void |
fireTimeEvent(java.lang.String eventType,
float time,
int detail)
Fires a TimeEvent of the given type on this element.
|
static java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object[] args)
Implements
Localizable.formatMessage(String,Object[]) . |
float |
getActiveDur(float B,
float end)
Returns the active duration time of this element.
|
float |
getActiveTime()
Returns the current active time of this element.
|
protected abstract EventTarget |
getAnimationEventTarget()
Returns the target of this animation as an
EventTarget . |
TimingSpecifier[] |
getBeginTimingSpecifiers()
Returns an array of the begin timing specifiers on this timed element.
|
float |
getCurrentBeginTime()
Returns the begin time of the current interval, in parent simple time,
or
Float.NaN if the element is not active. |
abstract Element |
getElement()
Returns the DOM element that corresponds to this timed element, if
such a DOM element exists.
|
TimingSpecifier[] |
getEndTimingSpecifiers()
Returns an array of the end timing specifiers on this timed element.
|
protected abstract EventTarget |
getEventTargetById(java.lang.String id)
Returns the event target with the given ID.
|
float |
getHyperlinkBeginTime()
Returns the time that the document would seek to if this animation
element were hyperlinked to, or
NaN if there is no
such begin time. |
protected float |
getImplicitDur()
Returns the implicit duration of the element.
|
float |
getLastSampleTime()
Returns the last sample time of this element, in local active time.
|
static java.util.Locale |
getLocale()
Implements
Localizable.getLocale() . |
TimedDocumentRoot |
getRoot()
Returns the root time container of this timed element.
|
protected abstract EventTarget |
getRootEventTarget()
Returns the event target that should be listened to for
access key events.
|
float |
getSimpleDur()
Returns the simple duration time of this element.
|
float |
getSimpleTime()
Returns the current simple time of this element.
|
protected abstract TimedElement |
getTimedElementById(java.lang.String id)
Returns the timed element with the given ID.
|
void |
initialize()
Initializes this timed element.
|
protected float |
instanceTimeChanged(InstanceTime time,
boolean isBegin)
Called by a TimingSpecifier of this element when an InstanceTime
has been updated.
|
abstract boolean |
isBefore(TimedElement other)
Returns whether this timed element comes before the given timed element
in document order.
|
protected abstract boolean |
isConstantAnimation()
Returns whether this timed element is for a constant animation (i.e., a
'set' animation.
|
static boolean |
isUnresolved(float t)
Returns whether the given time value is equal to the
UNRESOLVED value. |
protected float |
maxTime(float t1,
float t2)
Returns the maximum of two time values.
|
protected float |
minTime(float t1,
float t2)
Returns the minimum of two time values.
|
protected float |
minusTime(float t1,
float t2)
Subtracts one simple time from another.
|
protected float |
multiplyTime(float t,
float n)
Multiplies one simple time by n.
|
protected float |
notifyNewInterval(Interval interval)
Notifies dependents of a new interval.
|
protected float |
notifyRemoveInterval(Interval interval)
Notifies dependents of a removed interval.
|
void |
parseAttributes(java.lang.String begin,
java.lang.String dur,
java.lang.String end,
java.lang.String min,
java.lang.String max,
java.lang.String repeatCount,
java.lang.String repeatDur,
java.lang.String fill,
java.lang.String restart)
Parses the animation attributes for this timed element.
|
protected void |
parseBegin(java.lang.String begin)
Parses a new 'begin' attribute.
|
protected float |
parseClockValue(java.lang.String s,
boolean parseOffset)
Parses a clock value or offset and returns it as a float.
|
protected void |
parseDur(java.lang.String dur)
Parses a new 'dur' attribute.
|
protected void |
parseEnd(java.lang.String end)
Parses a new 'end' attribute.
|
protected void |
parseFill(java.lang.String fill)
Parses a new 'fill' attribute.
|
protected void |
parseMax(java.lang.String max)
Parses a new 'max' attribute.
|
protected void |
parseMin(java.lang.String min)
Parses a new 'min' attribute.
|
protected void |
parseRepeatCount(java.lang.String repeatCount)
Parses a new 'repeatCount' attribute.
|
protected void |
parseRepeatDur(java.lang.String repeatDur)
Parses a new 'repeatDur' attribute.
|
protected void |
parseRestart(java.lang.String restart)
Parses a new 'restart' attribute.
|
protected void |
removeDependent(TimingSpecifier dependent,
boolean forBegin)
Removes a dependent TimingSpecifier for this element.
|
protected abstract void |
removeFill()
Invoked to indicate that this timed element has had its fill removed.
|
protected float |
removeInstanceTime(InstanceTime time,
boolean isBegin)
Called by a TimingSpecifier of this element when an InstanceTime
should be removed.
|
protected void |
reset(boolean clearCurrentBegin)
Resets this element.
|
protected float |
sampleAt(float parentSimpleTime,
boolean hyperlinking)
Calculates the local simple time.
|
protected abstract void |
sampledAt(float simpleTime,
float simpleDur,
int repeatIteration)
Invoked to indicate that this timed element has been sampled at the
given time.
|
protected abstract void |
sampledLastValue(int repeatIteration)
Invoked to indicate that this timed element has been sampled
at the end of its active time, at an integer multiple of the
simple duration.
|
protected float |
selectNewInterval(float time,
Interval interval)
Sets the current interval to the one specified.
|
static void |
setLocale(java.util.Locale l)
Implements
Localizable.setLocale(java.util.Locale) . |
protected abstract void |
toActive(float begin)
Invoked to indicate this timed element became active at the
specified time.
|
protected abstract void |
toInactive(boolean stillActive,
boolean isFrozen)
Invoked to indicate that this timed element became inactive.
|
static java.lang.String |
toString(float time)
Returns a string representation of the given time value.
|
public static final int FILL_REMOVE
public static final int FILL_FREEZE
public static final int RESTART_ALWAYS
public static final int RESTART_WHEN_NOT_ACTIVE
public static final int RESTART_NEVER
public static final float INDEFINITE
public static final float UNRESOLVED
protected TimedDocumentRoot root
protected TimeContainer parent
protected TimingSpecifier[] beginTimes
protected TimingSpecifier[] endTimes
protected float simpleDur
protected boolean durMedia
protected float repeatCount
UNRESOLVED
.protected float repeatDur
UNRESOLVED
.protected int currentRepeatIteration
protected float lastRepeatTime
protected int fillMode
protected int restartMode
protected float min
protected boolean minMedia
protected float max
protected boolean maxMedia
protected boolean isActive
protected boolean isFrozen
protected float lastSampleTime
protected float repeatDuration
protected java.util.List beginInstanceTimes
protected java.util.List endInstanceTimes
protected Interval currentInterval
protected float lastIntervalEnd
Float.NEGATIVE_INFINITY
.protected Interval previousInterval
protected java.util.LinkedList beginDependents
protected java.util.LinkedList endDependents
protected boolean shouldUpdateCurrentInterval
protected boolean hasParsed
protected java.util.Map handledEvents
protected boolean isSampling
protected boolean hasPropagated
protected static final java.lang.String RESOURCES
protected static LocalizableSupport localizableSupport
public TimedDocumentRoot getRoot()
public float getActiveTime()
public float getSimpleTime()
protected float addInstanceTime(InstanceTime time, boolean isBegin)
protected float removeInstanceTime(InstanceTime time, boolean isBegin)
protected float instanceTimeChanged(InstanceTime time, boolean isBegin)
protected void addDependent(TimingSpecifier dependent, boolean forBegin)
protected void removeDependent(TimingSpecifier dependent, boolean forBegin)
public float getSimpleDur()
public static boolean isUnresolved(float t)
UNRESOLVED
value.public float getActiveDur(float B, float end)
protected float minusTime(float t1, float t2)
protected float multiplyTime(float t, float n)
protected float minTime(float t1, float t2)
protected float maxTime(float t1, float t2)
protected float getImplicitDur()
UNRESOLVED
by default. This should be overriden in derived
classes that play media, since they will have an implicit duration.protected float notifyNewInterval(Interval interval)
protected float notifyRemoveInterval(Interval interval)
protected float sampleAt(float parentSimpleTime, boolean hyperlinking)
Float.POSITIVE_INFINITY
if this
element will become active at some undetermined point in the
future (because of unresolved begin times, for example) or
will never become active again, or 0f
if the
element is currently active.protected boolean endHasEventConditions()
protected float selectNewInterval(float time, Interval interval)
time
- the current sampling timeinterval
- the Interval object to select to be currentprotected Interval computeInterval(boolean first, boolean fixedBegin, float beginAfter, boolean incl)
first
- indicates whether this is the first interval to computefixedBegin
- if true, specifies that the value given for
beginAfter
is taken to be the actual begin
time for the interval; only the end value is computed.beginAfter
- the earliest possible begin time for the computed
interval.incl
- if true (and !fixedBegin
), specifies that the
new interval's begin time must be greater than
beginAfter
; otherwise, the begin time must be
greater than or equal to beginAfter
.protected void reset(boolean clearCurrentBegin)
public void parseAttributes(java.lang.String begin, java.lang.String dur, java.lang.String end, java.lang.String min, java.lang.String max, java.lang.String repeatCount, java.lang.String repeatDur, java.lang.String fill, java.lang.String restart)
protected void parseBegin(java.lang.String begin)
protected void parseDur(java.lang.String dur)
protected float parseClockValue(java.lang.String s, boolean parseOffset) throws ParseException
ParseException
protected void parseEnd(java.lang.String end)
protected void parseMin(java.lang.String min)
protected void parseMax(java.lang.String max)
protected void parseRepeatCount(java.lang.String repeatCount)
protected void parseRepeatDur(java.lang.String repeatDur)
protected void parseFill(java.lang.String fill)
protected void parseRestart(java.lang.String restart)
public void initialize()
public void deinitialize()
public void beginElement()
public void beginElement(float offset)
public void endElement()
public void endElement(float offset)
public float getLastSampleTime()
public float getCurrentBeginTime()
Float.NaN
if the element is not active.public boolean canBegin()
public boolean canEnd()
public float getHyperlinkBeginTime()
NaN
if there is no
such begin time.public TimingSpecifier[] getBeginTimingSpecifiers()
public TimingSpecifier[] getEndTimingSpecifiers()
protected void fireTimeEvent(java.lang.String eventType, float time, int detail)
eventType
- the type of TimeEvent ("beginEvent", "endEvent"
or "repeatEvent").time
- the timestamp of the event objectdetail
- the repeat iteration, if this event is a repeat eventprotected abstract void fireTimeEvent(java.lang.String eventType, java.util.Calendar time, int detail)
eventType
- the type of TimeEvent ("beginEvent", "endEvent"
or "repeatEvent").time
- the timestamp of the event objectprotected abstract void toActive(float begin)
begin
- the time the element became active, in document simple timeprotected abstract void toInactive(boolean stillActive, boolean isFrozen)
stillActive
- if true, indicates that the element is still actually
active, but between the end of the computed repeat
duration and the end of the intervalisFrozen
- whether the element is frozen or notprotected abstract void removeFill()
protected abstract void sampledAt(float simpleTime, float simpleDur, int repeatIteration)
simpleTime
- the sample time in local simple timesimpleDur
- the simple duration of the elementrepeatIteration
- the repeat iteration during which the element
was sampledprotected abstract void sampledLastValue(int repeatIteration)
protected abstract TimedElement getTimedElementById(java.lang.String id)
protected abstract EventTarget getEventTargetById(java.lang.String id)
protected abstract EventTarget getRootEventTarget()
public abstract Element getElement()
protected abstract EventTarget getAnimationEventTarget()
EventTarget
. Used
for eventbase timing specifiers where the element ID is omitted.public abstract boolean isBefore(TimedElement other)
protected abstract boolean isConstantAnimation()
public AnimationException createException(java.lang.String code, java.lang.Object[] params)
AnimationException
.public static void setLocale(java.util.Locale l)
Localizable.setLocale(java.util.Locale)
.public static java.util.Locale getLocale()
Localizable.getLocale()
.public static java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args) throws java.util.MissingResourceException
Localizable.formatMessage(String,Object[])
.java.util.MissingResourceException
public static java.lang.String toString(float time)
Copyright © 2022 Apache Software Foundation. All Rights Reserved.