|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.extension.gui.dock.theme.bubble.BubbleColorAnimation
public class BubbleColorAnimation
A BubbleColorAnimation has the ability to convert one color smoothly into another.
The animation does not store colors directly, it uses a String
as a key to read the color from a BubbleTheme
using BubbleTheme.getColor(String)
.
The transformation takes duration
milliseconds,
a task
can be executed whenever the colors have
changed.
The animation can handle multiple color-pairs asynchronously.
Nested Class Summary | |
---|---|
private class |
BubbleColorAnimation.Entry
One pair of colors. |
Field Summary | |
---|---|
private java.util.Map<java.lang.String,BubbleColorAnimation.Entry> |
colors
The color pairs that can be animated |
private int |
duration
How long a transformation takes |
private java.util.List<java.lang.Runnable> |
tasks
The tasks that are executed at every step of the animation |
private BubbleTheme |
theme
the theme from which colors are read |
private long |
time
The current time in milliseconds |
private javax.swing.Timer |
timer
The timer that triggers steps of the animation |
Constructor Summary | |
---|---|
BubbleColorAnimation(BubbleTheme theme)
Creates a new animation. |
Method Summary | |
---|---|
void |
addTask(java.lang.Runnable runnable)
Adds a task to this animation. |
java.awt.Color |
getColor(java.lang.String key)
Gets the current color of the pair key . |
int |
getDuration()
Gets the length of one transformation. |
protected void |
pulse()
Called when the animation has to perform another step. |
void |
putColor(java.lang.String key,
java.lang.String color)
Starts a new animation which will transform the color of the pair key to color . |
void |
putColors(java.lang.String key,
java.lang.String source,
java.lang.String destination)
Sets a color-pair. |
void |
removeTask(java.lang.Runnable runnable)
Removes a task which was earlier added to this animation. |
void |
setDuration(int duration)
Sets the length of one transformation. |
protected void |
start()
Starts the animation if it is not yet running. |
void |
stop()
Stops the animation immediately, possibly leaving the animation in an unfinished state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int duration
private java.util.Map<java.lang.String,BubbleColorAnimation.Entry> colors
private javax.swing.Timer timer
private long time
private java.util.List<java.lang.Runnable> tasks
private BubbleTheme theme
Constructor Detail |
---|
public BubbleColorAnimation(BubbleTheme theme)
theme
- the theme from which colors are readMethod Detail |
---|
public void putColors(java.lang.String key, java.lang.String source, java.lang.String destination)
destination
is shown
after maximal duration
milliseconds. This
method does not start a new animation, but modifies currently running
animations.
key
- the key of the pairsource
- where the animation startsdestination
- the destination of the animationpublic void putColor(java.lang.String key, java.lang.String color)
key
to color
.
key
- the key of the paircolor
- the destination of the animationpublic java.awt.Color getColor(java.lang.String key)
key
.
key
- the key of the pair
null
public void addTask(java.lang.Runnable runnable)
runnable
- the task to executepublic void removeTask(java.lang.Runnable runnable)
runnable
- the task to removepublic void setDuration(int duration)
duration
- the duration in millisecondspublic int getDuration()
public void stop()
protected void start()
protected void pulse()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |