public class TimeSliderComposite
extends org.eclipse.swt.widgets.Composite
Scale
widget (coarse-grained control)
To receive notifications of changes to the selected timestep, a
SelectionListener
must be registered as with a typical SWT widget.
Notifications will be posted on the UI thread.
Constructor and Description |
---|
TimeSliderComposite(org.eclipse.swt.widgets.Composite parent,
int style)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds a new listener to be notified when the selected time changes.
|
void |
dispose() |
double |
getFPS()
Gets the current playback rate in frames per second.
|
boolean |
getLoopPlayback()
Gets whether or not playback will loop back to the first timestep after
the last timestep is reached.
|
double |
getTime()
Gets the currently selected time.
|
int |
getTimestep()
Gets the currently selected timestep (the index of the selected time).
|
boolean |
isPlaying()
Gets whether the widget is currently playing.
|
boolean |
pause()
Stops playback on the widget at its current timestep.
|
boolean |
play()
Starts playback on the widget.
|
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the specified listener from this widget.
|
void |
setBackground(org.eclipse.swt.graphics.Color color) |
boolean |
setFPS(double fps)
Sets the current playback rate in frames per second.
|
boolean |
setLoopPlayback(boolean loop)
Sets whether or not playback will loop back to the first timestep after
the last timestep is reached.
|
boolean |
setTime(double time)
Updates the timestep and all embedded widgets based on the nearest known
time to the specified time.
|
void |
setTimes(java.util.List<java.lang.Double> times)
Sets the list of timesteps used by this widget.
|
boolean |
setTimestep(int index)
Updates the timestep and all embedded widgets based on the new timestep
value.
|
changed, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
public TimeSliderComposite(org.eclipse.swt.widgets.Composite parent, int style)
parent
- a widget which will be the parent of the new instance (cannot
be null)style
- the style of widget to constructpublic void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- The new listener to add.java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void dispose()
dispose
in class org.eclipse.swt.widgets.Widget
public double getFPS()
org.eclipse.swt.SWTException
- public boolean getLoopPlayback()
org.eclipse.swt.SWTException
- public double getTime()
org.eclipse.swt.SWTException
- public int getTimestep()
org.eclipse.swt.SWTException
- public boolean isPlaying()
org.eclipse.swt.SWTException
- public boolean pause()
org.eclipse.swt.SWTException
- public boolean play()
org.eclipse.swt.SWTException
- public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
listener
- The listener to remove.java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBackground(org.eclipse.swt.graphics.Color color)
setBackground
in class org.eclipse.swt.widgets.Control
public boolean setFPS(double fps)
minFPS
.fps
- The new framerate. Must be greater than the minimum allowed
framerate.org.eclipse.swt.SWTException
- public boolean setLoopPlayback(boolean loop)
loop
- If true, then the playback will be looped. If false, playback
will not be looped.org.eclipse.swt.SWTException
- public boolean setTime(double time)
Note: Calling this method from the UI thread with valid arguments will pause the widget if it is currently playing.
time
- The new time.org.eclipse.swt.SWTException
- public void setTimes(java.util.List<java.lang.Double> times)
Note: Calling this method from the UI thread with valid arguments will pause the widget if it is currently playing.
times
- The list of timesteps. Null values and duplicates will be
ignored. The list will be ordered.java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public boolean setTimestep(int index) throws java.lang.IndexOutOfBoundsException
Note: Calling this method from the UI thread with valid arguments will pause the widget if it is currently playing.
index
- The new index of the timestep.java.lang.IndexOutOfBoundsException
- If the specified index is invalid.org.eclipse.swt.SWTException
-