com.dlsc.flexgantt.swing.timeline
Class Eventline

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.dlsc.flexgantt.swing.timeline.Eventline
All Implemented Interfaces:
IEventlineModelListener, IEventlineSelectionListener, IGridComponent, IDragLayerListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.KeyEventDispatcher, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
SimpleEventline

public class Eventline
extends javax.swing.JPanel
implements IEventlineModelListener, IEventlineSelectionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.beans.PropertyChangeListener, IGridComponent, IDragLayerListener, java.awt.event.KeyListener, java.awt.KeyEventDispatcher

The eventline is one part of the timeline (the Dateline is the other) and responsible for rendering events and activities that are common to all hierarchy nodes (for example company holidays, national holidays, etc...). The eventline uses an IEventlineModel as its data source. The objects returned by the model are rendered by IEventlineObjectRenderer instances. The eventline is also capable of showing the current system time (time now).

Since:
1.0
Author:
Dirk Lemmermann
See Also:
Serialized Form

Nested Class Summary
static class Eventline.EventlineEditMode
          An enumeration of possible editing states that the eventline can be in.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String PROPERTY_CREATE_EVENTLNE_OBJECTS_ENABLED
          Constant used for property change events that get fired if the eventline object creation mode changes.
static java.lang.String PROPERTY_EVENTLINE_MODEL
          Constant used for property change events that get fired if the eventline model changes.
static java.lang.String PROPERTY_EVENTLINE_SELECTION_MODEL
          Constant used for property change events that get fired if the eventline selection model changes.
static java.lang.String PROPERTY_POLICY_PROVIDER
          Constant used for property change events that get fired if the policy provider changes.
static java.lang.String PROPERTY_TIME_NOW
          Constant used for property change events that get fired if the time now variable changes.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Eventline(Timeline timeline, Dateline dateline)
          Constructs a new eventline.
 
Method Summary
 void addGridComponentListener(IGridComponentListener l)
          Adds a listener to the grid component.
protected  java.awt.Cursor createEditModeCursor(Eventline.EventlineEditMode mode)
          Creates a cursor for the given edit mode.
 void deleteSelectedEventlineObjects()
          Deletes all currently selected eventline objects.
 boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
           
 void dragging(DragLayerEvent evt)
          Listener callback method that will be invoked when the user starts, executes or finishes drag and drop operations in the drag layer.
 void eventlineChanged(EventlineModelEvent evt)
          The listener's callback method, which gets called when eventline objects are added, removed or altered.
protected  void fireGridChanged()
          Informs all grid component listeners that the grid used by the eventline has changed.
 Dateline getDateline()
          Returns the Dateline sibling component.
 Eventline.EventlineEditMode getEditMode()
          Returns the currently active edit mode.
