de.jaret.util.ui.timebars.swt
Class TimeBarViewer

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by de.jaret.util.ui.timebars.swt.TimeBarViewer
All Implemented Interfaces:
TimeBarViewerInterface, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.swt.graphics.Drawable

public class TimeBarViewer
extends org.eclipse.swt.widgets.Canvas
implements TimeBarViewerInterface, org.eclipse.jface.viewers.ISelectionProvider

Viewer for a TimeBarModel (SWT version). Displays the intervals using a renderer. Supports sorting and/or filtering of the rows in the model without affecting the model itself.

The implementation depends on the TimeBarViewerDelegate for the operations and calculations that is shared between the Swing and the SWT implementation of the viewer. There is no accesor to access the delegate directly. However the documentation of the delegate can be helpful. The delegate can temporarily be accessed getData("delegate") for debugging and experimental features.

The timebar viewer is an implementation of the ISelectionProvider working with structured selections containing rows and intervals.

Keyboard bindings

Version:
$Id: TimeBarViewer.java 1097 2011-11-06 21:44:47Z kliem $
Author:
Peter Kliem

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
TimeBarViewerInterface.Orientation
 
Field Summary
protected  JaretTimeBarsActionFactory _actionFactory
          factory for creating standard actions.
protected  org.eclipse.swt.widgets.Menu _bodyContextMenu
          context menu for the main viewer body.
protected  TimeBarViewerDelegate _delegate
          This delegate encapsules the main part of the functionality of the the viewer.
protected  TimeBarGapRenderer _gapRenderer
          Renderer for doing rendering in th egaps between intervals.
protected  int _ghostAlpha
          alpha for ghost drawing.
protected  java.util.List<de.jaret.util.date.Interval> _ghostIntervals
          list of ghost intervals to be painted.
protected  java.util.List<java.lang.Integer> _ghostIntervalYCoordinates
          y offsets for the ghost intervals.
protected  org.eclipse.swt.graphics.Point _ghostOrigin
          the origin for painting the ghost intervals/rows.
protected  java.util.List<TimeBarRow> _ghostRows
          list of ghost rows to paint.
protected  java.util.List<java.lang.Integer> _ghostRowYCoordinates
          y offsets for the ghost rows.
protected  GlobalAssistantRenderer _globalRenderer
          Renderer for doing global rendering.
protected  GridRenderer _gridRenderer
          Renderer for rendering the grid.
protected  RowContextMenuHandler _headerCtxHandler
          handler for retrieving a context menu for the header area.
protected  HeaderRenderer _headerRenderer
          Renderer to render the row headings.
protected  RowContextMenuHandler _hierarchyCtxHandler
          handler for retrieving a context menu for the hierarchy.
protected  HierarchyRenderer _hierarchyRenderer
          Renderer for the hierarchy view (tree structure).
protected  org.eclipse.swt.widgets.Menu _intervalContextMenu
          context menu displayed for intervals.
protected  TimeBarMarkerRenderer _markerRenderer
          Renderer for the timebar markers.
protected  IMiscRenderer _miscRenderer
          Renderer for rendering various bits.
protected  java.beans.PropertyChangeSupport _propertyChangeSupport
          Delegate to handle property change listener support.
protected  IRelationRenderer _relationRenderer
          renderer for drawing interval relations. no default renderer is setup.
protected  java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> _rendererMap
          mapping between interval classes and renderers.
protected  org.eclipse.swt.graphics.Color _rowGridColor
          color for row grid lines.
protected  org.eclipse.swt.widgets.Menu _scaleContextMenu
          context menu displayed for the time scale.
protected  java.util.List<org.eclipse.jface.viewers.ISelectionChangedListener> _selectionChangeListeners
          list of Iselction listeners
protected  TimeScaleRenderer _timeScaleRenderer
          Renderer used to render the timescale.
protected  org.eclipse.swt.widgets.Menu _titleContextMenu
          context menu for the title area.
protected  TitleRenderer _titleRenderer
          Renderer for rendering the title area.
static int DEFAULT_ALPHA
          default alpha for ghost draw and row highlighting.
protected static int INCREMENTDIVISOR_X
          Number of seconds will be divided by this divisor for determing arrow incremtn of the scrollbar.
protected static int INCREMENTDIVISOR_Y
          Number of rows will be divided by this divisor for determing arrow incremtn of the scrollbar.
protected static org.eclipse.swt.graphics.Color LINECOLOR
          Color used to render the limiting lines.
static org.eclipse.swt.graphics.Color ROWGRID_COLOR
          default color for rowgrid.
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
DEFAULT_ROWHEIGHT, DEFAULT_XAXISHEIGHT, DEFAULT_YAXISWIDTH, PROPERTYNAME_FIRSTROW, PROPERTYNAME_FIRSTROWOFFSET, PROPERTYNAME_INTERVALFILTER, PROPERTYNAME_MAXDATE, PROPERTYNAME_MINDATE, PROPERTYNAME_PIXELPERSECOND, PROPERTYNAME_ROWFILTER, PROPERTYNAME_ROWHEIGHT, PROPERTYNAME_ROWHEIGHTDRAGGINGALLOWED, PROPERTYNAME_ROWSORTER, PROPERTYNAME_STARTDATE, PROPERTYNAME_XAXISHEIGHT, PROPERTYNAME_YAXISWIDTH, TIMESCALE_POSITION_BOTTOM, TIMESCALE_POSITION_NONE, TIMESCALE_POSITION_TOP
 
Constructor Summary
TimeBarViewer(org.eclipse.swt.widgets.Composite parent, int style)
          Constructor for a timebarviewer.
 
Method Summary
 void addFocussedIntervalListener(FocussedIntervalListener listener)
          Add a listener to be informed when the focus inside the viewer changes.
 void addIntervalModificator(IntervalModificator intervalModificator)
          Add an intervalModificator controlling changes on the intervals.
 void addMarker(TimeBarMarker marker)
          Add a timebar marker.
 void addMarkers(java.util.List<TimeBarMarker> markers)
          Directly set a list of markers.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener.
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          
 void addSelectionRectListener(ISelectionRectListener listener)
          Add a listener to be informed when the selection rect changes.
 void addTimeBarChangeListener(ITimeBarChangeListener listener)
          Add a listener to be informaed about interval changes.
 void clearRegionRect()
          Remove the selction of a region if existent.
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
          
static org.eclipse.swt.graphics.Rectangle convertRect(java.awt.Rectangle rect)
          Convert a java.awt.Rectangle to a org.eclipse.Rectangle.
 de.jaret.util.date.JaretDate dateForX(int x)
          Get the corresponding date for an x coordinate in the viewer area.
 de.jaret.util.date.JaretDate dateForXY(int x, int y)
          Get the corresponding date for a point in the viewer area.
 void deHighlightRow()
          
 void displayBodyContextMenu(int x, int y)
          Display the context menu for the normal viewer body.
 void displayHeaderContextMenu(TimeBarRow row, int x, int y)
          Display the header context menu.
 void displayHierarchyContextMenu(TimeBarRow row, int x, int y)
          Display the hierarchy area context menu.
 void displayIntervalContextMenu(de.jaret.util.date.Interval interval, int x, int y)
          Display the context menu for an interval.
 void displayTimeScaleContextMenu(int x, int y)
          Display the context menu for the time scale.
 void displayTitleContextMenu(int x, int y)
          Display the title area context menu.
 void doScrollHorizontal(int diff)
          Do horizontal scrolling by diff pixel.
 void doScrollVertical(int diff)
          Do vertical scrolling by diff pixel.
 void firePropertyChange(java.lang.String string, double oldValue, double newValue)
          Fire a property change.
 void firePropertyChangeX(java.lang.String propName, java.lang.Object oldVal, java.lang.Object newVal)
          Fire a property change.
 void fireSelectionChanged()
          Callback for delegate.
 JaretTimeBarsActionFactory getActionFactory()
          Retrieve a configured action factory.
 boolean getAdjustMinMaxDatesByModel()
          Retrieve the adjustment policy for min and max date.
 int getAutoScaleRows()
          Get the number of rows (columns) that the viewer scales itself to.
 int getAutoscrollDelta()
          Retrieve the currently set autoscroll delta.
 org.eclipse.swt.widgets.Menu getBodyContextMenu()
           
 TimeBarViewerDelegate getDelegate()
          Retrieve the delegate ATTENTION: the delegate is for mostly internal usage only.
 boolean getDragAllSelectedIntervals()
          If true all selected intervals will be dragged together with the interval on that the drag happened.
 boolean getDrawOverlapping()
          Retrieve the drawing mode.
 boolean getDrawRowGrid()
          Retrieve the status of row grid drawing.
 de.jaret.util.date.JaretDate getEndDate()
          Get the las date painted.
 int getFirstRowDisplayed()
          Retrieve the index of the first row that is displayed.
 int getFirstRowOffset()
          Retrieve the pixeloffset for the first row.
 de.jaret.util.date.Interval getFocussedInterval()
          Retrieve the focussed interval.
 TimeBarRow getFocussedRow()
           
 TimeBarGapRenderer getGapRenderer()
           
 int getGhostAlpha()
          Get the alpha used when drawing ghosted intervals.
 GlobalAssistantRenderer getGlobalAssistantRenderer()
          Retrive the global assistant renderer if set.
 GridRenderer getGridRenderer()
           
 RowContextMenuHandler getHeaderCtxHandler()
           
 HeaderRenderer getHeaderRenderer()
           
 java.lang.String getHeaderToolTipText(TimeBarRow row, int x, int y)
          Retrieve the tooltip for a position on a row.
 int getHeight()
          Return the height of the viewer.
 boolean getHideRoot()
          Retrieve whether the root node is shown when using a hierachical model.
 HierarchicalTimeBarModel getHierarchicalModel()
          Retrieve the hierarchical model of the viewer.
 HierarchicalViewState getHierarchicalViewState()
          Retrieve the hierarchical viewstate used by the viewer.
 RowContextMenuHandler getHierarchyCtxHandler()
           
 HierarchyRenderer getHierarchyRenderer()
          Retrieve the hierarchy renderer.
 java.lang.String getHierarchyToolTipText(TimeBarNode node, int x, int y)
          Retrieve the tooltip for a position in the hierarchy.
 int getHierarchyWidth()
          Retrieve the width of the hierarchy area.
 int getHighlightAlpha()
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 org.eclipse.swt.graphics.Color getHighlightColor()
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 org.eclipse.swt.graphics.Rectangle getIntervalBounds(de.jaret.util.date.Interval interval)
          Retrieve the bounding rect of an interval.
 org.eclipse.swt.widgets.Menu getIntervalContextMenu()
           
 TimeBarIntervalFilter getIntervalFilter()
          Retrieve the used interval filter.
 java.util.List<de.jaret.util.date.Interval> getIntervalsAt(int x, int y)
          Retrieves all intervals at a given point in the diagram pane.
 java.lang.String getIntervalToolTipText(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, int x, int y)
          Get the tooltip text for a given location in a rendered interval.
 int getKeyboardChangeDelta()
          Retrieve the keyboardChangeDelta currently used.
 boolean getMarkerDraggingInDiagramArea()
          Retrieve whether marker dragging in the diagram area is activated.
 TimeBarMarkerRenderer getMarkerRenderer()
          Retrieve the used marker renderer.
 java.util.List<TimeBarMarker> getMarkers()
          Retrieve the list of al markers.
 int getMarkerWidth(TimeBarMarker marker)
          Get the width for marker painting (as requested by a marker renderer).
 de.jaret.util.date.JaretDate getMaxDate()
          Retrieve the maximum date that can be displayed.
 de.jaret.util.date.JaretDate getMinDate()
          Retrieve the minimum value present in the data of the viewer.
 IMiscRenderer getMiscRenderer()
          Retrieve the current misc renderer.
 TimeBarModel getModel()
          Retrieve the flat model used by the viewer.
 java.lang.String getName()
          Retrieve the name set on the viewer.
 boolean getOptimizeScrolling()
          Get whether optimzed scrollnig is used.
 IOverlapStrategy getOverlapStrategy()
          Retrieve the used strategy for determing overlap information.
 double getPixelPerSecond()
          Return the pixel per second ratio.
 de.jaret.util.misc.Pair<TimeBarRow,de.jaret.util.date.JaretDate> getPopUpInformation()
          Retrieve the row and date of the click leading to the activation of a context menu.
 TimeBarNode getPpsRow()
          Retrieve the row that hold intervals (PpsIntervals) defining the pps value for different intervals.
 TBRect getRegionRect()
          Retrieve the selected region.
 boolean getRegionRectEnable()
          Retrieve whether region selections are enabled.
 IRelationRenderer getRelationRenderer()
          Retrieve the relation renderer.
 java.util.List<IIntervalRelation> getRelationsForCoord(int x, int y)
          Retrieve the list of relations hit for a coordinate.
 java.lang.String getRelationTooltip(int x, int y)
          Provide the tooltip for a relation if any.
protected  TimeBarRenderer getRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> clazz)
          Retrieve a renderer for a given class.
 java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> getRendererMapping()
          Retrieve the complete renderer map.
 TimeBarRowFilter getRowFilter()
          Get the used row filter.
 TimeBarRow getRowForXY(int x, int y)
          Retrieve the row for a given point.
 TimeBarRow getRowForY(int y)
          Retrieve the row for a given y coodinate (x if oriented vertcal; use getRowForXY instead!).
 org.eclipse.swt.graphics.Color getRowGridColor()
          Retrieve color for the row grid.
 int getRowHeight()
          Retrieve the current row height or the default row height if variable row heights/widths are enabled.
 org.eclipse.swt.graphics.Color getRowSelectColor()
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 TimeBarRowSorter getRowSorter()
          Retrive sorter used.
 org.eclipse.swt.widgets.Menu getScaleContextMenu()
           
 int getScrollLookBackMinutes()
          Retrieve the time to be additionally considered (looking back) when deciding which intervals are to be painted.
 int getScrollLookForwardMinutes()
          Retrieve the time to be additionally considered (looking forward) when deciding which intervals are to be painted.
 boolean getScrollOnFocus()
          Retrieve the state of the scroll to focus flag.
 int getSecondsDisplayed()
          Get the seconds currently displayed by the diagram.
 org.eclipse.jface.viewers.ISelection getSelection()
           Will return a structured selection conaining selected rows and selected intervals.
 int getSelectionDelta()
          Retrieve the selection delta used to determine whether a marker or interval edge is clicked/dragged.
 TimeBarSelectionModel getSelectionModel()
          Get the selection model of the viewer.
 de.jaret.util.date.JaretDate getStartDate()
          Retrive the current start date of the displayed time span.
 boolean getStrictClipTimeCheck()
          Retrieve the strategy for filtering when painting (see TimeBarViewerInterface.setStrictClipTimeCheck(boolean)).
 TimeBarViewerInterface.Orientation getTBOrientation()
          Retrieve the orientation of the viewer.
 TimeBarRenderer getTimeBarRenderer()
          Retrieve the default renderer currently used for rendering intervals (regsitered for Interval.class).
 ITimeBarViewState getTimeBarViewState()
          Retrieve the statndard viewstate of the viewer containing the row heights/column widths.
 int getTimeScalePosition()
          
 TimeScaleRenderer getTimeScaleRenderer()
           
 java.lang.String getTimeScaleToolTipText(int x, int y)
          Retrieve the tooltip for a position on the timescale.
 java.lang.String getTitle()
          Retrieve the title.
 org.eclipse.swt.widgets.Menu getTitleContextMenu()
           
 TitleRenderer getTitleRenderer()
           
 boolean getUseUniformHeight()
          Retrieve whether uniform height is use for all intervals in a row.
 int getWidth()
          Return the width of the viewer.
 int getXAxisHeight()
          Retrieve the height (or width when orientation is vertical) of the timescale.
 int getYAxisWidth()
          Retrieve the width of the y axis (header area).
 int getYForRow(TimeBarRow row)
          Retrieve the y coordinate in the diagram pane for the given row.
 boolean hasVariableXScale()
          Retrieve the state of the variable xscale state.
 void highlightRow(int y)
          
 void highlightRow(TimeBarRow timeBarRow)
          
 boolean isAutoscrollEnabled()
          Get the autoscroll behaviour.
 boolean isDisplayed(de.jaret.util.date.JaretDate date)
          Check whether a date is currently visible.
 boolean isFocussed(de.jaret.util.date.Interval interval)
          Check whether an interval is focussed.
 boolean isInDiagram(int x, int y)
          Check whether a given point is in the main diagram area.
 boolean isInHierarchySelectionArea(TimeBarNode node, int xx, int yy)
          Check whether the given position is in the selection area of the hierarchy.
 boolean isInRowAxis(int x, int y)
          Check whether a given point is in the row axis area (hierarchy or header).
 boolean isInToggleArea(TimeBarNode node, int xx, int yy)
          Check whether the given position should toggle expanded state of a node.
 boolean isLineDraggingAllowed()
          Check whether it is allowed to drag the limiting lines of the hierarchy ara and the header (yaxis) area.
 boolean isMilliAccuracy()
          Check whether th delegate is setup for millisecond accuracy.
 boolean isRowHeightDragginAllowed()
          Check whether row height dragging is allowed.
 void onDispose()
          Dispose all renderes.
 void registerTimeBarRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> intervalClass, TimeBarRenderer renderer)
          Register a renderer for an interval class or interface.
 void remFocussedIntervalListener(FocussedIntervalListener listener)
          Remove a focussedIntervalListener.
 void remIntervalModificator(IntervalModificator intervalModificator)
          Remove an interval modificator.
 void remMarker(TimeBarMarker marker)
          Remove a timebar marker.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener.
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          
 void removeTimeBarChangeListener(ITimeBarChangeListener listener)
          Remove a timebar change listener.
 void remSelectionRectListener(ISelectionRectListener listener)
          Remove a selection rect listener.
 void repaint()
          Mark the whole viewer as dirty causing a repaint.
 void repaint(int x, int y, int width, int height)
          Mark area the needs repaint.
 void repaint(java.awt.Rectangle rectangle)
          Mark area to be repainted.
 TimeBarRow rowForY(int y)
          
 boolean rowLineHit(int x, int y)
          Check whether a row delimiter line is hit by a coordinate.
 int scrollDateToVisible(de.jaret.util.date.JaretDate date)
          Scroll a date into the visible area of the viewer.
 void scrollIntervalToVisible(de.jaret.util.date.Interval interval)
          Make sure the specified interval is in the visibe area of the viewer.
 void scrollIntervalToVisible(de.jaret.util.date.Interval interval, double horizontalRatio, double verticalRatio)
          Scroll an intervall into the visible area on a position specified by a ratio.
 void scrollIntervalToVisible(TimeBarRow row, de.jaret.util.date.Interval interval)
          Make sure the specified interval is in the visibe area of the viewer.
 void scrollRowToVisible(TimeBarRow row)
          Make sure the specified row is visible.
 void setAdjustMinMaxDatesByModel(boolean adjust)
          Set the adjustment policy.
 void setAutoScaleRows(int rows)
          Set a number of rows (columns) to be displayed by the viewer.
 void setAutoscrollDelta(int autoscrollDelta)
          Set the autoscroll delta.
 void setAutoscrollEnabled(boolean enableAutoscroll)
          Set the autoscroll behaviour.
 void setBodyContextMenu(org.eclipse.swt.widgets.Menu bodyContextMenu)
           
 void setCursor(int cursorType)
          Set the cursor type.
 void setDragAllSelectedIntervals(boolean dragAllSelectedIntervals)
          If set to true all selected intervals are dragged when an interval is dragged.
 void setDrawOverlapping(boolean drawOverlapping)
          Set the drawing mode.
 void setDrawRowGrid(boolean drawRowGrid)
          Set the row grid drawing status.
 void setFirstRow(int firstRow, int pixOffset)
          Set the first row to be displayed.
 void setFirstRowDisplayed(int rowIdx)
          Set the first row to be displayed.
 void setFirstRowDisplayed(TimeBarRow row)
          Set the the first row to be displayed.
 void setFirstRowOffset(int offset)
          Set the pixeloffset of the first row.
 void setFocussedInterval(de.jaret.util.date.Interval interval)
          Set the new focussed interval.
 void setFocussedInterval(TimeBarRow row, de.jaret.util.date.Interval interval)
          Set the new focussed interval.
 void setGapRenderer(TimeBarGapRenderer gapRenderer)
           
 void setGhostAlpha(int ghostAlpha)
          Set the alpha value used for drawing ghost intervals.
 void setGhostInterval(de.jaret.util.date.Interval interval, int y)
          Convenience method to set a single ghost interval.
 void setGhostIntervals(java.util.List<de.jaret.util.date.Interval> intervals, java.util.List<java.lang.Integer> yCoordinates)
          Set the list of ghost intervals to be drawn.
 void setGhostOrigin(int x, int y)
          Set the origin (current drag position) to shift the ghost elements.
 void setGhostRow(TimeBarRow row, int y)
          Convenience method to set a single ghost row.
 void setGhostRows(java.util.List<TimeBarRow> rows, java.util.List<java.lang.Integer> yCoordinates)
          Set the list of ghost rows to be drawn.
 void setGlobalAssistantRenderer(GlobalAssistantRenderer gar)
          Set a global renderer doing rendering work other than oriented on one interval or row.
 void setGridRenderer(GridRenderer gridRenderer)
           
 void setHeaderCtxHandler(RowContextMenuHandler headerCtxHandler)
           
 void setHeaderRenderer(HeaderRenderer headerRenderer)
           
 void setHideRoot(boolean hideRoot)
          Set whether the root node should be shown when using a hierachical model.
 void setHierarchicalViewState(HierarchicalViewState hierarchicalViewState)
          Set the hierarchical viewstate to be used.
 void setHierarchyCtxHandler(RowContextMenuHandler hierarchyCtxHandler)
           
 void setHierarchyRenderer(HierarchyRenderer hierarchyRenderer)
          Set a renderer for the hierachy elements.
 void setHierarchyWidth(int width)
          Set the width of the hierarchy area of the viewer.
 void setHighlightAlpha(int highlightAlpha)
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 void setHighlightColor(org.eclipse.swt.graphics.Color highlightColor)
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 void setInitialDisplayRange(de.jaret.util.date.JaretDate startDate, int secondsDisplayed)
          Set a date range and scaling that will be set as the initial display right after the viewer is displayed.
 void setIntervalContextMenu(org.eclipse.swt.widgets.Menu intervalContextMenu)
          Set the interval context menu.
 void setIntervalFilter(TimeBarIntervalFilter intervalFilter)
          Set an interval filter to select a subset of intervals that will be displayed.
 void setKeyboardChangeDelta(int keyboardChangeDelta)
          Set the delta for resizing and moving via keyboard.
 void setLastRow(int index)
          Set the last row in the viewer.
 void setLastRow(TimeBarRow row)
          Set the last row in the viewer.
 void setLineDraggingAllowed(boolean lineDraggingAllowed)
          Set the allowance for line dragging of the limiting lines for hierarchy and header(yaxis) areas.
 void setMarkerDraggingInDiagramArea(boolean allowed)
          Set whether marker dragging is allowed in the diagram area (If intervals are modificable the marker will only be grabbed when no other operation is applicable).
 void setMarkerRenderer(TimeBarMarkerRenderer markerRenderer)
          Set a renderer to be used for renering markers.
 void setMaxDate(de.jaret.util.date.JaretDate maxDate)
          Set the maximum date to be displayed.
 void setMilliAccuracy(boolean milliAccuracy)
          Set the delegates status concerning millisecond accuracy.
 void setMinDate(de.jaret.util.date.JaretDate minDate)
          Set the minimum date to be displayed.
 void setMiscRenderer(IMiscRenderer miscRenderer)
          Set the misc renderer to use.
 void setModel(HierarchicalTimeBarModel hModel)
          Set a hierarchical model to be displayed.
 void setModel(TimeBarModel model)
          Set the flat model to be displayed.
 void setName(java.lang.String name)
          Set a name as a simple string property for internal application use.
 void setOptimizeScrolling(boolean optimizeScrolling)
          Set whether optimized scrolling should be used.
 void setOverlapStrategy(IOverlapStrategy overlapStrategy)
          Set the strategy to be used for calculating overlap information.
 void setPixelPerSecond(double pixPerSecond)
          Sets the scale ox the x axis as pixel per second, thus a value of 1000.0 / (24.0 * 60 * 60) will result in displaying one day over 1000 pixel.
 void setRegionRectEnable(boolean enabled)
          Enable/Disable region selections.
 void setRelationRenderer(IRelationRenderer relationRenderer)
          Set the relation renderer.
 void setRowFilter(TimeBarRowFilter rowFilter)
          Set a filter to select a subset of rows in the model to be displayed.
 void setRowGridColor(org.eclipse.swt.graphics.Color rowGridColor)
          Set the color for the row grid.
 void setRowHeight(int rowHeight)
          Set the height for the rows in pixel.
 void setRowHeightDraggingAllowed(boolean rowHeightDraggingAllowed)
          Set whether row height dragging should be allowed.
 void setRowSelectColor(org.eclipse.swt.graphics.Color rowSelectColor)
          Deprecated. use the default grid renderer directly (or your own grid renderer)
 void setRowSorter(TimeBarRowSorter rowSorter)
          Set a sorter for sorting the displayed rows.
 void setScaleContextMenu(org.eclipse.swt.widgets.Menu scaleContextMenu)
           
 void setScrollLookBackMinutes(int scrollLookBackMinutes)
          Set the additional time to be considered when deciding whether to draw an interval looking back.
 void setScrollLookForwardMinutes(int scrollLookForwardMinutes)
          Set the additional time to be considered when deciding whether to draw an interval looking forward.
 void setScrollOnFocus(boolean scrollOnFocus)
          If set to true the viewer will scroll to the begin of an interval if it's focussed.
 void setSecondsDisplayed(int seconds, boolean center)
          Set the scaling of the x axis by specifying the number of seconds that should be displayed.
 void setSecondsDisplayed(int seconds, de.jaret.util.date.JaretDate centerDate)
          Set the scaling of the x axis by specifying the number of seconds that should be displayed.
 void setSelection(org.eclipse.jface.viewers.ISelection selection)
           Will process a structured selection containing rows and intervals.
 void setSelectionDelta(int selectionDelta)
          Set the selection delta used to determine whether a marker or interval edge is clicked/dragged.
 void setSelectionModel(TimeBarSelectionModel selectionModel)
          Set the selectionmodel to be used by the viewer.
 void setStartDate(de.jaret.util.date.JaretDate startDate)
          Set the start date of the display.
 void setStrictClipTimeCheck(boolean strictClipTimeCheck)
          Set the optimization strategy for interval filtering when painting.
 void setTBOrientation(TimeBarViewerInterface.Orientation orientation)
          Set the orientation of the viewer.
 void setTimeBarRenderer(TimeBarRenderer renderer)
          Set the default renderer to be used for rendering the timebars.
 void setTimeScalePosition(int timeScalePosition)
          
 void setTimeScaleRenderer(TimeScaleRenderer timeScaleRenderer)
          Set a renderer for the x axis.
 void setTitle(java.lang.String title)
          Set a title for the viewer to be displayed.
 void setTitleContextMenu(org.eclipse.swt.widgets.Menu titleContextMenu)
           
 void setTitleRenderer(TitleRenderer titleRenderer)
           
 void setUseUniformHeight(boolean useUniformHeight)
          Set whether all intervals in a non overlapping drawn row should use the same height/width.
 void setVariableXScale(boolean state)
          Set the state for the variable xscale.
 void setXAxisHeight(int height)
          Set the height (or width) of the timescale.
 void setYAxisWidth(int width)
          Set the width of the y axis (the header area).
 java.awt.Rectangle timeBarContainingRect(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, boolean overlapping)
          Calculate/get the containing rectangle of a rendered interval.
 boolean timeBarContains(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, int x, int y, boolean overlapping)
          Check whether a location is contained in a rendered interval.
 void updateXScrollBar(int max, int pos, int secondsDisplayed)
          Update the x scrollbar.
 void updateYScrollBar(int max, int pos, int rowsDisplayed)
          Update the y scrollbar.
 int xForDate(de.jaret.util.date.JaretDate date)
          Calculate the x coordinate for a given date.
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, scroll, setCaret, setFont
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
getToolTipText
 

Field Detail

ROWGRID_COLOR

public static final org.eclipse.swt.graphics.Color ROWGRID_COLOR
default color for rowgrid.


INCREMENTDIVISOR_X

protected static final int INCREMENTDIVISOR_X
Number of seconds will be divided by this divisor for determing arrow incremtn of the scrollbar.

See Also:
Constant Field Values

INCREMENTDIVISOR_Y

protected static final int INCREMENTDIVISOR_Y
Number of rows will be divided by this divisor for determing arrow incremtn of the scrollbar.

See Also:
Constant Field Values

LINECOLOR

protected static final org.eclipse.swt.graphics.Color LINECOLOR
Color used to render the limiting lines.


DEFAULT_ALPHA

public static final int DEFAULT_ALPHA
default alpha for ghost draw and row highlighting.

See Also:
Constant Field Values

_rowGridColor

protected org.eclipse.swt.graphics.Color _rowGridColor
color for row grid lines.


_ghostAlpha

protected int _ghostAlpha
alpha for ghost drawing.


_delegate

protected TimeBarViewerDelegate _delegate
This delegate encapsules the main part of the functionality of the the viewer.


_timeScaleRenderer

protected TimeScaleRenderer _timeScaleRenderer
Renderer used to render the timescale.


_rendererMap

protected java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> _rendererMap
mapping between interval classes and renderers.


_hierarchyRenderer

protected HierarchyRenderer _hierarchyRenderer
Renderer for the hierarchy view (tree structure).


_gridRenderer

protected GridRenderer _gridRenderer
Renderer for rendering the grid.


_globalRenderer

protected GlobalAssistantRenderer _globalRenderer
Renderer for doing global rendering.


_gapRenderer

protected TimeBarGapRenderer _gapRenderer
Renderer for doing rendering in th egaps between intervals.


_headerRenderer

protected HeaderRenderer _headerRenderer
Renderer to render the row headings.


_relationRenderer

protected IRelationRenderer _relationRenderer
renderer for drawing interval relations. no default renderer is setup.


_markerRenderer

protected TimeBarMarkerRenderer _markerRenderer
Renderer for the timebar markers.


_titleRenderer

protected TitleRenderer _titleRenderer
Renderer for rendering the title area.


_miscRenderer

protected IMiscRenderer _miscRenderer
Renderer for rendering various bits.


_actionFactory

protected JaretTimeBarsActionFactory _actionFactory
factory for creating standard actions.


_bodyContextMenu

protected org.eclipse.swt.widgets.Menu _bodyContextMenu
context menu for the main viewer body.


_intervalContextMenu

protected org.eclipse.swt.widgets.Menu _intervalContextMenu
context menu displayed for intervals.


_scaleContextMenu

protected org.eclipse.swt.widgets.Menu _scaleContextMenu
context menu displayed for the time scale.


_titleContextMenu

protected org.eclipse.swt.widgets.Menu _titleContextMenu
context menu for the title area.


_hierarchyCtxHandler

protected RowContextMenuHandler _hierarchyCtxHandler
handler for retrieving a context menu for the hierarchy.


_headerCtxHandler

protected RowContextMenuHandler _headerCtxHandler
handler for retrieving a context menu for the header area.


_propertyChangeSupport

protected java.beans.PropertyChangeSupport _propertyChangeSupport
Delegate to handle property change listener support.


_selectionChangeListeners

protected java.util.List<org.eclipse.jface.viewers.ISelectionChangedListener> _selectionChangeListeners
list of Iselction listeners. *


_ghostIntervals

protected java.util.List<de.jaret.util.date.Interval> _ghostIntervals
list of ghost intervals to be painted.


_ghostIntervalYCoordinates

protected java.util.List<java.lang.Integer> _ghostIntervalYCoordinates
y offsets for the ghost intervals.


_ghostOrigin

protected org.eclipse.swt.graphics.Point _ghostOrigin
the origin for painting the ghost intervals/rows. The ghosted elements will paintetd relative to the y coordinate.


_ghostRows

protected java.util.List<TimeBarRow> _ghostRows
list of ghost rows to paint.


_ghostRowYCoordinates

protected java.util.List<java.lang.Integer> _ghostRowYCoordinates
y offsets for the ghost rows.

Constructor Detail

TimeBarViewer

public TimeBarViewer(org.eclipse.swt.widgets.Composite parent,
                     int style)
Constructor for a timebarviewer. Scrollbars can be added using SWT.H_SCROLL and SWT.V_SCROLL style bits. All other stylebits will not be useful.

Parameters:
parent - parent composite
style - style bits
Method Detail

onDispose

public void onDispose()
Dispose all renderes.


getWidth

public int getWidth()
Return the width of the viewer.

Specified by:
getWidth in interface TimeBarViewerInterface
Returns:
width

getHeight

public int getHeight()
Return the height of the viewer.

