public class TimeBar
extends javax.swing.JComponent
Representation of a sequence of activity. The TimeBar is a JComponent which will draw a horizontal bar of activity. The bar is drawn so that the TimeSpan of the bar takes up the entire width of the component. The sequence of activity (which may include one or more periods of activity) are linearly interpolated, so that the periods of activity are drawn in the foreground color of the component.
The component has no preferred size, so it should be used with Layout Managers that explicitly set the size, or have its size set by the application.
javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
TimeBar()
Creates a new TimeBar object.
|
TimeBar(Sequential timeSequence)
Creates a new TimeBar object.
|
TimeBar(Sequential timeSequence,
java.lang.String name)
Creates a new TimeBar object with a name.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
getTimeForCoord(int xCoord)
Return the time for the specified x coordinate.
|
Sequential |
getTimeSequence()
Returns the sequence of events for this timebar.
|
TimeSpan |
getTimeSpan()
Returns the time span represented by this timebar
|
protected int |
getXCoord(java.util.Date date)
Returns the X coordinate for a particular date for this timebar
|
protected void |
paintComponent(java.awt.Graphics g)
Repaints the TimeBar on the canvas.
|
protected void |
paintSpan(java.awt.Graphics g,
TimeSpan span,
java.awt.Color color)
Paint an individual span on this TimeBar in the provided color
|
void |
setTimeSequence(Sequential timeSequence)
Sets the sequence of events for this timebar.
|
void |
setTimeSpan(java.util.Date startTime,
java.util.Date stopTime)
Sets the time span of this timebar.
|
void |
setTimeSpan(TimeSpan span)
Sets the time span of this timebar.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, 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, setEnabled, 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, doLayout, 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, 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, hide, 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 TimeBar()
public TimeBar(Sequential timeSequence)
timeSequence
- the sequence of eventspublic TimeBar(Sequential timeSequence, java.lang.String name)
timeSequence
- the sequence of eventsname
- the name for this TimeBar.public java.util.Date getTimeForCoord(int xCoord)
xCoord
- the x coordinatepublic Sequential getTimeSequence()
public TimeSpan getTimeSpan()
protected int getXCoord(java.util.Date date)
date
- The date to checkprotected void paintComponent(java.awt.Graphics g)
paintSpan
on each spen within the time sequence.paintComponent
in class javax.swing.JComponent
g
- the graphics context to render intoprotected void paintSpan(java.awt.Graphics g, TimeSpan span, java.awt.Color color)
g
- the graphics context to render intospan
- the timespan to rendercolor
- the color to render the span in. If null, this method uses
the current colorpublic void setTimeSequence(Sequential timeSequence)
timeSequence
- the sequence of events for this timebar.public void setTimeSpan(java.util.Date startTime, java.util.Date stopTime)
startTime
- The start time of the timespanstopTime
- The end time of the timespanpublic void setTimeSpan(TimeSpan span)
span
- The timespan for this timebar