protected  Eventline.EventlineEditMode getEditMode(java.lang.Object eventlineObject, java.awt.event.MouseEvent evt)
          Returns an eventline edit mode for the given eventline object and mouse event.
 IEventlineObjectRenderer getEventlineObjectRenderer(java.lang.Class cl)
          Returns an eventline object renderer for an object.
 java.lang.Object[] getEventlineObjectsAt(int x, int y)
          Returns the eventline objects displayed at the given location.
 java.awt.Color getGridColor()
          Returns the color used by the dateline to draw its grid lines.
 java.lang.String getGridComponentName()
          Returns the name of the grid component.
 IGranularity getGridGranularity()
          Returns the granularity used for a virtual grid that gets used during drag & drop operations to make eventline objects snap to specific time points rather than just the current drop location.
 IGridPolicy getGridPolicy()
          Returns the grid policy used by the grid component.
 java.awt.Color getMarkerFillColor1()
          Returns the first fill color used for creating the gradient background of the time markers.
 java.awt.Color getMarkerFillColor2()
          Returns the second fill color used for creating the gradient background of the time markers.
 IEventlineMenuProvider getMenuProvider()
          Returns a menu manager that can be used by the eventline to lookup a popup menu for a specific context where the context is defined by the mouse location, the eventline objects, and the time at the location.
 IEventlineModel getModel()
          Returns the model used by the eventline.
 IPolicyProvider getPolicyProvider()
          Returns the policy provider of the eventline.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of the eventline.
 java.util.Map<java.lang.Class,IEventlineObjectRenderer> getRendererMap()
          Returns the map used to store the mappings between eventline object classes and eventline object renderers.
 int getResizeHandleSize()
          Returns the size of the resize handle located on the left and right edge of the eventline objects.
 java.lang.Object[] getSelection()
          Returns the currently selected eventline objects.
 java.awt.Color getSelectionColor()
          Returns the color used for selecting a time span in the eventline.
 IEventlineSelectionModel getSelectionModel()
          Returns the selection model used by the eventline.
 Timeline getTimeline()
          Returns the parent timeline container.
 long getTimeNow()
          Returns the time point that is considered to be time now.
 boolean isCreateEventlineObjectsEnabled()
          Determines whether the eventline generally allows the user to create new eventline objects.
 boolean isGridAdjustedMouseCursorTime()
          Determines whether the time cursor will use the grid settings of the grid component from which the last mouse event originated (default is FALSE).
 boolean isGridAutomatic()
          Determines whether the component is using an automatic grid.
 boolean isGridControlVisible()
          Determines whether the UI component used to control the grid is currently visible or not.
 boolean isTimeNowOnTop()
          Determines whether the time now marker will be drawn on top of the eventline objects or below.
 boolean isTimeNowVisible()
          Determines whether the time now will be shown with a special marker or not.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  void paintComponent(java.awt.Graphics g)
           
protected  void paintEventlineObject(java.awt.Graphics g, java.lang.Object obj, ITimeSpan objSpan)
          Draws an eventline object with the given time span.
protected  void paintEventlineObjects(java.awt.Graphics g)
          Paints the eventline objects in the eventline.
protected  void paintMarker(java.awt.Graphics g, int x, java.lang.String label, boolean leftAligned)
          Paints a marker at the given x-coordinate.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeGridComponentListener(IGridComponentListener l)
          Removes a listener from the grid component.
 void selectAllEventlineObjects()
          Selects all objects in the eventline.
 void selectionChanged(EventlineSelectionModelEvent evt)
          Listener callback method that gets invoked whenever eventline objects get added to or removed from the eventline selection model.
 void setCreateEventlineObjectsEnabled(boolean enabled)
          Specifies whether eventline objects can be created interactively by the user.
 void setEventlineObjectRenderer(java.lang.Class objectType, IEventlineObjectRenderer renderer)
          Maps the implementation of an eventline object renderer to a class definition.
 void setGridAdjustedMouseCursorTime(boolean adjusted)
          Specifies whether the time cursor will use the grid settings of the grid component from which the last mouse event originated (default is FALSE).
 void setGridAutomatic(boolean auto)
          Specifies whether the component is using an automatic grid.
 void setGridColor(java.awt.Color color)
          Sets the color used by the dateline to draw its grid lines.
 void setGridControlVisible(boolean b)
          Specifies whether the grid control will be visible in the Gantt chart.
 void setGridGranularity(IGranularity granularity)
          Sets the granularity used for a virtual grid that gets used during drag & drop operations to make eventline objects snap to specific time points rather than just the current drop location.
 void setMarkerFillColor1(java.awt.Color color)
          Sets the first fill color used for creating the gradient background of the time markers.
 void setMarkerFillColor2(java.awt.Color color)
          Sets the second fill color used for creating the gradient background of the time markers.
 void setMenuProvider(IEventlineMenuProvider provider)
          Specifies a menu manager that can be used by the eventline to lookup a popup menu for a specific context where the context is defined by the mouse location, the eventline objects, and the time at the location.
 void setModel(IEventlineModel model)
          Sets a new eventline model on the eventline.
 void setPolicyProvider(IPolicyProvider provider)
          Sets the eventline policy provider.
 void setRendererMap(java.util.Map<java.lang.Class,IEventlineObjectRenderer> map)
          Sets the map used to store the mappings between eventline object classes and eventline object renderers.
 void setResizeHandleSize(int size)
          Sets the size of the resize handle located on the left and right edge of the eventline objects.
 void setSelectionColor(java.awt.Color color)
          Sets the color used for selecting a time span in the eventline.
 void setSelectionModel(IEventlineSelectionModel model)
          Sets a new selection model to be used by the eventline.
 void setTimeNow(long time)
          Sets a new time point to be used as time now.
 void setTimeNowOnTop(boolean onTop)
          Specifies whether the time now marker will be drawn on top of the eventline objects or below.
 void setTimeNowVisible(boolean visible)
          Determines whether or not a special marker will be drawn inside the time line to highlight time now.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_TIME_NOW