Specified by:
getHeight in interface TimeBarViewerInterface
Returns:
height

repaint

public void repaint()
Mark the whole viewer as dirty causing a repaint.

Specified by:
repaint in interface TimeBarViewerInterface

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height)
Mark area the needs repaint.

Specified by:
repaint in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
width - width of the area
height - height of the area

repaint

public void repaint(java.awt.Rectangle rectangle)
Mark area to be repainted.

Specified by:
repaint in interface TimeBarViewerInterface
Parameters:
rectangle - java.awt.Rectangle that needs to be repainted

updateXScrollBar

public void updateXScrollBar(int max,
                             int pos,
                             int secondsDisplayed)
Update the x scrollbar.

Specified by:
updateXScrollBar in interface TimeBarViewerInterface
Parameters:
max - max value for the scrollbar (seconds)
pos - current positions in seconds
secondsDisplayed - the number of seconds displayed by the viewer

updateYScrollBar

public void updateYScrollBar(int max,
                             int pos,
                             int rowsDisplayed)
Update the y scrollbar.

Specified by:
updateYScrollBar in interface TimeBarViewerInterface
Parameters:
max - max value for the scrollbar (row)
pos - first row displayed
rowsDisplayed - number of rows currently displayed

xForDate

public int xForDate(de.jaret.util.date.JaretDate date)
Calculate the x coordinate for a given date.

Specified by:
xForDate in interface TimeBarViewerInterface
Parameters:
date - date to get the coordinate for
Returns:
x coordinate for the given date in the diagram area

computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint,
                                                  boolean changed)

Overrides:
computeSize in class org.eclipse.swt.widgets.Composite

setModel

public void setModel(TimeBarModel model)
Set the flat model to be displayed.

Specified by:
setModel in interface TimeBarViewerInterface
Parameters:
model - the model to be displyed

setModel

public void setModel(HierarchicalTimeBarModel hModel)
Set a hierarchical model to be displayed.

Specified by:
setModel in interface TimeBarViewerInterface
Parameters:
hModel - hierarchial model

getModel

public TimeBarModel getModel()
Retrieve the flat model used by the viewer. This will always return a flat model, even if a hierarchical model has been set. In this case the warpping flat model is returned.

Specified by:
getModel in interface TimeBarViewerInterface
Returns:
the flat model used by the viewer

getHierarchicalModel

public HierarchicalTimeBarModel getHierarchicalModel()
Retrieve the hierarchical model of the viewer. This may be null if a flat model has been set directly.

Specified by:
getHierarchicalModel in interface TimeBarViewerInterface
Returns:
the hierarchical model or null

getHierarchicalViewState

public HierarchicalViewState getHierarchicalViewState()
Retrieve the hierarchical viewstate used by the viewer.

Specified by:
getHierarchicalViewState in interface TimeBarViewerInterface
Returns:
the hierarchical viewstate

setHierarchicalViewState

public void setHierarchicalViewState(HierarchicalViewState hierarchicalViewState)
Set the hierarchical viewstate to be used. Most probably no one needs to do this, since a default viewstate is used when setting a hierarchical model.

Specified by:
setHierarchicalViewState in interface TimeBarViewerInterface
Parameters:
hierarchicalViewState - viewstate to use

setTimeBarRenderer

public void setTimeBarRenderer(TimeBarRenderer renderer)
Set the default renderer to be used for rendering the timebars.

Parameters:
renderer - the renderer to be used if no other registered renderer is appropriate

getTimeBarRenderer

public TimeBarRenderer getTimeBarRenderer()
Retrieve the default renderer currently used for rendering intervals (regsitered for Interval.class).

Returns:
the renderer

registerTimeBarRenderer

public void registerTimeBarRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> intervalClass,
                                    TimeBarRenderer renderer)
Register a renderer for an interval class or interface. The renderer registered for Interval.class is the default renderer if no other renderer can be found (obviously).

Parameters:
intervalClass - class of the intervals
renderer - renderer for the given class

getRendererMapping

public java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> getRendererMapping()
Retrieve the complete renderer map. This method's purpose is mainly to feed the TimeBarPrinter.

Returns:
the renderer map

getRenderer

protected TimeBarRenderer getRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> clazz)
Retrieve a renderer for a given class. Checks all interfaces and all superclasses.

Parameters:
clazz - class in question
Returns:
renderer or null

firePropertyChange

public void firePropertyChange(java.lang.String string,
                               double oldValue,
                               double newValue)
Fire a property change.

Specified by:
firePropertyChange in interface TimeBarViewerInterface
Parameters:
string - property name
oldValue - old value
newValue - new value

firePropertyChangeX

public void firePropertyChangeX(java.lang.String propName,
                                java.lang.Object oldVal,
                                java.lang.Object newVal)
Fire a property change.

Specified by:
firePropertyChangeX in interface TimeBarViewerInterface
Parameters:
propName - property name
oldVal - old value
newVal - new value

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener.

Specified by:
addPropertyChangeListener in interface TimeBarViewerInterface
Parameters:
listener - property change listener to add

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener.

Specified by:
removePropertyChangeListener in interface TimeBarViewerInterface
Parameters:
listener - listener to remove

convertRect

public static org.eclipse.swt.graphics.Rectangle convertRect(java.awt.Rectangle rect)
Convert a java.awt.Rectangle to a org.eclipse.Rectangle.

Parameters:
rect - awt rect
Returns:
eclipse rect or null if a null is passed in

getGridRenderer

public GridRenderer getGridRenderer()
Returns:
Returns the gridRenderer.

setGridRenderer

public void setGridRenderer(GridRenderer gridRenderer)
Parameters:
gridRenderer - The gridRenderer to set.

setGlobalAssistantRenderer

public void setGlobalAssistantRenderer(GlobalAssistantRenderer gar)
Set a global renderer doing rendering work other than oriented on one interval or row.

Parameters:
gar - the renderer to be used

getGlobalAssistantRenderer

public GlobalAssistantRenderer getGlobalAssistantRenderer()
Retrive the global assistant renderer if set.

Returns:
global assistant renderer or null if not set

getGapRenderer

public TimeBarGapRenderer getGapRenderer()
Returns:
Returns the gapRenderer.

setGapRenderer

public void setGapRenderer(TimeBarGapRenderer gapRenderer)
Parameters:
gapRenderer - The gapRenderer to set.

getTimeScaleRenderer

public TimeScaleRenderer getTimeScaleRenderer()
Returns:
Returns the timeScaleRenderer.

setTimeScaleRenderer

public void setTimeScaleRenderer(TimeScaleRenderer timeScaleRenderer)
Set a renderer for the x axis. The Height for the x axis will be set to the preferred height of the renderer if the renderer supplies one.

Parameters:
timeScaleRenderer - The timeScaleRenderer to set.

getMiscRenderer

public IMiscRenderer getMiscRenderer()
Retrieve the current misc renderer.

Returns:
the current misc renderer

setMiscRenderer

public void setMiscRenderer(IMiscRenderer miscRenderer)
Set the misc renderer to use.

Parameters:
miscRenderer - the misc renderer to be used

setMarkerRenderer

public void setMarkerRenderer(TimeBarMarkerRenderer markerRenderer)
Set a renderer to be used for renering markers.

Parameters:
markerRenderer - marker renderer

getMarkerRenderer

public TimeBarMarkerRenderer getMarkerRenderer()
Retrieve the used marker renderer.

Returns:
the marker renderer

getMarkerWidth

public int getMarkerWidth(TimeBarMarker marker)
Get the width for marker painting (as requested by a marker renderer).

Specified by:
getMarkerWidth in interface TimeBarViewerInterface
Parameters:
marker - marker to check the width for
Returns:
overall width for marker painting

setHierarchyRenderer

public void setHierarchyRenderer(HierarchyRenderer hierarchyRenderer)
Set a renderer for the hierachy elements. If the renderer announces a preferred width this will be set.

Parameters:
hierarchyRenderer - the renderer to be used for hieryrchy painting

getHierarchyRenderer

public HierarchyRenderer getHierarchyRenderer()
Retrieve the hierarchy renderer.

Returns:
hierarchy renderer

getHeaderRenderer

public HeaderRenderer getHeaderRenderer()
Returns:
Returns the headerRenderer.

setHeaderRenderer

public void setHeaderRenderer(HeaderRenderer headerRenderer)
Parameters:
headerRenderer - The headerRenderer to set.

getTitleRenderer

public TitleRenderer getTitleRenderer()
Returns:
Returns the titleRenderer.

setTitleRenderer

public void setTitleRenderer(TitleRenderer titleRenderer)
Parameters:
titleRenderer - The titleRenderer to set.

getRelationRenderer

public IRelationRenderer getRelationRenderer()
Retrieve the relation renderer.

Returns:
the releation renderer

setRelationRenderer

public void setRelationRenderer(IRelationRenderer relationRenderer)
Set the relation renderer. There is no relation render setup as a default.

Parameters:
relationRenderer - renderer to use

timeBarContains

public boolean timeBarContains(de.jaret.util.date.Interval interval,
                               java.awt.Rectangle intervalRect,
                               int x,
                               int y,
                               boolean overlapping)
Check whether a location is contained in a rendered interval.

Specified by:
timeBarContains in interface TimeBarViewerInterface
Parameters:
interval - Interval to be checked
intervalRect - bounding rect for the interval
x - location x
y - location y
overlapping - true if there are overlapping intervals and drawing mode is not drawOverlapped
Returns:
true if contained

timeBarContainingRect

public java.awt.Rectangle timeBarContainingRect(de.jaret.util.date.Interval interval,
                                                java.awt.Rectangle intervalRect,
                                                boolean overlapping)
Calculate/get the containing rectangle of a rendered interval.

Specified by:
timeBarContainingRect in interface TimeBarViewerInterface
Parameters:
interval - Interval for which the containing rect should be calculated
intervalRect - Rectangle in the viewer (bounding rectangle)
overlapping - true if there are overlapping intervals and drawing mode is not drawOverlapped
Returns:
java.awt.Rectangle containing rectangle

setCursor

public void setCursor(int cursorType)
Set the cursor type.

Specified by:
setCursor in interface TimeBarViewerInterface
Parameters:
cursorType - java.awt.cursor type

getIntervalToolTipText

public java.lang.String getIntervalToolTipText(de.jaret.util.date.Interval interval,
                                               java.awt.Rectangle intervalRect,
                                               int x,
                                               int y)
Get the tooltip text for a given location in a rendered interval.

Specified by:
getIntervalToolTipText in interface TimeBarViewerInterface
Parameters:
interval - Interval
intervalRect - bounding rectangle for the interval
x - location x
y - location y
Returns:
the tooltip text or null if none could be found

getPixelPerSecond

public double getPixelPerSecond()
Return the pixel per second ratio.

Specified by:
getPixelPerSecond in interface TimeBarViewerInterface
Returns:
pixel per second

setPixelPerSecond

public void setPixelPerSecond(double pixPerSecond)
Sets the scale ox the x axis as pixel per second, thus a value of 1000.0 / (24.0 * 60 * 60) will result in displaying one day over 1000 pixel. The property is a bound property and can be listened to by a PropertyChangeListener.

