public class FadeStateListener
extends java.lang.Object
FadeTracker
.Modifier and Type | Field and Description |
---|---|
protected javax.swing.ButtonModel |
buttonModel
The associated model.
|
protected FadeTrackerCallback |
callback
Optional application callback.
|
protected java.awt.Component |
comp
The associated component.
|
protected java.lang.Comparable<?> |
extraKey |
protected java.awt.event.FocusListener |
focusListener
Listener on the focus gain and loss.
|
protected long |
focusLoopFadeInstanceId
Instance ID of focus loop animation.
|
protected javax.swing.event.ChangeListener |
modelListener
Listener on the model changes.
|
protected java.util.Map<FadeKind,java.lang.Boolean> |
prevStateMap
Key -
FadeKind , value - Boolean |
protected java.util.Set<FadeKind> |
toIgnore
A set of fade kinds to ignore.
|
Constructor and Description |
---|
FadeStateListener(java.awt.Component comp,
javax.swing.ButtonModel buttonModel,
FadeTrackerCallback callback)
Creates a new listener on model changes that can cause fade animation
transitions.
|
FadeStateListener(java.awt.Component comp,
java.lang.Comparable<?> extraKey,
javax.swing.ButtonModel buttonModel,
FadeTrackerCallback callback,
java.util.Set<FadeKind> toIgnore)
Creates a new listener on model changes that can cause fade animation
transitions.
|
Modifier and Type | Method and Description |
---|---|
protected void |
initiateFocusFadeLoop()
Initiates the looping animation on focus ring.
|
void |
registerListeners()
Registers listeners on all model changes.
|
void |
registerListeners(boolean toRepaintParent)
Registers listeners on all model changes.
|
protected void |
trackModelChange(FadeKind fadeKind,
boolean newValue,
boolean toRepaintParent)
Tracks a single change to the model.
|
void |
unregisterListeners()
Unregisters all listeners on model changes.
|
protected FadeTrackerCallback callback
protected java.awt.Component comp
protected javax.swing.ButtonModel buttonModel
protected java.lang.Comparable<?> extraKey
protected java.util.Map<FadeKind,java.lang.Boolean> prevStateMap
FadeKind
, value - Boolean
protected javax.swing.event.ChangeListener modelListener
protected java.awt.event.FocusListener focusListener
protected long focusLoopFadeInstanceId
protected java.util.Set<FadeKind> toIgnore
public FadeStateListener(java.awt.Component comp, javax.swing.ButtonModel buttonModel, FadeTrackerCallback callback)
comp
- Component.buttonModel
- Model for the component.callback
- Optional application callback.public FadeStateListener(java.awt.Component comp, java.lang.Comparable<?> extraKey, javax.swing.ButtonModel buttonModel, FadeTrackerCallback callback, java.util.Set<FadeKind> toIgnore)
comp
- Component.buttonModel
- Model for the component.callback
- Optional application callback.toIgnore
- Set of fade kinds to ignore.protected void trackModelChange(FadeKind fadeKind, boolean newValue, boolean toRepaintParent)
fadeKind
- Fade animation kind.newValue
- New value of the relevant attribute of the model.toRepaintParent
- If true
, the component parent will be repainted
at every animation cycle. If false
, the component
itself will be repainted at every animation cycle.public void registerListeners()
public void registerListeners(boolean toRepaintParent)
toRepaintParent
- If true
, the component parent will be repainted
at every animation cycle. If false
, the component
itself will be repainted at every animation cycle.protected void initiateFocusFadeLoop()
public void unregisterListeners()