public static final java.lang.String PROPERTY_TIME_NOW
Constant used for property change events that get fired if the time now variable changes.

Since:
1.0
See Also:
setTimeNow(long), Constant Field Values

PROPERTY_EVENTLINE_MODEL

public static final java.lang.String PROPERTY_EVENTLINE_MODEL
Constant used for property change events that get fired if the eventline model changes.

Since:
1.0
See Also:
setModel(IEventlineModel), Constant Field Values

PROPERTY_EVENTLINE_SELECTION_MODEL

public static final java.lang.String PROPERTY_EVENTLINE_SELECTION_MODEL
Constant used for property change events that get fired if the eventline selection model changes.

Since:
1.0
See Also:
setSelectionModel(IEventlineSelectionModel), Constant Field Values

PROPERTY_POLICY_PROVIDER

public static final java.lang.String PROPERTY_POLICY_PROVIDER
Constant used for property change events that get fired if the policy provider changes.

Since:
1.0
See Also:
setPolicyProvider(IPolicyProvider), Constant Field Values

PROPERTY_CREATE_EVENTLNE_OBJECTS_ENABLED

public static final java.lang.String PROPERTY_CREATE_EVENTLNE_OBJECTS_ENABLED
Constant used for property change events that get fired if the eventline object creation mode changes.

Since:
1.0
See Also:
setCreateEventlineObjectsEnabled(boolean), Constant Field Values
Constructor Detail

Eventline

public Eventline(Timeline timeline,
                 Dateline dateline)
Constructs a new eventline. The eventline by default sets a command interceptor for the DefaultCreateEventlineObjectCommand class. The interceptor brings up a simple dialog that allows the user to specify very basic settings.

Parameters:
timeline - the parent timeline container
dateline - the sibling dateline component that lives in the same timeline parent container
Since:
1.0
See Also:
AbstractGanttChart.setCommandInterceptor(Class, ICommandInterceptor)
Method Detail

getGridGranularity

public IGranularity getGridGranularity()
Returns the granularity used for a virtual grid that gets used during drag & drop operations to make eventline objects snap to specific time points rather than just the current drop location.

Specified by:
getGridGranularity in interface IGridComponent
Returns:
the grid granularity
Since:
1.0

getGridComponentName

public java.lang.String getGridComponentName()
Description copied from interface: IGridComponent
Returns the name of the grid component. This is useful for displaying a grid control so that the controls used for the different grid components can be distinguished from each other.

Specified by:
getGridComponentName in interface IGridComponent
Returns:
the name of the grid component

setGridGranularity

public void setGridGranularity(IGranularity granularity)
Sets the granularity used for a virtual grid that gets used during drag & drop operations to make eventline objects snap to specific time points rather than just the current drop location.

Specified by:
setGridGranularity in interface IGridComponent
Parameters:
granularity - the grid granularity
Since:
1.0
See Also:
IGridComponent.setGridAutomatic(boolean)

setGridAutomatic

public void setGridAutomatic(boolean auto)
Description copied from interface: IGridComponent
Specifies whether the component is using an automatic grid. A grid is automatic if it is not based on the grid granularity but on some other granularity of various origin. The dateline, for example, displays a major and a minor time (granularity). The minor granularity can be used for calculating grid locations.