Specified by:
setPixelPerSecond in interface TimeBarViewerInterface
Parameters:
pixPerSecond - pixel per second.

getRowHeight

public int getRowHeight()
Retrieve the current row height or the default row height if variable row heights/widths are enabled.

Specified by:
getRowHeight in interface TimeBarViewerInterface
Returns:
row height in pixel

setRowHeight

public void setRowHeight(int rowHeight)
Set the height for the rows in pixel. This property is bound.

Specified by:
setRowHeight in interface TimeBarViewerInterface
Parameters:
rowHeight - new row height

getXAxisHeight

public int getXAxisHeight()
Retrieve the height (or width when orientation is vertical) of the timescale.

Specified by:
getXAxisHeight in interface TimeBarViewerInterface
Returns:
returns the xAxisHeight.

setXAxisHeight

public void setXAxisHeight(int height)
Set the height (or width) of the timescale.

Specified by:
setXAxisHeight in interface TimeBarViewerInterface
Parameters:
height - height or width for the time scale

getStartDate

public de.jaret.util.date.JaretDate getStartDate()
Retrive the current start date of the displayed time span.

Specified by:
getStartDate in interface TimeBarViewerInterface
Returns:
start date of the visual section

setStartDate

public void setStartDate(de.jaret.util.date.JaretDate startDate)
Set the start date of the display.

Specified by:
setStartDate in interface TimeBarViewerInterface
Parameters:
startDate - first date to be displayed

getMinDate

public de.jaret.util.date.JaretDate getMinDate()
Retrieve the minimum value present in the data of the viewer.

Specified by:
getMinDate in interface TimeBarViewerInterface
Returns:
minimum date that can be displayed

setMinDate

public void setMinDate(de.jaret.util.date.JaretDate minDate)
Set the minimum date to be displayed. Note: this will only have an effect if min/max is not adjusted by the model.

Specified by:
setMinDate in interface TimeBarViewerInterface
Parameters:
minDate - minimum date to be displayed

getMaxDate

public de.jaret.util.date.JaretDate getMaxDate()
Retrieve the maximum date that can be displayed.

Specified by:
getMaxDate in interface TimeBarViewerInterface
Returns:
maximum date that can be displayed

setMaxDate

public void setMaxDate(de.jaret.util.date.JaretDate maxDate)
Set the maximum date to be displayed. Note: this will only have an effect if min/max is not adjusted by the model.

Specified by:
setMaxDate in interface TimeBarViewerInterface
Parameters:
maxDate - maximum date to be displayed

getSelectionModel

public TimeBarSelectionModel getSelectionModel()
Get the selection model of the viewer.

Specified by:
getSelectionModel in interface TimeBarViewerInterface
Returns:
the selection model of the viewer

setSelectionModel

public void setSelectionModel(TimeBarSelectionModel selectionModel)
Set the selectionmodel to be used by the viewer.

Specified by:
setSelectionModel in interface TimeBarViewerInterface
Parameters:
selectionModel - selection model to be used

getFirstRowDisplayed

public int getFirstRowDisplayed()
Retrieve the index of the first row that is displayed.

Specified by:
getFirstRowDisplayed in interface TimeBarViewerInterface
Returns:
index of the first displayed row

setFirstRowDisplayed

public void setFirstRowDisplayed(int rowIdx)
Set the first row to be displayed.

Specified by:
setFirstRowDisplayed in interface TimeBarViewerInterface
Parameters:
rowIdx - index of the first row to be displayed

setFirstRowDisplayed

public void setFirstRowDisplayed(TimeBarRow row)
Set the the first row to be displayed.

Specified by:
setFirstRowDisplayed in interface TimeBarViewerInterface
Parameters:
row - row that should be the topmost row displayed.

getFirstRowOffset

public int getFirstRowOffset()
Retrieve the pixeloffset for the first row.

Specified by:
getFirstRowOffset in interface TimeBarViewerInterface
Returns:
pixel offset of the first row

setFirstRowOffset

public void setFirstRowOffset(int offset)
Set the pixeloffset of the first row.

Specified by:
setFirstRowOffset in interface TimeBarViewerInterface
Parameters:
offset - pixeloffset for the first row

setFirstRow

public void setFirstRow(int firstRow,
                        int pixOffset)
Set the first row to be displayed.

Specified by:
setFirstRow in interface TimeBarViewerInterface
Parameters:
firstRow - upmost row to be displayed
pixOffset - pixel offset

setLastRow

public void setLastRow(int index)
Set the last row in the viewer. If there are not enough rows for the row beeing the last row the row will be displayed as far down as possible by setting the first row to 0.

Specified by:
setLastRow in interface TimeBarViewerInterface
Parameters:
index - index of the row to be displayed at the bottom of the viewer.

setLastRow

public void setLastRow(TimeBarRow row)
Set the last row in the viewer. If there are not enough rows for the row beeing the last row the row will be displayed as far down as possible by setting the first row to 0.

Specified by:
setLastRow in interface TimeBarViewerInterface
Parameters:
row - the row to be displayed at the bottom of the viewer.

getEndDate

public de.jaret.util.date.JaretDate getEndDate()
Get the las date painted.

Returns:
the last date that has been painted

setTimeScalePosition

public void setTimeScalePosition(int timeScalePosition)


getTimeScalePosition

public int getTimeScalePosition()


setAdjustMinMaxDatesByModel

public void setAdjustMinMaxDatesByModel(boolean adjust)
Set the adjustment policy.

Specified by:
setAdjustMinMaxDatesByModel in interface TimeBarViewerInterface
Parameters:
adjust - if set to true min and max dates are set by the model

getAdjustMinMaxDatesByModel

public boolean getAdjustMinMaxDatesByModel()
Retrieve the adjustment policy for min and max date.

Specified by:
getAdjustMinMaxDatesByModel in interface TimeBarViewerInterface
Returns:
true if min/max are adjusted by the model

rowForY

public TimeBarRow rowForY(int y)


dateForX

public de.jaret.util.date.JaretDate dateForX(int x)
Get the corresponding date for an x coordinate in the viewer area.

Specified by:
dateForX in interface TimeBarViewerInterface
Parameters:
x - in the viewer area
Returns:
corresponding date

dateForXY

public de.jaret.util.date.JaretDate dateForXY(int x,
                                              int y)
Get the corresponding date for a point in the viewer area.

Specified by:
dateForXY in interface TimeBarViewerInterface
Parameters:
x - x coordinate in the viewer area
y - y coordinate in the viewer area
Returns:
corresponding date

highlightRow

public void highlightRow(int y)


highlightRow

public void highlightRow(TimeBarRow timeBarRow)


deHighlightRow

public void deHighlightRow()


setDrawRowGrid

public void setDrawRowGrid(boolean drawRowGrid)
Set the row grid drawing status. If set to true rows will be separated by lines.

Specified by:
setDrawRowGrid in interface TimeBarViewerInterface
Parameters:
drawRowGrid - if true, rows will be separated by a thin line

getDrawRowGrid

public boolean getDrawRowGrid()
Retrieve the status of row grid drawing.

Specified by:
getDrawRowGrid in interface TimeBarViewerInterface
Returns:
true if the row grid drawing is enabled

setRowFilter

public void setRowFilter(TimeBarRowFilter rowFilter)
Set a filter to select a subset of rows in the model to be displayed. The model itself will go unaffected.

Parameters:
rowFilter - TimeBarRowFilter to be used or null to disable row filtering

getRowFilter

public TimeBarRowFilter getRowFilter()
Get the used row filter.

Returns:
the row filter or null.

setIntervalFilter

public void setIntervalFilter(TimeBarIntervalFilter intervalFilter)
Set an interval filter to select a subset of intervals that will be displayed. The model will be unaffected.

Parameters:
intervalFilter - filter to use or null to disable filtering

getIntervalFilter

public TimeBarIntervalFilter getIntervalFilter()
Retrieve the used interval filter.

Returns:
interval filter or null

setRowSorter

public void setRowSorter(TimeBarRowSorter rowSorter)
Set a sorter for sorting the displayed rows. The model itself will not be affected.

Parameters:
rowSorter - TimeBarRowSorter to be used or null to disable sorting

getRowSorter

public TimeBarRowSorter getRowSorter()
Retrive sorter used.

Returns:
sorter or null

addMarker

public void addMarker(TimeBarMarker marker)
Add a timebar marker.

Specified by:
addMarker in interface TimeBarViewerInterface
Parameters:
marker - marker to add

remMarker

public void remMarker(TimeBarMarker marker)
Remove a timebar marker.

Specified by:
remMarker in interface TimeBarViewerInterface
Parameters:
marker - marker to remove

getMarkers

public java.util.List<TimeBarMarker> getMarkers()
Retrieve the list of al markers.

Specified by:
getMarkers in interface TimeBarViewerInterface
Returns:
List of all added timebar markers

addMarkers

public void addMarkers(java.util.List<TimeBarMarker> markers)
Directly set a list of markers.

Specified by:
addMarkers in interface TimeBarViewerInterface
Parameters:
markers - list of timebar markers

setYAxisWidth

public void setYAxisWidth(int width)
Set the width of the y axis (the header area). The width is initialized with the width announced by the header renderer.

Specified by:
setYAxisWidth in interface TimeBarViewerInterface
Parameters:
width - width in pixel

getYAxisWidth

public int getYAxisWidth()
Retrieve the width of the y axis (header area).

Specified by:
getYAxisWidth in interface TimeBarViewerInterface
Returns:
width of the header area

setHierarchyWidth

public void setHierarchyWidth(int width)
Set the width of the hierarchy area of the viewer. The width is initialized by the hierarchy renderer if set and applicable.

Specified by:
setHierarchyWidth in interface TimeBarViewerInterface
Parameters:
width - width in pixels

getHierarchyWidth

public int getHierarchyWidth()
Retrieve the width of the hierarchy area.

Specified by:
getHierarchyWidth in interface TimeBarViewerInterface
Returns:
the width of the hierarchy area

setAutoscrollEnabled

public void setAutoscrollEnabled(boolean enableAutoscroll)
Set the autoscroll behaviour. If autoscroll is enabled, drag and select by selection rect will autoscroll the viewer.

Specified by:
setAutoscrollEnabled in interface TimeBarViewerInterface
Parameters:
enableAutoscroll - true for enabling autoscroll

isAutoscrollEnabled

public boolean isAutoscrollEnabled()
Get the autoscroll behaviour.

Specified by:
isAutoscrollEnabled in interface TimeBarViewerInterface
Returns:
true if autoscroll is enabled.

addIntervalModificator

public void addIntervalModificator(IntervalModificator intervalModificator)
Add an intervalModificator controlling changes on the intervals.

Specified by:
addIntervalModificator in interface TimeBarViewerInterface
Parameters:
intervalModificator - interval modificator to add

remIntervalModificator

public void remIntervalModificator(IntervalModificator intervalModificator)
Remove an interval modificator.

Specified by:
remIntervalModificator in interface TimeBarViewerInterface
Parameters:
intervalModificator - interval modificator to remove

getTimeScaleToolTipText

