public class TimeSlider
extends javax.swing.JComponent
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected java.util.List<TimeRange> |
actualTimeRanges
List of valid times ranges, taking into account the minimum and maximum
|
protected double |
end
The end of the selected time range.
|
protected javax.swing.JButton |
endButton
The button used to indicate the end time.
|
protected boolean |
left |
protected double |
maximum
The maximum time.
|
static long |
MILLIS_BY_DAY |
static long |
MILLIS_BY_HOUR |
static long |
MILLIS_BY_MINUTE |
static long |
MILLIS_BY_MONTH |
static long |
MILLIS_BY_SECOND |
static long |
MILLIS_BY_WEEK |
static long |
MILLIS_BY_YEAR |
protected double |
minimum
The minimum time.
|
protected boolean |
right |
protected double |
start
The start of the selected time range.
|
protected javax.swing.JButton |
startButton
The button used to indicate the start time.
|
protected java.util.List<TimeRange> |
timeRanges
List of event markers. * protected final List
|
protected double |
value
The selected time.
|
protected javax.swing.JButton |
valueButton
The button used to indicate the time.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
TimeSlider(boolean isAbsolute)
Creates a time slider with the maximum available range.
|
Modifier and Type | Method and Description |
---|---|
void |
addTimeAdjustmentListener(TimeAdjustmentListener l)
Add a listener for time adjustments.
|
void |
clearTimeRanges()
Remove all time ranges.
|
javax.swing.JToolTip |
createToolTip()
Creates the tooltip for the component.
|
void |
doLayout()
Layout the buttons.
|
protected void |
fireBoundsChanged()
Fires a bounds changed event to all adjustment listeners.
|
void |
fireRangeChanged()
Fires a range changed event to all adjustment listeners.
|
void |
fireValueChanged()
Fires a value changed event to all adjustment listeners.
|
double |
getActualMaximum()
Get the maximum value allowed on the time slider.
|
double |
getActualMinimum()
Get the minimum value allowed on the time slider.
|
Instant |
getCurrentInstant()
Get the current DateTime if the value is changeable or null if the value
isn't changeable.
|
Instant |
getEndInstant()
Returns a DateTime instance to represents the end date
|
double |
getMaximum()
Gets the maximum allowed time value.
|
double |
getMinimum()
Gets the minimum allowed time value.
|
java.awt.Dimension |
getMinimumSize()
Get the minimum dimensions for this component.
|
double |
getNextValidTime(double time)
Get a time that is valid and greater than or equal to the current one.
|
java.awt.Dimension |
getPreferredSize()
Get the preferred size for this component.
|
Instant |
getStartInstant()
Gets the text for the tooltip.
|
boolean |
getValueChangeable() |
boolean |
isTimeValid(double time)
Tell if the time is valid with respect to the current time bounds and
ranges.
|
boolean |
isValueAdjusting()
Indicates if the value is being continuously changed in the UI.
|
void |
mouseClicked(java.awt.event.MouseEvent me)
Called when the mouse is clicked.
|
void |
mouseDragged(java.awt.event.MouseEvent me)
Called when the mouse is dragged.
|
void |
mouseEntered(java.awt.event.MouseEvent me) |
void |
mouseExited(java.awt.event.MouseEvent me) |
void |
mouseMoved(java.awt.event.MouseEvent me) |
void |
mousePressed(java.awt.event.MouseEvent me)
Called when the mouse is pressed.
|
void |
mouseReleased(java.awt.event.MouseEvent me)
Called whn the mouse is released.
|
void |
moveLeft(boolean left) |
void |
moveRight(boolean right) |
protected void |
paintComponent(java.awt.Graphics g)
Paint the components.
|
void |
removeTimeAdjustmentListener(TimeAdjustmentListener l)
Remove a listener for time adjustments.
|
void |
resetAllDates()
Reset all dates
|
void |
resetMaximumBound()
Reset to maximum date
|
void |
resetMinimumBound()
Reset to minimum date
|
void |
resetValue()
Reset to initial value date
|
void |
setCurrentInstant(Instant currentInstant)
Sets the current time of the slider
|
void |
setEnabled(boolean enabled)
Sets if this component is enabled.
|
void |
setEndInstant(Instant endInstant)
Sets the end DateTime of the slider
|
void |
setRangeChangeable(boolean changeable)
Set if a time range can be changed via the UI elements
|
void |
setStartInstant(Instant startInstant)
Set the start DateTime of the slider
|
void |
setTimeRanges(java.util.List<TimeRange> newTimeRanges)
Replace the current set of time ranges with this one.
|
void |
setValueChangeable(boolean changeable)
Sets if the time value of the slider can be changed by the UI element.
|
void |
setValues(Instant minimunInstant,
Instant maximumInstant) |
void |
setValueVisible(boolean visible)
Set if the value is visible in the slider UI.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final long MILLIS_BY_SECOND
public static final long MILLIS_BY_MINUTE
public static final long MILLIS_BY_HOUR
public static final long MILLIS_BY_DAY
public static final long MILLIS_BY_WEEK
public static final long MILLIS_BY_MONTH
public static final long MILLIS_BY_YEAR
protected double minimum
protected double start
protected double value
protected double end
protected double maximum
protected final java.util.List<TimeRange> timeRanges
protected final java.util.List<TimeRange> actualTimeRanges
protected final javax.swing.JButton startButton
protected final javax.swing.JButton valueButton
protected final javax.swing.JButton endButton
protected boolean right
protected boolean left
public TimeSlider(boolean isAbsolute)
public void setValueChangeable(boolean changeable)
changeable
- if true, the value can be changed, false otherwise.public boolean getValueChangeable()
public void setValueVisible(boolean visible)
visible
- if true the value is shown, if false the value is not shownpublic void setRangeChangeable(boolean changeable)
changeable
- if true, the time range can be changed, false otherwsiepublic void moveRight(boolean right)
public void moveLeft(boolean left)
public void setCurrentInstant(Instant currentInstant)
current
- public void setStartInstant(Instant startInstant)
start
- public void setEndInstant(Instant endInstant)
end
- public double getMinimum()
public double getMaximum()
public void resetMinimumBound()
public void resetMaximumBound()
public void resetValue()
public void resetAllDates()
public void setTimeRanges(java.util.List<TimeRange> newTimeRanges)
newTimeRanges
- a list of time rangespublic boolean isTimeValid(double time)
time
- the time to checkpublic double getNextValidTime(double time)
public void clearTimeRanges()
public boolean isValueAdjusting()
public double getActualMinimum()
public double getActualMaximum()
public void doLayout()
doLayout
in class java.awt.Container
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public javax.swing.JToolTip createToolTip()
createToolTip
in class javax.swing.JComponent
public Instant getStartInstant()
me
- the mouse event that triggered thispublic Instant getEndInstant()
public Instant getCurrentInstant()
public void mouseDragged(java.awt.event.MouseEvent me)
mouseDragged
in interface java.awt.event.MouseMotionListener
me
- the mosue event that triggered thispublic void mousePressed(java.awt.event.MouseEvent me)
mousePressed
in interface java.awt.event.MouseListener
me
- the mouse event that triggered thispublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased
in interface java.awt.event.MouseListener
me
- the mouse event that triggered thispublic void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked
in interface java.awt.event.MouseListener
me
- the mouse event that triggered thispublic void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent me)
mouseExited
in interface java.awt.event.MouseListener
public void addTimeAdjustmentListener(TimeAdjustmentListener l)
l
- the listener to addpublic void removeTimeAdjustmentListener(TimeAdjustmentListener l)
l
- the listener to removepublic void fireValueChanged()
public void fireRangeChanged()
protected void fireBoundsChanged()
public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
enabled
- true if this component should be enabled, false otherwise