Specified by:
setGridAutomatic in interface IGridComponent
Parameters:
auto - if TRUE the grid gets calculated automatically and not based on the given grid granularity

isGridAutomatic

public boolean isGridAutomatic()
Description copied from interface: IGridComponent
Determines whether the component is using an automatic grid. A grid is automatic if it is not based on the grid granularity but on some other granularity of various origin. The dateline, for example, displays a major and a minor time (granularity). The minor granularity can be used for calculating grid locations.

Specified by:
isGridAutomatic in interface IGridComponent
Returns:
TRUE if the grid gets calculated automatically and not based on the given grid granularity

setGridControlVisible

public void setGridControlVisible(boolean b)
Specifies whether the grid control will be visible in the Gantt chart. Calling this method will cause an event to be fired to all grid component listeners currently attached to the eventline.

Parameters:
b - if TRUE the control will be shown
Since:
1.0
See Also:
IGridComponentListener.gridComponentChanged()

isGridControlVisible

public boolean isGridControlVisible()
Description copied from interface: IGridComponent
Determines whether the UI component used to control the grid is currently visible or not.

Specified by:
isGridControlVisible in interface IGridComponent
Returns:
TRUE if the grid control is visible

getGridPolicy

public IGridPolicy getGridPolicy()
Description copied from interface: IGridComponent
Returns the grid policy used by the grid component. Each component can have its own grid policy, which is used to determine which granularities are supported by the component.

Specified by:
getGridPolicy in interface IGridComponent
Returns:
the component's grid policy

getPolicyProvider

public IPolicyProvider getPolicyProvider()
Returns the policy provider of the eventline.

Returns:
the eventline policy provider
Since:
1.0

setPolicyProvider

public void setPolicyProvider(IPolicyProvider provider)
Sets the eventline policy provider.

Parameters:
provider - the eventline policy provider
Since:
1.0

getEventlineObjectsAt

public java.lang.Object[] getEventlineObjectsAt(int x,
                                                int y)
Returns the eventline objects displayed at the given location.

Parameters:
x - the x-coordinate to check for eventline objects
y - the y-coordinate to check for eventline objects
Returns:
all eventline objects found at the given location
Since:
1.0

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of the eventline. The width is not relevant and gets dictated by the width of the Dateline. The height gets set to be equivalent to the height of the font used by the eventline plus some extra pixels to create a gap.

Overrides:
getPreferredSize in class javax.swing.JComponent
See Also:
JComponent.getPreferredSize()

getModel

public IEventlineModel getModel()
Returns the model used by the eventline.

Returns:
the data source of the eventline
Since:
1.0
See Also:
setModel(IEventlineModel)

setModel

public void setModel(IEventlineModel model)
Sets a new eventline model on the eventline. The eventline will attach itself as an IEventlineModelListener to the new model. Calling this method will cause a property change event to be fired. The name of the event will be equal to PROPERTY_EVENTLINE_MODEL.

Parameters:
model - the new eventline model
Since:
1.0
See Also:
getModel()

getSelectionModel

public IEventlineSelectionModel getSelectionModel()
Returns the selection model used by the eventline. The selection model can be queried for the selection state of each eventline model.

Returns:
the eventline selection model
Since:
1.0
See Also:
setSelectionModel(IEventlineSelectionModel)

setSelectionModel

public void setSelectionModel(IEventlineSelectionModel model)
Sets a new selection model to be used by the eventline. The eventline will attach itself an an IEventlineSelectionListener to the model. Calling this method will cause a property change event to be fired (event name equals PROPERTY_EVENTLINE_SELECTION_MODEL).

Parameters:
model - the new selection model
Since:
1.0

getTimeline

public Timeline getTimeline()
Returns the parent timeline container.

Returns:
the parent timeline container
Since:
1.0

getDateline

public Dateline getDateline()
Returns the Dateline sibling component.