public java.lang.String getTimeScaleToolTipText(int x,
                                                int y)
Retrieve the tooltip for a position on the timescale.

Specified by:
getTimeScaleToolTipText in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
the tooltip text or null indicating no tt is available

getHeaderToolTipText

public java.lang.String getHeaderToolTipText(TimeBarRow row,
                                             int x,
                                             int y)
Retrieve the tooltip for a position on a row.

Specified by:
getHeaderToolTipText in interface TimeBarViewerInterface
Parameters:
row - row displayed on the location
x - x coordinate
y - y coordinate
Returns:
the tooltip text or null indicating no tt is available

getHierarchyToolTipText

public java.lang.String getHierarchyToolTipText(TimeBarNode node,
                                                int x,
                                                int y)
Retrieve the tooltip for a position in the hierarchy.

Specified by:
getHierarchyToolTipText in interface TimeBarViewerInterface
Parameters:
node - node displayed at the location
x - x coordinate
y - y coordinate
Returns:
the tooltip text or null indicating no tt is available

isInToggleArea

public boolean isInToggleArea(TimeBarNode node,
                              int xx,
                              int yy)
Check whether the given position should toggle expanded state of a node.

Specified by:
isInToggleArea in interface TimeBarViewerInterface
Parameters:
node - the node rendered
xx - x coordinate
yy - y coordinate
Returns:
true if toggling should occur

isInHierarchySelectionArea

public boolean isInHierarchySelectionArea(TimeBarNode node,
                                          int xx,
                                          int yy)
Check whether the given position is in the selection area of the hierarchy.

Specified by:
isInHierarchySelectionArea in interface TimeBarViewerInterface
Parameters:
node - the node
xx - x coordinate
yy - y coordinate
Returns:
true if the coordniate is in the hierarchy area

setTitle

public void setTitle(java.lang.String title)
Set a title for the viewer to be displayed.

Specified by:
setTitle in interface TimeBarViewerInterface
Parameters:
title - or null indicating no title.

getTitle

public java.lang.String getTitle()
Retrieve the title.

Specified by:
getTitle in interface TimeBarViewerInterface
Returns:
the title.

displayBodyContextMenu

public void displayBodyContextMenu(int x,
                                   int y)
Display the context menu for the normal viewer body.

Specified by:
displayBodyContextMenu in interface TimeBarViewerInterface
Parameters:
x - x coordinate for the menu
y - y coordinate for the menu

displayTimeScaleContextMenu

public void displayTimeScaleContextMenu(int x,
                                        int y)
Display the context menu for the time scale.

Specified by:
displayTimeScaleContextMenu in interface TimeBarViewerInterface
Parameters:
x - x coordinate for the menu
y - y coordinate for the menu

displayIntervalContextMenu

public void displayIntervalContextMenu(de.jaret.util.date.Interval interval,
                                       int x,
                                       int y)
Display the context menu for an interval.

Specified by:
displayIntervalContextMenu in interface TimeBarViewerInterface
Parameters:
interval - interval clicked on
x - x coordinate for the menu
y - y coordinate for the menu

displayHeaderContextMenu

public void displayHeaderContextMenu(TimeBarRow row,
                                     int x,
                                     int y)
Display the header context menu.

Specified by:
displayHeaderContextMenu in interface TimeBarViewerInterface
Parameters:
row - row clicked on
x - x coordinate for the menu
y - y coordinate for the menu

displayHierarchyContextMenu

public void displayHierarchyContextMenu(TimeBarRow row,
                                        int x,
                                        int y)
Display the hierarchy area context menu.

Specified by:
displayHierarchyContextMenu in interface TimeBarViewerInterface
Parameters:
row - row clicked on
x - x coordinate for the menu
y - y coordinate for the menu

displayTitleContextMenu

public void displayTitleContextMenu(int x,
                                    int y)
Display the title area context menu.

Specified by:
displayTitleContextMenu in interface TimeBarViewerInterface
Parameters:
x - x coordinate for the menu
y - y coordinate for the menu

getBodyContextMenu

public org.eclipse.swt.widgets.Menu getBodyContextMenu()
Returns:
Returns the bodyContextMenu.

setBodyContextMenu

public void setBodyContextMenu(org.eclipse.swt.widgets.Menu bodyContextMenu)
Parameters:
bodyContextMenu - The bodyContextMenu to set.

getIntervalContextMenu

public org.eclipse.swt.widgets.Menu getIntervalContextMenu()
Returns:
Returns the intervalContextMenu.

setIntervalContextMenu

public void setIntervalContextMenu(org.eclipse.swt.widgets.Menu intervalContextMenu)
Set the interval context menu.

Parameters:
intervalContextMenu - context menu to set

getScaleContextMenu

public org.eclipse.swt.widgets.Menu getScaleContextMenu()
Returns:
Returns the scaleContextMenu.

setScaleContextMenu

public void setScaleContextMenu(org.eclipse.swt.widgets.Menu scaleContextMenu)
Parameters:
scaleContextMenu - The scaleContextMenu to set.

getTitleContextMenu

public org.eclipse.swt.widgets.Menu getTitleContextMenu()
Returns:
Returns the titleContextMenu.

setTitleContextMenu

public void setTitleContextMenu(org.eclipse.swt.widgets.Menu titleContextMenu)
Parameters:
titleContextMenu - The titleContextMenu to set.

getHeaderCtxHandler

public RowContextMenuHandler getHeaderCtxHandler()
Returns:
Returns the headerCtxHandler.

setHeaderCtxHandler

public void setHeaderCtxHandler(RowContextMenuHandler headerCtxHandler)
Parameters:
headerCtxHandler - The headerCtxHandler to set.

getHierarchyCtxHandler

public RowContextMenuHandler getHierarchyCtxHandler()
Returns:
Returns the hierarchyCtxHandler.

setHierarchyCtxHandler

public void setHierarchyCtxHandler(RowContextMenuHandler hierarchyCtxHandler)
Parameters:
hierarchyCtxHandler - The hierarchyCtxHandler to set.

getKeyboardChangeDelta

public int getKeyboardChangeDelta()
Retrieve the keyboardChangeDelta currently used.

Returns:
the keyboardChangeDelta in seconds

setKeyboardChangeDelta

public void setKeyboardChangeDelta(int keyboardChangeDelta)
Set the delta for resizing and moving via keyboard.

Parameters:
keyboardChangeDelta - the keyboardChangeDelta in seconds to set

setFocussedInterval

public void setFocussedInterval(de.jaret.util.date.Interval interval)
Set the new focussed interval.

Parameters:
interval - new focussed interval

setFocussedInterval

public void setFocussedInterval(TimeBarRow row,
                                de.jaret.util.date.Interval interval)
Set the new focussed interval. Ths method should be used, if the row of the interval is known.

Parameters:
row - row of the interval. May be null if the row of the interval is unknown.
interval - interval to be focussed.

getFocussedInterval

public de.jaret.util.date.Interval getFocussedInterval()
Retrieve the focussed interval.

Returns:
the currently focussed interval or null if none is in focus

getFocussedRow

public TimeBarRow getFocussedRow()
Returns:
the currently focussed row or null if none is in focus

isFocussed

public boolean isFocussed(de.jaret.util.date.Interval interval)
Check whether an interval is focussed.

Parameters:
interval - interval to check
Returns:
true if focussed

scrollDateToVisible

public int scrollDateToVisible(de.jaret.util.date.JaretDate date)
Scroll a date into the visible area of the viewer.

Specified by:
scrollDateToVisible in interface TimeBarViewerInterface
Parameters:
date - date to be shown.
Returns:
the number of seconds the start date have been modified

scrollRowToVisible

public void scrollRowToVisible(TimeBarRow row)
Make sure the specified row is visible.

Specified by:
scrollRowToVisible in interface TimeBarViewerInterface
Parameters:
row - TimeBarRow to be in the visible area.

scrollIntervalToVisible

public void scrollIntervalToVisible(TimeBarRow row,
                                    de.jaret.util.date.Interval interval)
Make sure the specified interval is in the visibe area of the viewer. If the interval does not fit in the visible area, the beginning of the interval will be displayed.

Specified by:
scrollIntervalToVisible in interface TimeBarViewerInterface
Parameters:
row - TimeBarRow of the interval
interval - inteval.

scrollIntervalToVisible

public void scrollIntervalToVisible(de.jaret.util.date.Interval interval)
Make sure the specified interval is in the visibe area of the viewer. If the interval does not fit in the visible area, the beginning of the interval will be displayed.

Parameters:
interval - interval

scrollIntervalToVisible

public void scrollIntervalToVisible(de.jaret.util.date.Interval interval,
                                    double horizontalRatio,
                                    double verticalRatio)
Scroll an intervall into the visible area on a position specified by a ratio. The position according to the ratio will be set for the upper row border and the begin of the interval. The horizontal position might be calculated incorrectly when a variable x axis is used.

Parameters:
interval - interval to scroll to
horizontalRatio - ration between 0 and 1.0 (left to right)
verticalRatio - ratio between 0 and 1.0 (top to bottom)

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()
Will return a structured selection conaining selected rows and selected intervals.

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection)
Will process a structured selection containing rows and intervals.

Specified by:
setSelection in interface org.eclipse.jface.viewers.ISelectionProvider

fireSelectionChanged

public void fireSelectionChanged()
Callback for delegate. This is not an ideal design but it will be ok to check in the delegate.

Specified by:
fireSelectionChanged in interface TimeBarViewerInterface

getActionFactory

public JaretTimeBarsActionFactory getActionFactory()
Retrieve a configured action factory.

Returns:
a configured action factory

setDrawOverlapping

public void setDrawOverlapping(boolean drawOverlapping)
Set the drawing mode.

Parameters:
drawOverlapping - if set to true intervals will be painted on another. If set to false, every interval will only get a fraction of the space corresponding to the count of overlapping intervals.

getDrawOverlapping

public boolean getDrawOverlapping()
Retrieve the drawing mode.

Returns:
the drawing mode

getIntervalsAt

public java.util.List<de.jaret.util.date.Interval> getIntervalsAt(int x,
                                                                  int y)
Retrieves all intervals at a given point in the diagram pane.

Parameters:
x - x coordinate
y - y coordinate
Returns:
List of all intervals at the point

getRowGridColor

public org.eclipse.swt.graphics.Color getRowGridColor()
Retrieve color for the row grid.

Returns:
Color of the row grid

setRowGridColor

public void setRowGridColor(org.eclipse.swt.graphics.Color rowGridColor)
Set the color for the row grid. The color will not be disposed by the viewer.

Parameters:
rowGridColor - Color to be used for horizontal grid lines

getHighlightColor

public org.eclipse.swt.graphics.Color getHighlightColor()
Deprecated. use the default grid renderer directly (or your own grid renderer)

retrieve the color used for highlighting rows.

Returns:
the highlight color

setHighlightColor

public void setHighlightColor(org.eclipse.swt.graphics.Color highlightColor)
Deprecated. use the default grid renderer directly (or your own grid renderer)

Set the color for highlighting a row. The color will not be disposed by the viewer. Highlighting is done with the methods highlightRow and deHighlightRow.

