Package org.eclipse.nebula.effects.stw
Class TransitionManager
- java.lang.Object
-
- org.eclipse.nebula.effects.stw.TransitionManager
-
public class TransitionManager extends java.lang.Object
Transition manager applies the required transition on aTransitionable
object.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,org.eclipse.swt.graphics.Image>
_images
private int
_lastItem
private java.util.List<TransitionListener>
_listeners
private Transition
_transition
private Transitionable
_transitionable
private int
_transitionsBeingProcessed
(package private) org.eclipse.swt.graphics.Color
backgroundColor
(package private) org.eclipse.swt.graphics.Image
backgroundImage
-
Constructor Summary
Constructors Constructor Description TransitionManager(Transitionable transitionable)
Constructs a transition manager to handle transitions on the provided transitionable object.TransitionManager(org.eclipse.swt.custom.CTabFolder tabFolder)
Constructs a transition manager to handle transitions on the providedCTabFolder
as the transitionable object.TransitionManager(org.eclipse.swt.widgets.TabFolder tabFolder)
Constructs a transition manager to handle transitions on the providedTabFolder
as the transitionable object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransitionListener(TransitionListener transitionListener)
Adds a new transition listener to be invoked at the end of each transitionvoid
clearControlImages()
Clears the control images used in the transitions processing.void
finalize()
org.eclipse.swt.graphics.Color
getBackground()
Returns the background color of the transition frameorg.eclipse.swt.graphics.Image
getBackgroundImage()
Returns the background image of the transition frameprivate org.eclipse.swt.graphics.Image
getControlImage(int ctrlIndex)
Returns the image related to a control.Transition
getTransition()
Returns the current transition effectTransitionable
getTransitionable()
Returns the transitionable objectvoid
removeTransitionListener(TransitionListener transitionListener)
Removes a transition listener from the list of transition listenersvoid
setBackground(org.eclipse.swt.graphics.Color color)
Sets the background color of the transition framevoid
setBackgroundImage(org.eclipse.swt.graphics.Image image)
Sets the background image of the transition framevoid
setControlImages(org.eclipse.swt.graphics.Image[] images)
Sets the control images used in the transitions processing.void
setTransition(Transition transition)
Sets and changes the transition effectvoid
startTransition(int fromIndex, int toIndex, double direction)
Carries out the transition effect on the transitionable object by transitioning fromfromIndex
totoIndex
in the directiondirection
private void
updateControlImage(org.eclipse.swt.graphics.Image img, int ctrlIndex)
Update an image related to a control.
-
-
-
Field Detail
-
_lastItem
private int _lastItem
-
backgroundColor
org.eclipse.swt.graphics.Color backgroundColor
-
backgroundImage
org.eclipse.swt.graphics.Image backgroundImage
-
_transitionable
private Transitionable _transitionable
-
_transition
private Transition _transition
-
_listeners
private java.util.List<TransitionListener> _listeners
-
_transitionsBeingProcessed
private int _transitionsBeingProcessed
-
_images
private java.util.Map<java.lang.Integer,org.eclipse.swt.graphics.Image> _images
-
-
Constructor Detail
-
TransitionManager
public TransitionManager(Transitionable transitionable)
Constructs a transition manager to handle transitions on the provided transitionable object.- Parameters:
transitionable
- the transitionable object to perform transitions on
-
TransitionManager
public TransitionManager(org.eclipse.swt.custom.CTabFolder tabFolder)
Constructs a transition manager to handle transitions on the providedCTabFolder
as the transitionable object.- Parameters:
tabFolder
- theCTabFolder
as the transitionable object to perform transitions on
-
TransitionManager
public TransitionManager(org.eclipse.swt.widgets.TabFolder tabFolder)
Constructs a transition manager to handle transitions on the providedTabFolder
as the transitionable object.- Parameters:
tabFolder
- theTabFolder
as the transitionable object to perform transitions on
-
-
Method Detail
-
startTransition
public void startTransition(int fromIndex, int toIndex, double direction)
Carries out the transition effect on the transitionable object by transitioning fromfromIndex
totoIndex
in the directiondirection
- Parameters:
fromIndex
- the index of theControl
to start transition fromtoIndex
- the index of theControl
to make transition todirection
- the direction of the transition
-
updateControlImage
private void updateControlImage(org.eclipse.swt.graphics.Image img, int ctrlIndex)
Update an image related to a control.- Parameters:
img
- Image to update.ctrlIndex
- Index of the control related to the image.
-
getControlImage
private org.eclipse.swt.graphics.Image getControlImage(int ctrlIndex)
Returns the image related to a control.- Parameters:
ctrlIndex
- Control's index related to the image.- Returns:
- image related to the control's index.
-
setControlImages
public void setControlImages(org.eclipse.swt.graphics.Image[] images)
Sets the control images used in the transitions processing. The control images are updated during the application execution. The old images are disposed during the control images update. This method should be invoked in the beginning of the application execution, to set the control images at an initial state. If this method is not invoked, the control images will be populated internally by this transition manager, but some flicks may be seen on the first transitions processing.- Parameters:
images
- Control images used in the transitions processing.
-
clearControlImages
public void clearControlImages()
Clears the control images used in the transitions processing. Disposes all the images as well.
-
finalize
public void finalize()
- Overrides:
finalize
in classjava.lang.Object
-
setTransition
public void setTransition(Transition transition)
Sets and changes the transition effect- Parameters:
transition
- the transition effect to be applied on the transitionable object
-
getTransition
public Transition getTransition()
Returns the current transition effect- Returns:
- the current transition effect
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)
Sets the background color of the transition frame- Parameters:
color
- the background color of the transition frame
-
getBackground
public org.eclipse.swt.graphics.Color getBackground()
Returns the background color of the transition frame- Returns:
- the background color of the transition frame
-
setBackgroundImage
public void setBackgroundImage(org.eclipse.swt.graphics.Image image)
Sets the background image of the transition frame- Parameters:
image
- the background image of the transition frame
-
getBackgroundImage
public org.eclipse.swt.graphics.Image getBackgroundImage()
Returns the background image of the transition frame- Returns:
- the background image of the transition frame
-
getTransitionable
public Transitionable getTransitionable()
Returns the transitionable object- Returns:
- the transitionable object
-
addTransitionListener
public void addTransitionListener(TransitionListener transitionListener)
Adds a new transition listener to be invoked at the end of each transition- Parameters:
transitionListener
- the new transition listener to be invoked at the end of each transition
-
removeTransitionListener
public void removeTransitionListener(TransitionListener transitionListener)
Removes a transition listener from the list of transition listeners- Parameters:
transitionListener
- the transition listener to be removed
-
-