Returns:
the dateline that lives in the same timeline container
Since:
1.0

setTimeNowVisible

public void setTimeNowVisible(boolean visible)
Determines whether or not a special marker will be drawn inside the time line to highlight time now.

Parameters:
visible - if TRUE the time now will be shown with a special marker
Since:
1.0
See Also:
isTimeNowVisible()

isTimeNowVisible

public boolean isTimeNowVisible()
Determines whether the time now will be shown with a special marker or not.

Returns:
TRUE if the time now will be marked in the eventline
Since:
1.0
See Also:
setTimeNowVisible(boolean)

setTimeNow

public void setTimeNow(long time)
Sets a new time point to be used as time now.

Parameters:
time - the new time point that will be used as time now
Since:
1.0
See Also:
getTimeNow()

getTimeNow

public long getTimeNow()
Returns the time point that is considered to be time now.

Returns:
the time now in milliseconds
Since:
1.0
See Also:
setTimeNow(long)

getGridColor

public java.awt.Color getGridColor()
Returns the color used by the dateline to draw its grid lines.

Returns:
the grid line color
Since:
1.0

setGridColor

public void setGridColor(java.awt.Color color)
Sets the color used by the dateline to draw its grid lines.

Parameters:
color - the grid line color
Since:
1.0

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintMarker

protected void paintMarker(java.awt.Graphics g,
                           int x,
                           java.lang.String label,
                           boolean leftAligned)
Paints a marker at the given x-coordinate. Markers are used for such things as time now or the time at the current mouse location.

Parameters:
g - the graphics context in which to draw the marker
x - the x-coordinate of the marker
label - the label shown to the right of the marker
leftAligned - if TRUE the marker will start at the given x coordinate, otherwise it will end there
Since:
1.0

paintEventlineObjects

protected void paintEventlineObjects(java.awt.Graphics g)
Paints the eventline objects in the eventline.

Parameters:
g - the graphics context in which to draw
Since:
1.0

paintEventlineObject

protected void paintEventlineObject(java.awt.Graphics g,
                                    java.lang.Object obj,
                                    ITimeSpan objSpan)
Draws an eventline object with the given time span. This method will lookup an IEventlineObjectRenderer implementation, retrieve a renderer component from it and set the component's bounds based on the given time span.

Parameters:
g - the graphics context into which to draw
obj - the eventline object that gets drawn
objSpan - the time span used by the eventline object
Since:
1.0
See Also:
setEventlineObjectRenderer(Class, IEventlineObjectRenderer)

getMenuProvider

public IEventlineMenuProvider getMenuProvider()
Returns a menu manager that can be used by the eventline to lookup a popup menu for a specific context where the context is defined by the mouse location, the eventline objects, and the time at the location.

Returns:
a menu provider for retrieving context-aware popup menus
Since:
1.0

setMenuProvider

public void setMenuProvider(IEventlineMenuProvider provider)
Specifies a menu manager that can be used by the eventline to lookup a popup menu for a specific context where the context is defined by the mouse location, the eventline objects, and the time at the location.

Parameters:
provider - the provider that will be used by the layer container to find a suitable popup menu for a specific context
Since:
1.0

eventlineChanged

public void eventlineChanged(EventlineModelEvent evt)
Description copied from interface: IEventlineModelListener
The listener's callback method, which gets called when eventline objects are added, removed or altered.

Specified by:
eventlineChanged in interface IEventlineModelListener
Parameters:
evt - the event sent by the eventline model.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

getEditMode

protected Eventline.EventlineEditMode getEditMode(java.lang.Object eventlineObject,
                                                  java.awt.event.MouseEvent evt)
Returns an eventline edit mode for the given eventline object and mouse event. This method determines what kind of editing operation shall take place when the mouse cursor is at a specific location above the eventline object. For example: a resize (change duration) operation can be executed if the cursor hovers on top of the right edge of the eventline object.

Parameters:
eventlineObject - the object for which to return an edit mode
evt - the mouse event
Returns:
an edit mode for the given eventline object and mouse event
Since:
1.0