Parameters:
highlightColor - color to be used for highlighting rows

getRowSelectColor

public org.eclipse.swt.graphics.Color getRowSelectColor()
Deprecated. use the default grid renderer directly (or your own grid renderer)

Retrieve the color used for marking selected rows.

Returns:
color used for selecteted rows

setRowSelectColor

public void setRowSelectColor(org.eclipse.swt.graphics.Color rowSelectColor)
Deprecated. use the default grid renderer directly (or your own grid renderer)

Set the color for drawing selected rows. The color will not be disposed by the viewer.

Parameters:
rowSelectColor - color to be used to select rows

getHighlightAlpha

public int getHighlightAlpha()
Deprecated. use the default grid renderer directly (or your own grid renderer)

Get the alpha used when drawing the highlighted row.

Returns:
alpha for drawing the hightlight

setHighlightAlpha

public void setHighlightAlpha(int highlightAlpha)
Deprecated. use the default grid renderer directly (or your own grid renderer)

Set the alpha value used for drawing the highlighted row.

Parameters:
highlightAlpha - alpha to use

getGhostAlpha

public int getGhostAlpha()
Get the alpha used when drawing ghosted intervals.

Returns:
alpha for drawing ghost intervals

setGhostAlpha

public void setGhostAlpha(int ghostAlpha)
Set the alpha value used for drawing ghost intervals.

Parameters:
ghostAlpha - alpha to use

getSelectionDelta

public int getSelectionDelta()
Retrieve the selection delta used to determine whether a marker or interval edge is clicked/dragged.

Specified by:
getSelectionDelta in interface TimeBarViewerInterface
Returns:
max distance for detection

setSelectionDelta

public void setSelectionDelta(int selectionDelta)
Set the selection delta used to determine whether a marker or interval edge is clicked/dragged. A larger selection delta will result in easier selection of of interval bounds and other in place draggable elements but may cause problems when draggable elements are near to each other since more elements are in range and the selected element will be determined by the sequence of checks in the code of the viewer.

A selection delta of n means clicks willl have to be on the element or (n-1) pixels away to consider an element hit.

Specified by:
setSelectionDelta in interface TimeBarViewerInterface
Parameters:
selectionDelta - max distance for detection

isLineDraggingAllowed

public boolean isLineDraggingAllowed()
Check whether it is allowed to drag the limiting lines of the hierarchy ara and the header (yaxis) area.

Specified by:
isLineDraggingAllowed in interface TimeBarViewerInterface
Returns:
true if dragging is allowed.

setLineDraggingAllowed

public void setLineDraggingAllowed(boolean lineDraggingAllowed)
Set the allowance for line dragging of the limiting lines for hierarchy and header(yaxis) areas.

Specified by:
setLineDraggingAllowed in interface TimeBarViewerInterface
Parameters:
lineDraggingAllowed - true for enabling the drag possibility

getYForRow

public int getYForRow(TimeBarRow row)
Retrieve the y coordinate in the diagram pane for the given row.

Specified by:
getYForRow in interface TimeBarViewerInterface
Parameters:
row - row
Returns:
y coordinate in the diagram pane or -1 if the y coordinate could not be retrieved

getRowForY

public TimeBarRow getRowForY(int y)
Retrieve the row for a given y coodinate (x if oriented vertcal; use getRowForXY instead!).. This is the same as rowForY.

Specified by:
getRowForY in interface TimeBarViewerInterface
Parameters:
y - coordinate
Returns:
row or null

getRowForXY

public TimeBarRow getRowForXY(int x,
                              int y)
Retrieve the row for a given point.

Specified by:
getRowForXY in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
row or null

setGhostIntervals

public void setGhostIntervals(java.util.List<de.jaret.util.date.Interval> intervals,
                              java.util.List<java.lang.Integer> yCoordinates)
Set the list of ghost intervals to be drawn.

Parameters:
intervals - list of intervals or null to delete ghosted intervals.
yCoordinates - list of y offsets for the ghost intervals (maybe null when deleting ghost intervals

setGhostInterval

public void setGhostInterval(de.jaret.util.date.Interval interval,
                             int y)
Convenience method to set a single ghost interval.

Parameters:
interval - interval or null to delete
y - y offset

setGhostRows

public void setGhostRows(java.util.List<TimeBarRow> rows,
                         java.util.List<java.lang.Integer> yCoordinates)
Set the list of ghost rows to be drawn.

Parameters:
rows - list of rows or null to delete ghosted rows.
yCoordinates - list of y offsets for the ghost rows (maybe null when deleting ghost rows

setGhostRow

public void setGhostRow(TimeBarRow row,
                        int y)
Convenience method to set a single ghost row.

Parameters:
row - row or null to delete
y - y offset

setGhostOrigin

public void setGhostOrigin(int x,
                           int y)
Set the origin (current drag position) to shift the ghost elements.

Parameters:
x - x coordinate
y - y coordniate

isMilliAccuracy

public boolean isMilliAccuracy()
Check whether th delegate is setup for millisecond accuracy. This will only have an impact on the x scroll bar.

Specified by:
isMilliAccuracy in interface TimeBarViewerInterface
Returns:
true if ms accuracy ist set

setMilliAccuracy

public void setMilliAccuracy(boolean milliAccuracy)
Set the delegates status concerning millisecond accuracy. If set to true the x scroll bar will operate in milliseconds (normal operation: seconds).

Specified by:
setMilliAccuracy in interface TimeBarViewerInterface
Parameters:
milliAccuracy - true to use ms accuracy

getPpsRow

public TimeBarNode getPpsRow()
Retrieve the row that hold intervals (PpsIntervals) defining the pps value for different intervals.

Specified by:
getPpsRow in interface TimeBarViewerInterface
Returns:
the row or null if no variable xscale has been defined.

hasVariableXScale

public boolean hasVariableXScale()
Retrieve the state of the variable xscale state. If true a list of intervals contlrols different pps values for different intervals on the axis.

Specified by:
hasVariableXScale in interface TimeBarViewerInterface
Returns:
true if a varying pps value is used

setVariableXScale

public void setVariableXScale(boolean state)
Set the state for the variable xscale.

Specified by:
setVariableXScale in interface TimeBarViewerInterface
Parameters:
state - true if a variable scale should be used.

doScrollHorizontal

public void doScrollHorizontal(int diff)
Do horizontal scrolling by diff pixel. The method ought to copy the content of the diagramRect and produce dirty regions for the parts not affected by the scroll. The method is intended to be used by the TimeBarViewerDelegate only.

Specified by:
doScrollHorizontal in interface TimeBarViewerInterface
Parameters:
diff - pixel difference (positive for right scroll)

doScrollVertical

public void doScrollVertical(int diff)
Do vertical scrolling by diff pixel. The method ought to copy the content of the diagramRect and produce dirty regions for the parts not affected by the scroll. The method is intended to be used by the TimeBarViewerDelegate only.

Specified by:
doScrollVertical in interface TimeBarViewerInterface
Parameters:
diff - pixel difference (positive for downwards scroll)

getOptimizeScrolling

public boolean getOptimizeScrolling()
Get whether optimzed scrollnig is used.

Specified by:
getOptimizeScrolling in interface TimeBarViewerInterface
Returns:
true if optimized scrolling is used

setOptimizeScrolling

public void setOptimizeScrolling(boolean optimizeScrolling)
Set whether optimized scrolling should be used. The default is false since this may cause problems on some platforms using SWT (Linux/GTK and OSX/intel). Optimized scrolling can not be used together with a variable xscale.

Specified by:
setOptimizeScrolling in interface TimeBarViewerInterface
Parameters:
optimizeScrolling - true for optimized scrolling

getTBOrientation

public TimeBarViewerInterface.Orientation getTBOrientation()
Retrieve the orientation of the viewer.

Specified by:
getTBOrientation in interface TimeBarViewerInterface
Returns:
the orientation of the viewer

setTBOrientation

public void setTBOrientation(TimeBarViewerInterface.Orientation orientation)
Set the orientation of the viewer.

Specified by:
setTBOrientation in interface TimeBarViewerInterface
Parameters:
orientation - the new orientation for the viewer

getAutoScaleRows

public int getAutoScaleRows()
Get the number of rows (columns) that the viewer scales itself to.

Specified by:
getAutoScaleRows in interface TimeBarViewerInterface
Returns:
number of rows to display or -1 if no scale has been set

setAutoScaleRows

public void setAutoScaleRows(int rows)
Set a number of rows (columns) to be displayed by the viewer. The row height will always be changed to math the number of rows to display.

Specified by:
setAutoScaleRows in interface TimeBarViewerInterface
Parameters:
rows - the number of rows or -1 for no special scaling (default)

getIntervalBounds

public org.eclipse.swt.graphics.Rectangle getIntervalBounds(de.jaret.util.date.Interval interval)
Retrieve the bounding rect of an interval. ATTENTION: this uses the row for interval lookup in the model that may be imperformant.

Parameters:
interval - interval
Returns:
the bounding rect or null

addTimeBarChangeListener

public void addTimeBarChangeListener(ITimeBarChangeListener listener)
Add a listener to be informaed about interval changes.

Specified by:
addTimeBarChangeListener in interface TimeBarViewerInterface
Parameters:
listener - listener

removeTimeBarChangeListener

public void removeTimeBarChangeListener(ITimeBarChangeListener listener)
Remove a timebar change listener.

Specified by:
removeTimeBarChangeListener in interface TimeBarViewerInterface
Parameters:
listener - listener to remove

addFocussedIntervalListener

public void addFocussedIntervalListener(FocussedIntervalListener listener)
Add a listener to be informed when the focus inside the viewer changes.

Specified by:
addFocussedIntervalListener in interface TimeBarViewerInterface
Parameters:
listener - listener to be added.

remFocussedIntervalListener

public void remFocussedIntervalListener(FocussedIntervalListener listener)
Remove a focussedIntervalListener.

Specified by:
remFocussedIntervalListener in interface TimeBarViewerInterface
Parameters:
listener - listener to be removed from the listener list.

getTimeBarViewState

public ITimeBarViewState getTimeBarViewState()
Retrieve the statndard viewstate of the viewer containing the row heights/column widths.

Specified by:
getTimeBarViewState in interface TimeBarViewerInterface
Returns:
the viewstate used by the viewer

isRowHeightDragginAllowed

public boolean isRowHeightDragginAllowed()
Check whether row height dragging is allowed.

Specified by:
isRowHeightDragginAllowed in interface TimeBarViewerInterface
Returns:
true if enabled

setRowHeightDraggingAllowed

public void setRowHeightDraggingAllowed(boolean rowHeightDraggingAllowed)
Set whether row height dragging should be allowed.

Specified by:
setRowHeightDraggingAllowed in interface TimeBarViewerInterface
Parameters:
rowHeightDraggingAllowed - true to allow interactive dragging of row heights

rowLineHit

public boolean rowLineHit(int x,
                          int y)
Check whether a row delimiter line is hit by a coordinate.

Specified by:
rowLineHit in interface TimeBarViewerInterface
Parameters:
x - x coord
y - y coord
Returns:
true if a row line is hit

isInRowAxis

public boolean isInRowAxis(int x,
                           int y)
Check whether a given point is in the row axis area (hierarchy or header).

Specified by:
isInRowAxis in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
true if the point is in either hierarchy or header area

isInDiagram

public boolean isInDiagram(int x,
                           int y)
Check whether a given point is in the main diagram area.

Specified by:
isInDiagram in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
true if the point is in the diagram rectangle

getStrictClipTimeCheck

public boolean getStrictClipTimeCheck()
Retrieve the strategy for filtering when painting (see TimeBarViewerInterface.setStrictClipTimeCheck(boolean)).

Specified by:
getStrictClipTimeCheck in interface TimeBarViewerInterface
Returns:
true if strict checking is enabled

setStrictClipTimeCheck

public void setStrictClipTimeCheck(boolean strictClipTimeCheck)
Set the optimization strategy for interval filtering when painting.

Specified by:
setStrictClipTimeCheck in interface TimeBarViewerInterface
Parameters:
strictClipTimeCheck - If set to true, intervals are filtered strictly by their interval bounds, disallowing rendering beyond the bounding box calculated by the interval bounds. Defaults to false resulting in filtering by the preferred drawing area.

getSecondsDisplayed

public int getSecondsDisplayed()
Get the seconds currently displayed by the diagram.

Specified by:
getSecondsDisplayed in interface TimeBarViewerInterface
Returns:
the number of seconds currently displayed by the diagram geometry

getOverlapStrategy

public IOverlapStrategy getOverlapStrategy()
Retrieve the used strategy for determing overlap information.

Specified by:
getOverlapStrategy in interface TimeBarViewerInterface
Returns:
the overlap strategy

setOverlapStrategy

public void setOverlapStrategy(IOverlapStrategy overlapStrategy)
Set the strategy to be used for calculating overlap information.

Specified by:
setOverlapStrategy in interface TimeBarViewerInterface
Parameters:
overlapStrategy - the strytegy to be used. May not be null.

getScrollLookBackMinutes

public int getScrollLookBackMinutes()
Retrieve the time to be additionally considered (looking back) when deciding which intervals are to be painted. Only taken into accoutn when StrictClipTimeCheck is false. Default is 120 Minutes.

Specified by:
getScrollLookBackMinutes in interface TimeBarViewerInterface
Returns:
time in minutes

setScrollLookBackMinutes

public void setScrollLookBackMinutes(int scrollLookBackMinutes)
Set the additional time to be considered when deciding whether to draw an interval looking back. Only taken into account when StrictClipTimeCheck is true.

Specified by:
setScrollLookBackMinutes in interface TimeBarViewerInterface
Parameters:
scrollLookBackMinutes - time in minutes

setScrollLookForwardMinutes

public void setScrollLookForwardMinutes(int scrollLookForwardMinutes)
Set the additional time to be considered when deciding whether to draw an interval looking forward. Only taken into account when StrictClipTimeCheck is true.

Specified by:
setScrollLookForwardMinutes in interface TimeBarViewerInterface
Parameters:
scrollLookForwardMinutes - time in minutes

getScrollLookForwardMinutes

public int getScrollLookForwardMinutes()
Retrieve the time to be additionally considered (looking forward) when deciding which intervals are to be painted. Only taken into account when StrictClipTimeCheck is true.

Specified by:
getScrollLookForwardMinutes in interface TimeBarViewerInterface
Returns:
time in mnutes

getName

public java.lang.String getName()
Retrieve the name set on the viewer.

Specified by:
getName in interface TimeBarViewerInterface
Returns:
the name or null if no name has been set

setName

public void setName(java.lang.String name)
Set a name as a simple string property for internal application use.

Specified by:
setName in interface TimeBarViewerInterface
Parameters:
name - name of the viewer

getDelegate

public TimeBarViewerDelegate getDelegate()
Retrieve the delegate ATTENTION: the delegate is for mostly internal usage only. The interface and behavior may change.

Specified by:
getDelegate in interface TimeBarViewerInterface
Returns:
the delegate used by the viewer.

getAutoscrollDelta

public int getAutoscrollDelta()
Retrieve the currently set autoscroll delta.

Specified by:
getAutoscrollDelta in interface TimeBarViewerInterface
Returns:
the autoscroll delat in pixel

setAutoscrollDelta

public void setAutoscrollDelta(int autoscrollDelta)
Set the autoscroll delta. This value will be used to deteremine the autoscroll deltas when the mouse pointer is not in the diagram rectangle. It is specified in pixel so it is always relative to the timescale. The value will also be used to limit the maximum delta when resizing an interval (edge dragging) with the cursor outside the diagram rectangle.

Specified by:
setAutoscrollDelta in interface TimeBarViewerInterface
Parameters:
autoscrollDelta - delta in pixel

getDragAllSelectedIntervals

public boolean getDragAllSelectedIntervals()
If true all selected intervals will be dragged together with the interval on that the drag happened.

Specified by:
getDragAllSelectedIntervals in interface TimeBarViewerInterface
Returns:
the state of the flag

setDragAllSelectedIntervals

public void setDragAllSelectedIntervals(boolean dragAllSelectedIntervals)
If set to true all selected intervals are dragged when an interval is dragged. The default is false.

Specified by:
setDragAllSelectedIntervals in interface TimeBarViewerInterface
Parameters:
dragAllSelectedIntervals - true to drag all selcted intervals

getRelationsForCoord

public java.util.List<IIntervalRelation> getRelationsForCoord(int x,
                                                              int y)
Retrieve the list of relations hit for a coordinate. This method is in the interface to allow tookit independent implementation of the relation select mechanism.

Specified by:
getRelationsForCoord in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
the list of relations or null if no relations can be found

getRelationTooltip

public java.lang.String getRelationTooltip(int x,
                                           int y)
Provide the tooltip for a relation if any.

Specified by:
getRelationTooltip in interface TimeBarViewerInterface
Parameters:
x - x coordinate
y - y coordinate
Returns:
tooltip text or null

getScrollOnFocus

public boolean getScrollOnFocus()
Retrieve the state of the scroll to focus flag.

Specified by:
getScrollOnFocus in interface TimeBarViewerInterface
Returns:
true if the viewer should scroll to the focussed interval

setScrollOnFocus

public void setScrollOnFocus(boolean scrollOnFocus)
If set to true the viewer will scroll to the begin of an interval if it's focussed.

Specified by:
setScrollOnFocus in interface TimeBarViewerInterface
Parameters:
scrollOnFocus - true for scrolling to the focussed interval

addSelectionRectListener

public void addSelectionRectListener(ISelectionRectListener listener)
Add a listener to be informed when the selection rect changes.

Specified by:
addSelectionRectListener in interface TimeBarViewerInterface
Parameters:
listener - listener to be added.

remSelectionRectListener

public void remSelectionRectListener(ISelectionRectListener listener)
Remove a selection rect listener.

Specified by:
remSelectionRectListener in interface TimeBarViewerInterface
Parameters:
listener - listener to be removed from the listener list.

getHideRoot

public boolean getHideRoot()
Retrieve whether the root node is shown when using a hierachical model.

Specified by:
getHideRoot in interface TimeBarViewerInterface
Returns:
true if the root is not shown

setHideRoot

public void setHideRoot(boolean hideRoot)
Set whether the root node should be shown when using a hierachical model.

Specified by:
setHideRoot in interface TimeBarViewerInterface
Parameters:
hideRoot - true if the root node should be hidden

getMarkerDraggingInDiagramArea

public boolean getMarkerDraggingInDiagramArea()
Retrieve whether marker dragging in the diagram area is activated.

Specified by:
getMarkerDraggingInDiagramArea in interface TimeBarViewerInterface
Returns:
true if marker dragging in the diagram area is allowed

setMarkerDraggingInDiagramArea

public void setMarkerDraggingInDiagramArea(boolean allowed)
Set whether marker dragging is allowed in the diagram area (If intervals are modificable the marker will only be grabbed when no other operation is applicable).

Specified by:
setMarkerDraggingInDiagramArea in interface TimeBarViewerInterface
Parameters:
allowed - true for allowing marker drag in the diagram area.

clearRegionRect

public void clearRegionRect()
Remove the selction of a region if existent.

Specified by:
clearRegionRect in interface TimeBarViewerInterface

getRegionRect

public TBRect getRegionRect()
Retrieve the selected region.

Specified by:
getRegionRect in interface TimeBarViewerInterface
Returns:
the selected region or null

getRegionRectEnable

public boolean getRegionRectEnable()
Retrieve whether region selections are enabled.

Specified by:
getRegionRectEnable in interface TimeBarViewerInterface
Returns:
true if region selections are enabled

setRegionRectEnable

public void setRegionRectEnable(boolean enabled)
Enable/Disable region selections.

Specified by:
setRegionRectEnable in interface TimeBarViewerInterface
Parameters:
enabled - true enabling

getUseUniformHeight

public boolean getUseUniformHeight()
Retrieve whether uniform height is use for all intervals in a row.

Specified by:
getUseUniformHeight in interface TimeBarViewerInterface
Returns:
true if all intervals in a non overlapping drawn row should use the same height/width

setUseUniformHeight

public void setUseUniformHeight(boolean useUniformHeight)
Set whether all intervals in a non overlapping drawn row should use the same height/width.

Specified by:
setUseUniformHeight in interface TimeBarViewerInterface
Parameters:
useUniformHeight - true for uniform heights/widths

setSecondsDisplayed

public void setSecondsDisplayed(int seconds,
                                boolean center)
Set the scaling of the x axis by specifying the number of seconds that should be displayed.

Specified by:
setSecondsDisplayed in interface TimeBarViewerInterface
Parameters:
seconds - number of seconds that will be displayed on the x axis
center - if set to true the center date will be fixed while scaling

setSecondsDisplayed

public void setSecondsDisplayed(int seconds,
                                de.jaret.util.date.JaretDate centerDate)
Set the scaling of the x axis by specifying the number of seconds that should be displayed.

Specified by:
setSecondsDisplayed in interface TimeBarViewerInterface
Parameters:
seconds - number of seconds that will be displayed on the x axis
centerDate - date that will be fixed while scaling

isDisplayed

public boolean isDisplayed(de.jaret.util.date.JaretDate date)
Check whether a date is currently visible.

Specified by:
isDisplayed in interface TimeBarViewerInterface
Parameters:
date - dat eto check
Returns:
true if the date is currently displayed

setInitialDisplayRange

public void setInitialDisplayRange(de.jaret.util.date.JaretDate startDate,
                                   int secondsDisplayed)
Set a date range and scaling that will be set as the initial display right after the viewer is displayed.

Specified by:
setInitialDisplayRange in interface TimeBarViewerInterface
Parameters:
startDate - start date
secondsDisplayed - seconds to be displayed in the viewer

getPopUpInformation

public de.jaret.util.misc.Pair<TimeBarRow,de.jaret.util.date.JaretDate> getPopUpInformation()
Retrieve the row and date of the click leading to the activation of a context menu.

Specified by:
getPopUpInformation in interface TimeBarViewerInterface
Returns:
Pair containing the row and date of the click position. Might be null if no click has been recorded.


Copyright © 2012. All Rights Reserved.