getSelection

public java.lang.Object[] getSelection()
Returns the currently selected eventline objects.

Returns:
the currently selected eventline objects
Since:
1.0
See Also:
IEventlineSelectionModel.getSelection()

selectionChanged

public void selectionChanged(EventlineSelectionModelEvent evt)
Description copied from interface: IEventlineSelectionListener
Listener callback method that gets invoked whenever eventline objects get added to or removed from the eventline selection model.

Specified by:
selectionChanged in interface IEventlineSelectionListener
Parameters:
evt - the selection model event with detailed information about the kind of change that happened inside the selection model

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

setEventlineObjectRenderer

public void setEventlineObjectRenderer(java.lang.Class objectType,
                                       IEventlineObjectRenderer renderer)
Maps the implementation of an eventline object renderer to a class definition.

Parameters:
objectType - the type of those eventline objects that will be rendered with the given renderer
renderer - an implementation that will be used to renderer instances of the given object type
Since:
1.0
See Also:
DefaultEventlineObjectRenderer, getEventlineObjectRenderer(Class)

getEventlineObjectRenderer

public IEventlineObjectRenderer getEventlineObjectRenderer(java.lang.Class cl)
Returns an eventline object renderer for an object. The lookup of the renderer is based on the object type of the given object. This method will return the default eventline object renderer if no other renderer was explicitly assigned to the type or any supertype of the given object.

Parameters:
cl - the object type in need of rendering
Returns:
a matching eventline object renderer implementation
Since:
1.0
See Also:
setEventlineObjectRenderer(Class, IEventlineObjectRenderer), DefaultEventlineObjectRenderer

getRendererMap

public java.util.Map<java.lang.Class,IEventlineObjectRenderer> getRendererMap()
Returns the map used to store the mappings between eventline object classes and eventline object renderers.

Returns:
the renderer map
Since:
1.0

setRendererMap

public void setRendererMap(java.util.Map<java.lang.Class,IEventlineObjectRenderer> map)
Sets the map used to store the mappings between eventline object classes and eventline object renderers.

Parameters:
map - the renderer map
Since:
1.0

isCreateEventlineObjectsEnabled

public boolean isCreateEventlineObjectsEnabled()
Determines whether the eventline generally allows the user to create new eventline objects. For fine grained control the application can use the IEditEventlineObjectPolicy.

Returns:
TRUE if the eventline supports the creation of new eventline objects
Since:
1.0

setCreateEventlineObjectsEnabled

public void setCreateEventlineObjectsEnabled(boolean enabled)
Specifies whether eventline objects can be created interactively by the user. For more fine grained control whether an eventline object can be created at a specific time the IEditEventlineObjectPolicy can be used.

Parameters:
enabled - if TRUE the user is generally allowed to create new eventline objects
Since:
1.0

addGridComponentListener

public void addGridComponentListener(IGridComponentListener l)
Description copied from interface: IGridComponent
Adds a listener to the grid component. The listener will be informed whenever the grid granularity used by the component gets changed.

Specified by:
addGridComponentListener in interface IGridComponent
Parameters:
l - the grid component listener

removeGridComponentListener

public void removeGridComponentListener(IGridComponentListener l)
Description copied from interface: IGridComponent
Removes a listener from the grid component.

Specified by:
removeGridComponentListener in interface IGridComponent
Parameters:
l - the grid component listener that gets removed

fireGridChanged

protected void fireGridChanged()
Informs all grid component listeners that the grid used by the eventline has changed.

Since:
1.0

dragging

public void dragging(DragLayerEvent evt)
Description copied from interface: IDragLayerListener
Listener callback method that will be invoked when the user starts, executes or finishes drag and drop operations in the drag layer.

Specified by:
dragging in interface IDragLayerListener
Parameters:
evt - the event describing the drag operation

getSelectionColor

public java.awt.Color getSelectionColor()
Returns the color used for selecting a time span in the eventline.

Returns:
the time span selection color
Since:
1.0

setSelectionColor

public void setSelectionColor(java.awt.Color color)
Sets the color used for selecting a time span in the eventline.

Parameters:
color - the time span selection color
Since:
1.0

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

selectAllEventlineObjects

public void selectAllEventlineObjects()
Selects all objects in the eventline. This is a convenience method,which delegates to the selection model.

Since:
1.0
See Also:
IEventlineSelectionModel.addSelection(Object)

deleteSelectedEventlineObjects

public void deleteSelectedEventlineObjects()
Deletes all currently selected eventline objects. This method will create a compound command, which will consist of a number of delete commands.

Since:
1.0
See Also:
IEditEventlineObjectPolicy.isDeletable(Object, IEventlineModel), IEditEventlineObjectPolicy.getDeleteCommand(Object, IEventlineModel)

isGridAdjustedMouseCursorTime

public boolean isGridAdjustedMouseCursorTime()
Determines whether the time cursor will use the grid settings of the grid component from which the last mouse event originated (default is FALSE). Some applications prefer to have the current grid being reflected by the mouse cursor.

Returns:
TRUE if the mouse cursor time will use the grid component's grid settings
Since:
1.0

setGridAdjustedMouseCursorTime

public void setGridAdjustedMouseCursorTime(boolean adjusted)
Specifies whether the time cursor will use the grid settings of the grid component from which the last mouse event originated (default is FALSE). Some applications prefer to have the current grid being reflected by the mouse cursor.

Parameters:
adjusted - if TRUE the mouse cursor time will use the grid component's grid settings
Since:
1.0

createEditModeCursor

protected java.awt.Cursor createEditModeCursor(Eventline.EventlineEditMode mode)
Creates a cursor for the given edit mode. This method uses the IconRegistry to lookup the cursor images. The following IDs are being used:

Parameters:
mode - the eventline edit mode
Returns:
a cursor for the edit mode
Since:
1.0

getResizeHandleSize

public int getResizeHandleSize()
Returns the size of the resize handle located on the left and right edge of the eventline objects. The handles are used to change the start or end time of an eventline object.

Returns:
the size of the resize handle used for editing the eventline object
Since:
1.0

setResizeHandleSize

public void setResizeHandleSize(int size)
Sets the size of the resize handle located on the left and right edge of the eventline objects. The handles are used to change the start or end time of an eventline object.

Parameters:
size - the size of the resize handle used for editing the eventline object
Since:
1.0

getMarkerFillColor1

public java.awt.Color getMarkerFillColor1()
Returns the first fill color used for creating the gradient background of the time markers.

Returns:
the first background color
Since:
1.0

setMarkerFillColor1

public void setMarkerFillColor1(java.awt.Color color)
Sets the first fill color used for creating the gradient background of the time markers.

Parameters:
color - the first background color
Since:
1.0

getMarkerFillColor2

public java.awt.Color getMarkerFillColor2()
Returns the second fill color used for creating the gradient background of the time markers.

Returns:
the first background color
Since:
1.0

setMarkerFillColor2

public void setMarkerFillColor2(java.awt.Color color)
Sets the second fill color used for creating the gradient background of the time markers.

Parameters:
color - the second background color
Since:
1.0

getEditMode

public Eventline.EventlineEditMode getEditMode()
Returns the currently active edit mode.

Returns:
the edit mode used by the eventline
Since:
1.0

dispatchKeyEvent

public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
Specified by:
dispatchKeyEvent in interface java.awt.KeyEventDispatcher

isTimeNowOnTop

public boolean isTimeNowOnTop()
Determines whether the time now marker will be drawn on top of the eventline objects or below.

Returns:
TRUE if the time now marker gets drawn on top of the eventline objects
Since:
1.0

setTimeNowOnTop

public void setTimeNowOnTop(boolean onTop)
Specifies whether the time now marker will be drawn on top of the eventline objects or below.

Parameters:
onTop - TRUE if the time now marker gets drawn on top of the eventline objects
Since:
1.0