de.jaret.util.ui.timebars
Class TimeBarViewerDelegate

java.lang.Object
  extended by de.jaret.util.ui.timebars.TimeBarViewerDelegate
All Implemented Interfaces:
TimeBarModelListener, TimeBarSelectionListener, TimeBarMarkerListener, java.beans.PropertyChangeListener, java.util.EventListener

public class TimeBarViewerDelegate
extends java.lang.Object
implements TimeBarModelListener, TimeBarSelectionListener, TimeBarMarkerListener, java.beans.PropertyChangeListener

The delegate for supporting a TimeBarViewer. This may be the Swing or the SWT version of the time bar viewer. The delegate encapsulates most of the calculations. It communicates with the viewer for the specific toolkit via the TimeBarViewerInterface.

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

Field Summary
protected  boolean _adjustMinMaxDatesByModel
          Flag controlling min/max setting behaviour.
protected  boolean _autoscroll
          controls autoscroll behaviour: true -> enabled.
protected  int _autoscrollDelta
          the amount of pixels that is assumed to scroll/drag when the cursor left the diagram area.
protected  de.jaret.util.date.Interval _changingInterval
          interval currently changed by dragging.
protected  java.awt.Point _ctxCoordinate
          coordinate a context menu has been requested to pop up.
protected  de.jaret.util.date.JaretDate _ctxDate
          date for the ctx coordinate.
protected  TimeBarRow _ctxRow
          row above that a context menu has been requested to pup up.
protected  java.awt.Rectangle _diagramRect
          area in which the actual rows are painted.
protected  boolean _dragAllSelectedIntervals
          flag indicating whether all selcted intervals should be dragged whe draggig a iterval.
protected  boolean _draggedInterval
          true indicates dragging of an interval as a whole.
protected  boolean _draggedIntervalEdgeLeft
          if not dragging the whole interval true means left bound.
protected  java.util.List<de.jaret.util.date.Interval> _draggedIntervals
          list of draged intervals excluding the one on that the drag started.
protected  java.util.List<TimeBarRow> _draggedIntervalsRows
          cache for the row information for the dragged intervals.
protected  TimeBarMarker _draggedMarker
          marker currently involved in a drag operation.
protected  boolean _drawGrid
          when true the grid/background will be painted.
protected  boolean _drawOverlapping
          flag controlling the drawing behaviour for overlapping intervals.
protected  boolean _drawRowGrid
          if true a row grid will be painted.
protected  de.jaret.util.date.JaretDate _endDate
          Date marking the last painted date.
protected  int _firstRow
          index of the first row displayed.
protected  int _firstRowPixelOffset
          pixeloffset of the first row.
protected  de.jaret.util.date.Interval _focussedInterval
          Currenty focussed interval or null if no interval has the focus.
protected  java.util.List<FocussedIntervalListener> _focussedIntervalListeners
          List of FocussedInteralListeners.
protected  TimeBarRow _focussedRow
          Row of the focussed interval or null if no interval is focussed.
protected  boolean _headerLineDragging
          true if dragging of the header limiting line is ongoing.
protected  TimeBarRow _heightDraggedRow
          row thats height is currently dragged or null when no row height is beeing dragged.
protected  boolean _hideRoot
          if set to true and using a hierchical model the root will not be shown.
protected  HierarchicalTimeBarModel _hierarchicalModel
          The hierarchical model when used.
protected  HierarchicalViewState _hierarchicalViewState
          Viewstate holding state information for hierarchical operation.
protected  boolean _hierarchyLineDragging
          true if dragging of the hierarchy limiting line is ongoing.
protected  java.awt.Rectangle _hierarchyRect
          drawing area of the hierarchy elements.
protected  int _hierarchyWidth
          width of the hierarchy header (in case of an hierachical model).
protected  TimeBarRow _highlightedRow
          highlighted row if any.
protected  int _initialSecondsDisplayed
           
protected  de.jaret.util.date.JaretDate _initialStartDate
           
protected  TimeBarRow _intervalDraggedRow
          the row of the dragged/resized interval.
protected  TimeBarIntervalFilter _intervalFilter
          filter filtering intervals displayed.
protected  java.util.List<IntervalModificator> _intervalModificators
          List of intervalmodificators that have been registered.
protected  IIntervalSelectionStrategy _intervalSelectionStrategy
          insterval selection strategy.
protected  int _keyboardChangeDelta
          Change delta for keyboard modification in seconds.
protected  de.jaret.util.date.JaretDate _lastDragDate
          last date that has been used in a drag/resize.
protected  double _lastGridSnapDifference
          last difference to a gridsnap position (used when dragging an interval).
protected  java.util.List<java.lang.Double> _lastGridSnapDifferences
          list of lat grid snap differences, used when more than one interval is beeing dragged.
protected  int _lastPressedX
           
protected  int _lastPressedY
           
protected  TBRect _lastRegionSelection
          region selection data: last selection.
protected  int _lastRowSelectionIndex
          last selected row.
protected  java.awt.Rectangle _lastSelRect
          the last selection rect if existing.
protected  de.jaret.util.date.JaretDate _lastStartDate
          start date of the viewer for that the last paint completed.
protected  boolean _lineDraggingAllowed
          true if dragging of the hierarchy and header delimiter is allowed.
protected  boolean _markerDraggingInDiagramArea
          if true markers can be dragged in the diagram area.
protected  de.jaret.util.date.JaretDate _markerDragStart
          start date of a marker drag.
protected  java.util.List<TimeBarMarker> _markers
          markers added to the viewer.
protected  de.jaret.util.date.JaretDate _maxDate
          Maximum date to be displayed by the viewer.
protected  boolean _milliAccuracy
          If true the viewer is used with very short intervals and the scrolling is done using milliseconds.
protected  de.jaret.util.date.JaretDate _minDate
          Minimum date to be displayed by the viewer.
protected  TimeBarModel _model
          The model.
protected  int _offsetLeft
          pixeloffset when rendering (left).
protected  int _offsetTop
          pixeloffset when rendering (top).
protected  boolean _optimizeScrolling
          if set to true scrolling optimizations will be used.
protected  TimeBarViewerInterface.Orientation _orientation
          the orientation of the viewer.
protected  de.jaret.util.date.Interval _originalInterval
          copy of a dragged or resized interval containing the original bounds.
protected  java.util.List<de.jaret.util.date.Interval> _originalIntervals
          list of copies for all intervals selected when a drag started.
protected  IOverlapStrategy _overlapStrategy
          overlap strategy to be used when drawing non-overlapped.
protected  double _pixelPerSeconds
          scale.
protected  boolean _regionRectEnabled
          true if selecting from regions is enabled.
protected  TBRect _regionSelection
          region selection data: current selection.
protected  de.jaret.util.date.JaretDate _regionStartDate
          start date when selecting a region.
protected  TimeBarRow _regionStartRow
          start row when selecting a reion.
protected  TimeBarRowFilter _rowFilter
          Filter filtering rows displayed.
protected  boolean _rowHeightDraggingAllowed
          true if the dragginng of rows is allowed.
protected  java.util.List<TimeBarRow> _rowList
          filtered and sorted list.
protected  TimeBarRowSorter _rowSorter
          sorter for the rows in the model.
protected  int _scrolledlastDrag
          number of pixels that the viewer has been scrolled during the las drag cycle.
protected  int _scrollLookBackMinutes
          additional time to take into account (looking back) when determining what intervals have to be painted.
protected  int _scrollLookForwardMinutes
          additional time to take into account (looking forward) when determining what intervals have to be painted.
protected  boolean _scrollOnFocus
          if true the viewer will try to scroll to a newly focussed interval.
protected  TimeBarSelectionModel _selectionModel
          selection model, default implementation as default.
protected  java.awt.Rectangle _selectionRect
          the current selection rectangle.
protected  java.util.List<ISelectionRectListener> _selectionRectListeners
          List of ISelectionRectListeners.
protected  de.jaret.util.date.JaretDate _startDate
          Date marking the first painted date.
protected  de.jaret.util.date.JaretDate _startIntervalDragDate
          date of drag/resize start.
protected  int _startIntervalDragX
          x ccordinate of the start of an internal drag/resize.
protected  boolean _strictClipTimeCheck
          If set to true, intervals are filtered strictly by their interval bounds, disallowing rendering beyond the bounding box calculated by the interval bounds.
protected  TimeBarViewerInterface _tbvi
          the delegating time bar viewer.
protected  java.util.List<ITimeBarChangeListener> _timeBarChangeListeners
          List of TimeBarChangeListenes.
protected  ITimeBarViewState _timeBarViewState
          standard view state.
protected  double _timeFactor
          factor used to scale the time scroll bar if integer is not enough.
protected  int _timeScalePosition
          position of the timescale.
protected  java.lang.String _title
          title of the viewer.
protected  java.awt.Rectangle _titleRect
          Title area.
protected  boolean _variableXScale
          flag indicating a variable xscale.
protected  int _xAxisHeight
          height of the time scale.
protected  java.awt.Rectangle _xAxisRect
          area in which the x axis (time scale) will be painted.
protected  TimeBarNode _xScalePPSIntervalRow
          row holding intervals with pps values overriding the default for intervals.
protected  java.awt.Rectangle _yAxisRect
          area in which the y axis will be painted.
protected  int _yAxisWidth
          width of the y axis.
protected static int DEFAULT_AUTOSCROLL_DELTA
          default for the autoscroll delta.
 
Constructor Summary
TimeBarViewerDelegate(TimeBarViewerInterface tbvi)
          Constructor will set the TimeBarViewerInterface for the delegate.
 
Method Summary
 void addFocussedIntervalListener(FocussedIntervalListener listener)
          Add a listener to be informed when the focus changes.
 void addIntervalModificator(IntervalModificator intervalModificator)
          Add an interval modificator.
 void addMarker(TimeBarMarker marker)
          Add a marker to be displayed within the diagram.
 void addMarkers(java.util.List<TimeBarMarker> markers)
          Add a list of markers.
 void addSelectionRectListener(ISelectionRectListener listener)
          Add a listener to be informed when the selection rect changes.
 void addTimeBarChangeListener(ITimeBarChangeListener listener)
          Add a listener to be informed about interval changes.
 java.awt.Rectangle calcRect(TBRect tbrect)
          Calculate the rectangle for screen representation for a tbrect (time and rows).
 void clearRegionRect()
          Remove the selction of a region if existent.
 void componentResized()
          Handle a component resize and scroll down if an empty space would be shown in the newly exposed screen estate.
 de.jaret.util.date.JaretDate dateForCoord(int coord)
          Calculate the date for a given coordinate on the timescale.
 de.jaret.util.date.JaretDate dateForCoord(int x, int y)
          Calculate the date for a given point.
 de.jaret.util.date.JaretDate dateForCoordAbs(int coord)
          Retrieve the date for an absolute coordinate along the timescale (referencing minDate).
 de.jaret.util.date.JaretDate dateForX(int x)
          Deprecated. use dateForXY or dateForCoord instead
 de.jaret.util.date.JaretDate dateForXY(int x, int y)
          Retrieve the date for a position on the screen.
 void deHighlightRow()
          Dehighlight a highlighted row.
 int dispIdxForRow(TimeBarRow row)
          Calculate the display index of the row.
 void dispose()
          Deregister from all models and free any ressources reserved.
 void elementAdded(TimeBarModel model, TimeBarRow row, de.jaret.util.date.Interval element)
          A new element was added to a row.
 void elementAddedToSelection(TimeBarSelectionModel selectionModel, java.lang.Object element)
          An element (either a row or an interval) has been added to the selection.
 void elementChanged(TimeBarModel model, TimeBarRow row, de.jaret.util.date.Interval element)
          An element in a row has changed.
 void elementRemoved(TimeBarModel model, TimeBarRow row, de.jaret.util.date.Interval element)
          An element was removed from a row.
 void elementRemovedFromSelection(TimeBarSelectionModel selectionModel, java.lang.Object element)
          An element (either a row or an interval) has been removed from the selection.
 java.util.List<de.jaret.util.date.Interval> filterIntervals(java.util.List<de.jaret.util.date.Interval> intervals)
          Applies the interval filter if set.
protected  void fireFocussedIntervalChange(TimeBarRow newFocussedRow, de.jaret.util.date.Interval newFocussedInterval)
          Inform listeners about a focus change.
protected  void fireIntervalChangeCancelled(TimeBarRow row, de.jaret.util.date.Interval interval)
          Inform time bar change listeners about a cancelled interval change.
protected  void fireIntervalChanged(TimeBarRow row, de.jaret.util.date.Interval interval, de.jaret.util.date.JaretDate oldBegin, de.jaret.util.date.JaretDate oldEnd)
          Inform time bar change listeners about a finished interval change.
protected  void fireIntervalChangeStarted(TimeBarRow row, de.jaret.util.date.Interval interval)
          Inform time bar change listeners about a beginning interval change.
protected  void fireIntervalIntermediateChange(TimeBarRow row, de.jaret.util.date.Interval interval, de.jaret.util.date.JaretDate oldBegin, de.jaret.util.date.JaretDate oldEnd)
          Inform time bar change listeners about an intermediate interval change.
protected  void fireMarkerDragStarted(TimeBarMarker marker)
          Informa listener about a started marker drag.
protected  void fireMarkerDragStopped(TimeBarMarker marker)
          Inform listeners about stopping of a marker drag.
protected  void fireRegionRectChanged()
          Inform selection rect listeners about a change of the region rect.
protected  void fireRegionRectClosed()
          Inform selectionRectListeners about the end of the region rect.
protected  void fireSelectionRectChanged()
          Inform selection rect listeners about a change of the selection rect.
protected  void fireSelectionRectClosed()
          Inform selectionRectListeners about the end of the selection rect.
 int getAbsPosForRow(int rowIdx)
          Get the absolute position (x or y depeding on the orientation) for a row.
 boolean getAdjustMinMaxDatesByModel()
           
 int getAutoScaleRows()
          Get the number of rows (columns) that the viewer scales itself to.
 int getAutoscrollDelta()
          Retrieve the currently set autoscroll delta.
 java.awt.Point getCtxCoordinate()
          Retrieve the location of a context menu popup request.
 TimeBarRow getCtxRow()
          Retrieve the row above that a popup menu request has occurred.
 java.awt.Rectangle getDiagramRect()
           
 boolean getDragAllSelectedIntervals()
          If true all selected intervals will be dragged together with the interval on that the drag happened.
 TimeBarMarker getDraggedMarker()
          Retrieve the marker currently dragged.
 boolean getDrawRowGrid()
           
 de.jaret.util.date.JaretDate getEndDate()
          Retrieve the last date displayed.
 int getFirstRow()
           
 int getFirstRowOffset()
          Retrieve the pixel offset for the first row.
 de.jaret.util.date.Interval getFocussedInterval()
          Retrieve the focusef interval.
 TimeBarRow getFocussedRow()
           
 java.awt.Rectangle getHeaderRect(TimeBarRow row)
          Calculate the rectangle for drawing the header of a given row.
 boolean getHideRoot()
          Retrieve whether the root node is shown when using a hierachical model.
 HierarchicalTimeBarModel getHierarchicalModel()
          Retrieve the hierarchical model displayed if present.
 HierarchicalViewState getHierarchicalViewState()
          Retrieve the hierarchical viewstate.
 java.awt.Rectangle getHierarchyRect()
           
 java.awt.Rectangle getHierarchyRect(TimeBarRow row)
          Calculate the rectangle for drawing the hierachy marker of a given row.
 int getHierarchyWidth()
          Retrieve the width used to draw the hierarchy area.
 TimeBarRow getHighlightedRow()
          Retrieve the highlighted row if prsent.
 java.awt.Rectangle getIntervalBounds(de.jaret.util.date.Interval interval)
          Retrieve the bounding rect of an interval.
 java.awt.Rectangle getIntervalBounds(int rowIdx, de.jaret.util.date.Interval interval)
          Calculate the bounds for an interval.
 java.awt.Rectangle getIntervalBounds(TimeBarRow row, de.jaret.util.date.Interval interval)
          Calculates the bounding rectangle for an interval.
 TimeBarIntervalFilter getIntervalFilter()
           
 java.util.List<de.jaret.util.date.Interval> getIntervals(java.awt.Rectangle curSelRect)
          Retrieve all intervals inside a selection rectangle.
 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.util.List<de.jaret.util.date.Interval> getIntervalsAt(TimeBarRow row, int x)
          Retrieve intervals in a given row for a given x coordinate.
 java.util.List<de.jaret.util.date.Interval> getIntervalsAt(TimeBarRow row, int x, int y)
          Retrieves all intervals for a given row and a x coordinate in the diagram pane.
 IIntervalSelectionStrategy getIntervalSelectionStrategy()
          Retrieve the interval selection strategy used.
 int getKeyboardChangeDelta()
          Retrieve the keyboardChangeDelta currently used.
 java.awt.Rectangle getLastSelRect()
          Retrieve the last selection rectangle.
 de.jaret.util.date.JaretDate getLastStartDate()
           
 boolean getMarkerDraggingInDiagramArea()
          Retrieve whether marker dragging in the diagram area is activated.
protected  TimeBarMarker getMarkerForCoord(int coord)
          Find a marker for a given coordinate (depending on the orientation).
 TimeBarMarker getMarkerForXY(int x, int y)
          Retrive a marker for a coordinate pair (x or y will be used depending on the orientation).
 java.util.List<TimeBarMarker> getMarkers()
          Retrieve all markers added.
 de.jaret.util.date.JaretDate getMaxDate()
           
 int getMaxOverlapCount(TimeBarRow row)
          Retrieve tha maximal count of overlapping intervals in a row.
 long getMilliSecondsDisplayed()
          Get the milli seconds currently displayed by the diagram.
 de.jaret.util.date.JaretDate getMinDate()
           
 TimeBarModel getModel()
          Get the model the viewer displays.
 java.lang.String getName()
          Get the name of the viewer/component.
 boolean getOptimizeScrolling()
          Get whether optimzed scrollnig is used.
 TimeBarViewerInterface.Orientation getOrientation()
          Retrieve the orientation of the viewer.
 IOverlapStrategy getOverlapStrategy()
          Retrieve the used strategy for determing overlap information.
protected  double getPixelPerMilliSecond()
          Retrieve the corrected pixel per second value for milliseconds.
 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.
 PPSInterval getPPSInterval(de.jaret.util.date.JaretDate d)
          Retrieve the appropriate pps interval for a given date.
 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.
 TimeBarRow getRow(int idx)
          Get a timebar row from the filtered/sorted list by index.
 java.awt.Rectangle getRowBounds(TimeBarRow row)
          Calculates the bounds of a row.
 int getRowCount()
          Return the size of the row list.
 TimeBarRowFilter getRowFilter()
           
 int getRowHeight()
          Retrieve the current row height (col width).
 int getRowIdxForAbsoluteOffset(int value)
          Calculate the row index for an absolute pixel position (referring to all rows stacked).
 int getRowIndex(TimeBarRow row)
          Retrieve the index of a given row.
 int getRowPixOffsetForAbsoluteOffset(int rowIdx, int value)
          Calculate the pixel offset of the first row for an absolute value (referring to the total height of all rows).
 int getRowsDisplayed()
           
 TimeBarRowSorter getRowSorter()
           
 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.
 int getSelectionDelta()
          Retrieve the selection delta used to determine whether a marker or interval edge is clicked/dragged.
 TimeBarSelectionModel getSelectionModel()
           
 java.awt.Rectangle getSelectionRect()
          Retrieve the selection rect.
 de.jaret.util.date.JaretDate getStartDate()
          Get the starting date, that is the leftmost date displayed.
 boolean getStrictClipTimeCheck()
          Retrieve the strategy for filtering when painting (see setStrictClipTimeCheck(boolean)).
 ITimeBarViewState getTimeBarViewState()
          Retrieve the timebarviewstate.
 int getTimeScalePosition()
           
 java.lang.String getTitle()
          Retrieve the title of the viewer.
 java.awt.Rectangle getTitleRect()
          Retrieve area for drawing a title.
 java.lang.String getToolTipText(int x, int y)
          Retrieve the tooltip text for a given location.
 int getTotalHeight()
          Calculate the total height/width of all rows.
 long getTotalMilliSeconds()
          Calculates the number of milliseconds the complete model spans.
 long getTotalSeconds()
          Calculates the number of seconds the complete model spans.
 boolean getUseUniformHeight()
          Retrieve whether uniform height is use for all intervals in a row.
 int getXAxisHeight()
           
 java.awt.Rectangle getXAxisRect()
           
 java.awt.Rectangle getYAxisRect()
           
 int getYAxisWidth()
           
 void handleHorizontalScroll(int value, boolean redirect)
          Handle operation of the horizontal scroll bar.
 void handleKeyPressed(int keyCode, int modifierMask)
          Handle key events from the time bar viewers.
 void handleVerticalScroll(int value, boolean redirect)
          Handle change of the vertical scroll bar.
 boolean hasVariableXScale()
          Retrieve the state of the variable xscale state.
 void headerChanged(TimeBarModel model, TimeBarRow row, java.lang.Object newHeader)
          The header of a row changed.
 void highlightRow(int y)
          Highlight a row by giving the display y coordinate.
 void highlightRow(TimeBarRow row)
          Highlight a row.
 boolean isAutoscrollEnabled()
          Get the autoscroll behaviour.
 boolean isDisplayed(de.jaret.util.date.JaretDate date)
          Checks whether a given date is currently visible.
 boolean isDrawOverlapping()
           
 boolean isFiltered(de.jaret.util.date.Interval interval)
          Check whether an interval is filtered by an interval filter.
 boolean isFiltered(TimeBarRow row)
          Check whether a row is filtered out.
 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 isInRowAxis(int x, int y)
          Check whether a given point is in the row axis area (hierarchy or header).
 boolean isIntervalVisible(TimeBarRow row, de.jaret.util.date.Interval interval)
          Check whether any part of an interval is visible.
 boolean isLineDraggingAllowed()
          Check whether it is allowed to drag the limiting lines of the hierarhy ara and the header (yaxis) area.
 boolean isMarkerDraggingInProgress()
          Check whether a marker is beeing dragged.
 boolean isMilliAccuracy()
          Check whether th delegate is setup for millisecond accuracy.
 boolean isRowDisplayed(TimeBarRow row)
          Check whether a certain row is currently displayed.
 boolean isRowHeightDraggingAllowed()
          Check whether row height dragging is allowed.
 void markerDescriptionChanged(TimeBarMarker marker, java.lang.String oldValue, java.lang.String newValue)
          Callback method indicating the description of a marker changed.
 void markerMoved(TimeBarMarker marker, de.jaret.util.date.JaretDate oldDate, de.jaret.util.date.JaretDate currentDate)
          Callback method indicating a move of a marker.
 void modelDataChanged(TimeBarModel model)
          Unspecific or multiple changes occured in the model.
 void mouseDragged(int x, int y, int modifierMask)
          Handle mouse dragging.
 void mouseMoved(int x, int y)
          Handle simple mouse movements.
 void mousePressed(int x, int y, boolean isPopupTrigger, int modifierMask)
          Handle press of a mouse button.
 void mouseReleased(int x, int y, boolean isPopupTrigger, int modifierMask)
          Handle release of mouse button.
 void moveFocusDown()
          Move the focus down.
 void moveFocusLeft()
          Move the focus to the left.
 void moveFocusRight()
          Move the focus to the right.
 void moveFocusUp()
          Move the focus up.
 PPSInterval nextPPSInterval(de.jaret.util.date.JaretDate d)
          Get the next interval to a date from the pps row (variable x axis).
 void preparePaint(int cwidth, int cheight)
          Calculate the boundaries of the diagram elements.
 void preparePaintHorizontal(int cwidth, int cheight)
          Calculate the boundaries of the diagram elements for the horizontal orientation.
 void preparePaintVertical(int cwidth, int cheight)
          Calculate the boundaries of the diagram elements for the vertical orientation.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          
 void remFocussedIntervalListener(FocussedIntervalListener listener)
          Remove a focussedIntervalListener.
 void remIntervalModificator(IntervalModificator intervalModificator)
          Remove an interval modificator.
 void remMarker(TimeBarMarker marker)
          Removes a marker from the diagram.
 void removeTimeBarChangeListener(ITimeBarChangeListener listener)
          Remove a timebar change listener.
 void remSelectionRectListener(ISelectionRectListener listener)
          Remove a selection rect listener.
 void rowAdded(TimeBarModel model, TimeBarRow row)
          The model was enlarged by a new row.
 void rowDataChanged(TimeBarModel model, TimeBarRow row)
          Unspecific change in the data of a row.
 TimeBarRow rowForXY(int x, int y)
          Get the row located at x,y.
 TimeBarRow rowForY(int y)
          Get the row for a given y coordinate in the diagram pane.
 boolean rowLineHit(int x, int y)
          Check whether a row delimiter line is hit by a coordinate.
 void rowRemoved(TimeBarModel model, TimeBarRow row)
          The model was reduced by a row.
 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 interval to specified position (by ration) in the vieable area of the chart.
 void scrollIntervalToVisible(TimeBarRow row, de.jaret.util.date.Interval interval)
          Make sure the specified interval is in the visibe area of the viewer.
 void scrollIntervalToVisible(TimeBarRow row, de.jaret.util.date.Interval interval, double horizontalRatio, double verticalRatio)
          Scroll an interval to specified position (by ration) in the vieable area of the chart.
 void scrollRowToVisible(TimeBarRow row)
          Make sure the specified row is visible.
protected  void scrollTo(de.jaret.util.date.JaretDate startDate)
          Handle a scrolling operation.
 void selectIntervals(java.awt.Rectangle curSelRect)
          Ensures that all intervals in the given rectangle are selected.
 void selectionChanged(TimeBarSelectionModel selectionModel)
          The selection did unspecific change.
 void setAdjustMinMaxDatesByModel(boolean adjustMinMaxDatesByModel)
           
 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 setDragAllSelectedIntervals(boolean dragAllSelectedIntervals)
          If set to true all selected intervals are dragged when an interval is dragged.
 void setDrawingOffset(int marginLeft, int marginTop)
          Set margins to the left and top to be included in geometry calculations.
 void setDrawOverlapping(boolean drawOverlapping)
          Set the drawing mode concerning overlapping intervals.
 void setDrawRowGrid(boolean drawRowGrid)
           
 void setFirstRow(int firstRow)
          Sets the first row to be displayed with a pixel offset 0.
 void setFirstRow(int firstRow, int pixOffset)
          Set the first row to be displayed.
 void setFirstRow(TimeBarRow row)
          Set the first row to be displayed.
 void setFirstRowOffset(int offset)
          Set the pixel offset 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 setHideRoot(boolean hideRoot)
          Set whether the root node should be shown when using a hierachical model.
 void setHierarchicalViewState(HierarchicalViewState hvs)
          Set the hierarchical viewstate.
 void setHierarchyWidth(int width)
          Set the width fo rrendering the hierarchy area.
 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 setIntervalFilter(TimeBarIntervalFilter intervalFilter)
          Set a filter for displaying only a part of the intervals.
 void setIntervalSelectionStrategy(IIntervalSelectionStrategy intervalSelectionStrategy)
          Set the interval selection strategy.
 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 setLastSelRect(java.awt.Rectangle rect)
          Set the last selection rectangle.
 void setLastStartDate(de.jaret.util.date.JaretDate lastStartDate)
           
 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 setMaxDate(de.jaret.util.date.JaretDate maxDate)
          Set the maximum date for the diagram.
 void setMilliAccuracy(boolean milliAccuracy)
          Set the delegates status concerning millisecond accuracy.
 void setMinDate(de.jaret.util.date.JaretDate minDate)
           
 void setModel(HierarchicalTimeBarModel hModel)
          Set a hierarchical model as the time bar model.
 void setModel(TimeBarModel model)
          Set the model to be displayed.
 void setName(java.lang.String name)
          Set the name of the viewer/component for display or debugging purposes.
 void setOptimizeScrolling(boolean optimizeScrolling)
          Set whether optimized scrolling should be used (not allowed togeter with a variable xscale).
 void setOrientation(TimeBarViewerInterface.Orientation orientation)
          Set the orientation of the viewer.
 void setOverlapStrategy(IOverlapStrategy overlapStrategy)
          Set the strategy to be used for calculating overlap information.
 void setPixelPerSecond(double pixelPerSecond)
          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.
protected  void setPixelPerSecond(double pixelPerSecond, boolean repaint)
          Internal version of setPixelPerSecond that allows control of the repaint behaviour.
 void setRegionRectEnable(boolean enabled)
          Enable/Disable region selections.
 void setRowFilter(TimeBarRowFilter rowFilter)
          Set a filter to select a subset of rows in the model to be displayed.
 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 setRowSorter(TimeBarRowSorter rowSorter)
          Set a sorter for sorting the displayed rows.
 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 setSelectionDelta(int selectionDelta)
          Set the selection delta used to determine whether a marker or interval edge is clicked/dragged.
 void setSelectionModel(TimeBarSelectionModel selectionModel)
           
 void setStartDate(de.jaret.util.date.JaretDate startDate)
          Sets the date to be displayed at the position of the yaxis.
 void setStrictClipTimeCheck(boolean strictClipTimeCheck)
          Set the optimization strategy for interval filetering when painting.
 void setTimeScalePosition(int timeScalePosition)
           
 void setTitle(java.lang.String title)
          Set the title string to be displayed.
 void setUseUniformHeight(boolean useUniformHeight)
          Set whether all intervals in a non overlapping drawn ro should use the same height/width.
 void setVariableXScale(boolean state)
          Set the state for the variable xscale.
 void setXAxisHeight(int axisHeight)
          Set the height of the y axis.
 void setYAxisWidth(int axisWidth)
           
 java.lang.String toString()
          Produce a simple string representation.
 void updateRowList()
          Updates the shadow row list of the displayed rows.
 void updateScrollBars()
          Update the scroll bar bounds to match the current display an data.
 int xForDate(de.jaret.util.date.JaretDate date)
          Calculate the x coordinate for a given date.
 int xForDateAbs(de.jaret.util.date.JaretDate date)
          Calculate the x coordinate for a given date as absolute xvalue beginning with minDate = 0.
protected  int xForDatePlain(de.jaret.util.date.JaretDate date, boolean absolute)
          No variable xscale calculation of x for for date.
protected  int xForDateVariable(de.jaret.util.date.JaretDate date, boolean absolute)
          Variable calculation of x for date.
 int yForRow(TimeBarRow row)
          Calculate the y coordinate in the diagram pane for the given row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_tbvi

protected final TimeBarViewerInterface _tbvi
the delegating time bar viewer.


_pixelPerSeconds

protected double _pixelPerSeconds
scale.


_variableXScale

protected boolean _variableXScale
flag indicating a variable xscale.


_xScalePPSIntervalRow

protected TimeBarNode _xScalePPSIntervalRow
row holding intervals with pps values overriding the default for intervals.


_milliAccuracy

protected boolean _milliAccuracy
If true the viewer is used with very short intervals and the scrolling is done using milliseconds.


_xAxisHeight

protected int _xAxisHeight
height of the time scale.


_yAxisWidth

protected int _yAxisWidth
width of the y axis.


_hierarchyWidth

protected int _hierarchyWidth
width of the hierarchy header (in case of an hierachical model).


_lineDraggingAllowed

protected boolean _lineDraggingAllowed
true if dragging of the hierarchy and header delimiter is allowed.


_orientation

protected TimeBarViewerInterface.Orientation _orientation
the orientation of the viewer.


_model

protected TimeBarModel _model
The model.


_hierarchicalModel

protected HierarchicalTimeBarModel _hierarchicalModel
The hierarchical model when used.


_timeBarViewState

protected ITimeBarViewState _timeBarViewState
standard view state.


_hierarchicalViewState

protected HierarchicalViewState _hierarchicalViewState
Viewstate holding state information for hierarchical operation.


_title

protected java.lang.String _title
title of the viewer.


_firstRow

protected int _firstRow
index of the first row displayed.


_firstRowPixelOffset

protected int _firstRowPixelOffset
pixeloffset of the first row.


_rowList

protected java.util.List<TimeBarRow> _rowList
filtered and sorted list.


_adjustMinMaxDatesByModel

protected boolean _adjustMinMaxDatesByModel
Flag controlling min/max setting behaviour. If true the min and max of the viewer are adapted to the models min/max dates.


_optimizeScrolling

protected boolean _optimizeScrolling
if set to true scrolling optimizations will be used.


_startDate

protected de.jaret.util.date.JaretDate _startDate
Date marking the first painted date.


_endDate

protected de.jaret.util.date.JaretDate _endDate
Date marking the last painted date.


_minDate

protected de.jaret.util.date.JaretDate _minDate
Minimum date to be displayed by the viewer.


_maxDate

protected de.jaret.util.date.JaretDate _maxDate
Maximum date to be displayed by the viewer.


_lastStartDate

protected de.jaret.util.date.JaretDate _lastStartDate
start date of the viewer for that the last paint completed.


_rowFilter

protected TimeBarRowFilter _rowFilter
Filter filtering rows displayed.


_rowSorter

protected TimeBarRowSorter _rowSorter
sorter for the rows in the model.


_intervalFilter

protected TimeBarIntervalFilter _intervalFilter
filter filtering intervals displayed.


_selectionModel

protected TimeBarSelectionModel _selectionModel
selection model, default implementation as default.


_markers

protected java.util.List<TimeBarMarker> _markers
markers added to the viewer.


_drawGrid

protected boolean _drawGrid
when true the grid/background will be painted.


_drawRowGrid

protected boolean _drawRowGrid
if true a row grid will be painted.


_timeScalePosition

protected int _timeScalePosition
position of the timescale. One of the constants from the viewer interface.


_diagramRect

protected java.awt.Rectangle _diagramRect
area in which the actual rows are painted.


_xAxisRect

protected java.awt.Rectangle _xAxisRect
area in which the x axis (time scale) will be painted.


_yAxisRect

protected java.awt.Rectangle _yAxisRect
area in which the y axis will be painted.


_titleRect

protected java.awt.Rectangle _titleRect
Title area.


_hierarchyRect

protected java.awt.Rectangle _hierarchyRect
drawing area of the hierarchy elements.


_offsetTop

protected int _offsetTop
pixeloffset when rendering (top).


_offsetLeft

protected int _offsetLeft
pixeloffset when rendering (left).


_draggedMarker

protected TimeBarMarker _draggedMarker
marker currently involved in a drag operation.


_changingInterval

protected de.jaret.util.date.Interval _changingInterval
interval currently changed by dragging.


_draggedInterval

protected boolean _draggedInterval
true indicates dragging of an interval as a whole.


_draggedIntervalEdgeLeft

protected boolean _draggedIntervalEdgeLeft
if not dragging the whole interval true means left bound.


DEFAULT_AUTOSCROLL_DELTA

protected static final int DEFAULT_AUTOSCROLL_DELTA
default for the autoscroll delta.

See Also:
Constant Field Values

_autoscrollDelta

protected int _autoscrollDelta
the amount of pixels that is assumed to scroll/drag when the cursor left the diagram area.


_dragAllSelectedIntervals

protected boolean _dragAllSelectedIntervals
flag indicating whether all selcted intervals should be dragged whe draggig a iterval.


_hierarchyLineDragging

protected boolean _hierarchyLineDragging
true if dragging of the hierarchy limiting line is ongoing.


_headerLineDragging

protected boolean _headerLineDragging
true if dragging of the header limiting line is ongoing.


_rowHeightDraggingAllowed

protected boolean _rowHeightDraggingAllowed
true if the dragginng of rows is allowed.


_heightDraggedRow

protected TimeBarRow _heightDraggedRow
row thats height is currently dragged or null when no row height is beeing dragged.


_autoscroll

protected boolean _autoscroll
controls autoscroll behaviour: true -> enabled.


_selectionRect

protected java.awt.Rectangle _selectionRect
the current selection rectangle.


_lastSelRect

protected java.awt.Rectangle _lastSelRect
the last selection rect if existing.


_highlightedRow

protected TimeBarRow _highlightedRow
highlighted row if any.


_drawOverlapping

protected boolean _drawOverlapping
flag controlling the drawing behaviour for overlapping intervals.


_keyboardChangeDelta

protected int _keyboardChangeDelta
Change delta for keyboard modification in seconds.


_scrollOnFocus

protected boolean _scrollOnFocus
if true the viewer will try to scroll to a newly focussed interval.


_focussedInterval

protected de.jaret.util.date.Interval _focussedInterval
Currenty focussed interval or null if no interval has the focus.


_focussedRow

protected TimeBarRow _focussedRow
Row of the focussed interval or null if no interval is focussed.


_focussedIntervalListeners

protected java.util.List<FocussedIntervalListener> _focussedIntervalListeners
List of FocussedInteralListeners.


_timeBarChangeListeners

protected java.util.List<ITimeBarChangeListener> _timeBarChangeListeners
List of TimeBarChangeListenes.


_selectionRectListeners

protected java.util.List<ISelectionRectListener> _selectionRectListeners
List of ISelectionRectListeners.


_intervalModificators

protected java.util.List<IntervalModificator> _intervalModificators
List of intervalmodificators that have been registered.


_strictClipTimeCheck

protected boolean _strictClipTimeCheck
If set to true, intervals are filtered strictly by their interval bounds, disallowing rendering beyond the bounding box calculated by the interval bounds.


_scrollLookBackMinutes

protected int _scrollLookBackMinutes
additional time to take into account (looking back) when determining what intervals have to be painted.


_scrollLookForwardMinutes

protected int _scrollLookForwardMinutes
additional time to take into account (looking forward) when determining what intervals have to be painted.


_timeFactor

protected double _timeFactor
factor used to scale the time scroll bar if integer is not enough.


_overlapStrategy

protected IOverlapStrategy _overlapStrategy
overlap strategy to be used when drawing non-overlapped.


_hideRoot

protected boolean _hideRoot
if set to true and using a hierchical model the root will not be shown.


_intervalSelectionStrategy

protected IIntervalSelectionStrategy _intervalSelectionStrategy
insterval selection strategy.


_regionRectEnabled

protected boolean _regionRectEnabled
true if selecting from regions is enabled.


_regionSelection

protected TBRect _regionSelection
region selection data: current selection.


_lastRegionSelection

protected TBRect _lastRegionSelection
region selection data: last selection.


_regionStartDate

protected de.jaret.util.date.JaretDate _regionStartDate
start date when selecting a region.


_regionStartRow

protected TimeBarRow _regionStartRow
start row when selecting a reion.


_initialStartDate

protected de.jaret.util.date.JaretDate _initialStartDate

_initialSecondsDisplayed

protected int _initialSecondsDisplayed

_lastRowSelectionIndex

protected int _lastRowSelectionIndex
last selected row. Used for shift-click range selections.


_ctxCoordinate

protected java.awt.Point _ctxCoordinate
coordinate a context menu has been requested to pop up.


_ctxRow

protected TimeBarRow _ctxRow
row above that a context menu has been requested to pup up.


_ctxDate

protected de.jaret.util.date.JaretDate _ctxDate
date for the ctx coordinate.


_originalInterval

protected de.jaret.util.date.Interval _originalInterval
copy of a dragged or resized interval containing the original bounds.


_originalIntervals

protected java.util.List<de.jaret.util.date.Interval> _originalIntervals
list of copies for all intervals selected when a drag started.


_draggedIntervals

protected java.util.List<de.jaret.util.date.Interval> _draggedIntervals
list of draged intervals excluding the one on that the drag started.


_draggedIntervalsRows

protected java.util.List<TimeBarRow> _draggedIntervalsRows
cache for the row information for the dragged intervals.


_startIntervalDragX

protected int _startIntervalDragX
x ccordinate of the start of an internal drag/resize.


_startIntervalDragDate

protected de.jaret.util.date.JaretDate _startIntervalDragDate
date of drag/resize start.


_lastDragDate

protected de.jaret.util.date.JaretDate _lastDragDate
last date that has been used in a drag/resize.


_markerDragStart

protected de.jaret.util.date.JaretDate _markerDragStart
start date of a marker drag.


_intervalDraggedRow

protected TimeBarRow _intervalDraggedRow
the row of the dragged/resized interval.


_scrolledlastDrag

protected int _scrolledlastDrag
number of pixels that the viewer has been scrolled during the las drag cycle.


_lastGridSnapDifference

protected double _lastGridSnapDifference
last difference to a gridsnap position (used when dragging an interval).


_lastGridSnapDifferences

protected java.util.List<java.lang.Double> _lastGridSnapDifferences
list of lat grid snap differences, used when more than one interval is beeing dragged.


_lastPressedX

protected int _lastPressedX

_lastPressedY

protected int _lastPressedY

_markerDraggingInDiagramArea

protected boolean _markerDraggingInDiagramArea
if true markers can be dragged in the diagram area.

Constructor Detail

TimeBarViewerDelegate

public TimeBarViewerDelegate(TimeBarViewerInterface tbvi)
Constructor will set the TimeBarViewerInterface for the delegate.

Parameters:
tbvi - the viewer as TimeBarViewerInterface
Method Detail

dispose

public void dispose()
Deregister from all models and free any ressources reserved.


isDisplayed

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

Parameters:
date - the date to be checked
Returns:
true if the date is within the visible area of the diagram.

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. null is an allowed value indicating no row filtering

getRowFilter

public TimeBarRowFilter getRowFilter()
Returns:
Returns the rowFilter.

isFiltered

public boolean isFiltered(TimeBarRow row)
Check whether a row is filtered out.

Parameters:
row - row to check.
Returns:
true if the row is filtered out.

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. null is an allowed value indicating no special sorting

getRowSorter

public TimeBarRowSorter getRowSorter()
Returns:
Returns the rowSorter.

setIntervalFilter

public void setIntervalFilter(TimeBarIntervalFilter intervalFilter)
Set a filter for displaying only a part of the intervals. The model itself will not be affected.

Parameters:
intervalFilter - TimeBarIntervalFilter to be used. null is an allowed value indicating no interval filtering

getIntervalFilter

public TimeBarIntervalFilter getIntervalFilter()
Returns:
Returns the intervalFilter.

isFiltered

public boolean isFiltered(de.jaret.util.date.Interval interval)
Check whether an interval is filtered by an interval filter.

Parameters:
interval - interval to check.
Returns:
true if the interval is filtered.

updateRowList

public void updateRowList()
Updates the shadow row list of the displayed rows. The method will update the row axis scrollbar (x or y depending on the orientation) in the case that the number of rows changed.


getRow

public TimeBarRow getRow(int idx)
Get a timebar row from the filtered/sorted list by index.

Parameters:
idx - index in the list
Returns:
the TimeBarRow at the index

getRowIndex

public int getRowIndex(TimeBarRow row)
Retrieve the index of a given row.

Parameters:
row - row in question
Returns:
the index or -1 if the row could not be found

getRowCount

public int getRowCount()
Return the size of the row list.

Returns:
the actual row count of the possibly filtered list of rows

getTotalSeconds

public long getTotalSeconds()
Calculates the number of seconds the complete model spans. If min or max date is not set, the number of seconds is 0.

Returns:
number of seconds

getTotalMilliSeconds

public long getTotalMilliSeconds()
Calculates the number of milliseconds the complete model spans.

Returns:
number of milliseconds

getSecondsDisplayed

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

Returns:
the number of seconds currently displayed by the diagram geometry

getMilliSecondsDisplayed

public long getMilliSecondsDisplayed()
Get the milli seconds currently displayed by the diagram.

Returns:
the number of milli seconds currently displayed by the diagram geometry

getSelectionModel

public TimeBarSelectionModel getSelectionModel()
Returns:
Returns the selectionModel.

setSelectionModel

public void setSelectionModel(TimeBarSelectionModel selectionModel)
Parameters:
selectionModel - The selectionModel to set.

getAdjustMinMaxDatesByModel

public boolean getAdjustMinMaxDatesByModel()
Returns:
Returns the adjustMinMaxDatesByModel.

setAdjustMinMaxDatesByModel

public void setAdjustMinMaxDatesByModel(boolean adjustMinMaxDatesByModel)
Parameters:
adjustMinMaxDatesByModel - The adjustMinMaxDatesByModel to set.

getMaxDate

public de.jaret.util.date.JaretDate getMaxDate()
Returns:
Returns the maxDate.

setMaxDate

public void setMaxDate(de.jaret.util.date.JaretDate maxDate)
Set the maximum date for the diagram.

Parameters:
maxDate - The maxDate to set.

getMinDate

public de.jaret.util.date.JaretDate getMinDate()
Returns:
Returns the minDate.

setMinDate

public void setMinDate(de.jaret.util.date.JaretDate minDate)
Parameters:
minDate - The minDate to set.

getStartDate

public de.jaret.util.date.JaretDate getStartDate()
Get the starting date, that is the leftmost date displayed.

Returns:
Returns the startDate.

setStartDate

public void setStartDate(de.jaret.util.date.JaretDate startDate)
Sets the date to be displayed at the position of the yaxis.

Parameters:
startDate - The startDate to set.

scrollTo

protected void scrollTo(de.jaret.util.date.JaretDate startDate)
Handle a scrolling operation.

Parameters:
startDate - new start date

getModel

public TimeBarModel getModel()
Get the model the viewer displays.

Returns:
TimeBarModel

setModel

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

Parameters:
model - TimeBarModel to be displayed

setModel

public void setModel(HierarchicalTimeBarModel hModel)
Set a hierarchical model as the time bar model.

Parameters:
hModel - hierarchical model to be displayed

getHierarchicalModel

public HierarchicalTimeBarModel getHierarchicalModel()
Retrieve the hierarchical model displayed if present.

Returns:
hierarchical model or null if a flat model is used

setPixelPerSecond

public void setPixelPerSecond(double pixelPerSecond)
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.

Parameters:
pixelPerSecond - pixel per second.

setPixelPerSecond

protected void setPixelPerSecond(double pixelPerSecond,
                                 boolean repaint)
Internal version of setPixelPerSecond that allows control of the repaint behaviour.

Parameters:
pixelPerSecond - pixel per second
repaint - true if a repaint should be triggered

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. If the viewer has not been drawn yet, the method delegates to setInitialDiaplyRange. The center parameter will not be taken into account (since it is impossible to do the calculations).

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. If the viewer has not been drawn yet, the method delegates to setInitialDiaplyRange. The centerDate parameter will not be taken into account (since this is impossible to calculate).

Parameters:
seconds - number of seconds that will be displayed on the x axis
centerDate - date that will be fixed while scaling

getPixelPerSecond

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

Returns:
pixel per second

getPixelPerMilliSecond

protected double getPixelPerMilliSecond()
Retrieve the corrected pixel per second value for milliseconds.

Returns:
pixel per millisecond

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.

Parameters:
startDate - start date
secondsDisplayed - seconds to be displayed in the viewer

setRowHeight

public void setRowHeight(int rowHeight)
Set the height for the rows in pixel. This property is bound. If the orientation is vertical this sets the width of the columns. If the viewstate is configured to use individual row heights, this will set the default row height.

Parameters:
rowHeight - new row height or default row height

getRowHeight

public int getRowHeight()
Retrieve the current row height (col width). If individual row heights are used this will return the default row height.

Returns:
row height in pixel or default row height

getEndDate

public de.jaret.util.date.JaretDate getEndDate()
Retrieve the last date displayed.

Returns:
last date displayed

addMarker

public void addMarker(TimeBarMarker marker)
Add a marker to be displayed within the diagram.

Parameters:
marker - TimeBarMarkerImpl to be displayed in the diagram

remMarker

public void remMarker(TimeBarMarker marker)
Removes a marker from the diagram.

Parameters:
marker - TimeBarMarkerImpl to be removed

getMarkerForXY

public TimeBarMarker getMarkerForXY(int x,
                                    int y)
Retrive a marker for a coordinate pair (x or y will be used depending on the orientation).

Parameters:
x - coordinate
y - coordinate
Returns:
marker or null

getMarkerForCoord

protected TimeBarMarker getMarkerForCoord(int coord)
Find a marker for a given coordinate (depending on the orientation).

Parameters:
coord - coordinate
Returns:
a marker or null if none was found

getMarkers

public java.util.List<TimeBarMarker> getMarkers()
Retrieve all markers added.

Returns:
List of markers.

addMarkers

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

Parameters:
markers - list of markers

updateScrollBars

public void updateScrollBars()
Update the scroll bar bounds to match the current display an data.


handleHorizontalScroll

public void handleHorizontalScroll(int value,
                                   boolean redirect)
Handle operation of the horizontal scroll bar.

Parameters:
value - new value
redirect - if true allow redirecteion to the vertical scroll according to orientation

getRowIdxForAbsoluteOffset

public int getRowIdxForAbsoluteOffset(int value)
Calculate the row index for an absolute pixel position (referring to all rows stacked).

Parameters:
value - absolute position in the imagined all rows display
Returns:
the index of the row for the given position

getRowPixOffsetForAbsoluteOffset

public int getRowPixOffsetForAbsoluteOffset(int rowIdx,
                                            int value)
Calculate the pixel offset of the first row for an absolute value (referring to the total height of all rows).

Parameters:
rowIdx - index of the first row
value - absolute value (height/width offset)
Returns:
pixeloffset (to be used as the pixel offset of the first row)

getTotalHeight

public int getTotalHeight()
Calculate the total height/width of all rows.

Returns:
the total height/row size

getAbsPosForRow

public int getAbsPosForRow(int rowIdx)
Get the absolute position (x or y depeding on the orientation) for a row.

Parameters:
rowIdx - inde of the row
Returns:
absolute begin position of the row

handleVerticalScroll

public void handleVerticalScroll(int value,
                                 boolean redirect)
Handle change of the vertical scroll bar.

Parameters:
value - new value of the scroll bar
redirect - allow redirection to the horizontal scroll handling according to orientation

dateForXY

public de.jaret.util.date.JaretDate dateForXY(int x,
                                              int y)
Retrieve the date for a position on the screen. According to the orientation x or y will be used.

Parameters:
x - x coordinate
y - y coordinate
Returns:
date for the position

dateForX

public de.jaret.util.date.JaretDate dateForX(int x)
Deprecated. use dateForXY or dateForCoord instead

Calculate the date for a given x coordinate (or y in case of vertical orientation).

Parameters:
x - the x coordinate
Returns:
the JaretDate for the given x location or null if no start date has been set

dateForCoord

public de.jaret.util.date.JaretDate dateForCoord(int coord)
Calculate the date for a given coordinate on the timescale.

Parameters:
coord - the coordinate
Returns:
the JaretDate for the given location or null if no start date has been set

dateForCoord

public de.jaret.util.date.JaretDate dateForCoord(int x,
                                                 int y)
Calculate the date for a given point.

Parameters:
x - x
y - y
Returns:
date or null

dateForCoordAbs

public de.jaret.util.date.JaretDate dateForCoordAbs(int coord)
Retrieve the date for an absolute coordinate along the timescale (referencing minDate).

Parameters:
coord - xposition
Returns:
date for the position along the time axis

xForDate

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

Parameters:
date - JaretDate for which the coordinate is to be calculated
Returns:
x coordinate in the current view

xForDateAbs

public int xForDateAbs(de.jaret.util.date.JaretDate date)
Calculate the x coordinate for a given date as absolute xvalue beginning with minDate = 0.

Parameters:
date - JaretDate for which the coordinate is to be calculated
Returns:
x coordinate

xForDatePlain

protected int xForDatePlain(de.jaret.util.date.JaretDate date,
                            boolean absolute)
No variable xscale calculation of x for for date.

Parameters:
date - date
absolute - if set to true absolute x value referencing minDate
Returns:
x for date

xForDateVariable

protected int xForDateVariable(de.jaret.util.date.JaretDate date,
                               boolean absolute)
Variable calculation of x for date.

Parameters:
date - date
absolute - if set to true absolute x value referencing minDate
Returns:
x for date

getPPSInterval

public PPSInterval getPPSInterval(de.jaret.util.date.JaretDate d)
Retrieve the appropriate pps interval for a given date.

Parameters:
d - date
Returns:
interval or null

nextPPSInterval

public PPSInterval nextPPSInterval(de.jaret.util.date.JaretDate d)
Get the next interval to a date from the pps row (variable x axis).

Parameters:
d - date
Returns:
next interval (future) to the given date or null if there is no such interval

rowForXY

public TimeBarRow rowForXY(int x,
                           int y)
Get the row located at x,y.

Parameters:
x - x coordinate
y - y coordinate
Returns:
row at the given location or null if no row could be determined

rowForY

public TimeBarRow rowForY(int y)
Get the row for a given y coordinate in the diagram pane. In case of vertical orientation this has to be read as columnForX.

Parameters:
y - y coordinate (or x coordinate when using vertical orientation)
Returns:
the row or null if no row is found for the given y

yForRow

public int yForRow(TimeBarRow row)
Calculate the y coordinate in the diagram pane for the given row. Works only on displayed rows!

Parameters:
row - row
Returns:
y coordinate in the diagram pane or -1 if the row is not displayed

dispIdxForRow

public int dispIdxForRow(TimeBarRow row)
Calculate the display index of the row. The display index is 0 for the topmost row.

Parameters:
row - row
Returns:
the display index

getRowBounds

public java.awt.Rectangle getRowBounds(TimeBarRow row)
Calculates the bounds of a row. If the row is not displayed the resulting Rectangle will be 0,0,0,0. The ractangle includes header etc.

Parameters:
row - row to calculate the bounds for
Returns:
Rectangle describing teh rectangle for the row in the current view

getIntervalBounds

public java.awt.Rectangle getIntervalBounds(int rowIdx,
                                            de.jaret.util.date.Interval interval)
Calculate the bounds for an interval.

Parameters:
rowIdx - index of the row
interval - interval
Returns:
bounding rectangle

getIntervalBounds

public java.awt.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

getIntervalBounds

public java.awt.Rectangle getIntervalBounds(TimeBarRow row,
                                            de.jaret.util.date.Interval interval)
Calculates the bounding rectangle for an interval. The row may be given optional- if it isn't the rectangle will span the complete height (vertical: width) of the diagram

Parameters:
row - TimeBarRow - may be null
interval - Interval in question
Returns:
Rectangle

getRowsDisplayed

public int getRowsDisplayed()
Returns:
the number of rows currently displayed by the viewer

isRowDisplayed

public boolean isRowDisplayed(TimeBarRow row)
Check whether a certain row is currently displayed.

Parameters:
row - row to be checked
Returns:
true if the row is in the current view, false otherwise

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

getIntervalsAt

public java.util.List<de.jaret.util.date.Interval> getIntervalsAt(TimeBarRow row,
                                                                  int x,
                                                                  int y)
Retrieves all intervals for a given row and a x coordinate in the diagram pane. Filtered intervals will be left out.

Parameters:
row - row to search in
x - x coordinate, will be ignored if set to -1
y - y coordinate, will be ignored if set to -1
Returns:
List of intervals for the given x and row

getIntervalsAt

public java.util.List<de.jaret.util.date.Interval> getIntervalsAt(TimeBarRow row,
                                                                  int x)
Retrieve intervals in a given row for a given x coordinate.

Parameters:
row - row to search in
x - x coordinate
Returns:
list of intervals

markerMoved

public void markerMoved(TimeBarMarker marker,
                        de.jaret.util.date.JaretDate oldDate,
                        de.jaret.util.date.JaretDate currentDate)
Callback method indicating a move of a marker.

Specified by:
markerMoved in interface TimeBarMarkerListener
Parameters:
marker - the marker moved
oldDate - date before movement
currentDate - new date of the marker

markerDescriptionChanged

public void markerDescriptionChanged(TimeBarMarker marker,
                                     java.lang.String oldValue,
                                     java.lang.String newValue)
Callback method indicating the description of a marker changed.

Specified by:
markerDescriptionChanged in interface TimeBarMarkerListener
Parameters:
marker - the marker of which the description changed
oldValue - previous description
newValue - current description

selectionChanged

public void selectionChanged(TimeBarSelectionModel selectionModel)
The selection did unspecific change. Should be rarely called by the SelectionModel.

Specified by:
selectionChanged in interface TimeBarSelectionListener
Parameters:
selectionModel - the selection model the change took place in

elementAddedToSelection

public void elementAddedToSelection(TimeBarSelectionModel selectionModel,
                                    java.lang.Object element)
An element (either a row or an interval) has been added to the selection.

Specified by:
elementAddedToSelection in interface TimeBarSelectionListener
Parameters:
selectionModel - the selection model that has been changed
element - the interval aded to the selection

elementRemovedFromSelection

public void elementRemovedFromSelection(TimeBarSelectionModel selectionModel,
                                        java.lang.Object element)
An element (either a row or an interval) has been removed from the selection.

Specified by:
elementRemovedFromSelection in interface TimeBarSelectionListener
Parameters:
selectionModel - the selection model that has been changed
element - element that has been removed

modelDataChanged

public void modelDataChanged(TimeBarModel model)
Unspecific or multiple changes occured in the model. Should not be used without the need to signal a huge change of data.

Specified by:
modelDataChanged in interface TimeBarModelListener
Parameters:
model - the model of which the data changed

rowDataChanged

public void rowDataChanged(TimeBarModel model,
                           TimeBarRow row)
Unspecific change in the data of a row.

Specified by:
rowDataChanged in interface TimeBarModelListener
Parameters:
model - the changed model
row - the row of which the data has changed

rowAdded

public void rowAdded(TimeBarModel model,
                     TimeBarRow row)
The model was enlarged by a new row.

Specified by:
rowAdded in interface TimeBarModelListener
Parameters:
model - the changed model
row - the added row

rowRemoved

public void rowRemoved(TimeBarModel model,
                       TimeBarRow row)
The model was reduced by a row.

Specified by:
rowRemoved in interface TimeBarModelListener
Parameters:
model - the changed model
row - the removed row

elementAdded

public void elementAdded(TimeBarModel model,
                         TimeBarRow row,
                         de.jaret.util.date.Interval element)
A new element was added to a row.

Specified by:
elementAdded in interface TimeBarModelListener
Parameters:
model - the changed model
row - the changed row
element - the added element

elementRemoved

public void elementRemoved(TimeBarModel model,
                           TimeBarRow row,
                           de.jaret.util.date.Interval element)
An element was removed from a row.

Specified by:
elementRemoved in interface TimeBarModelListener
Parameters:
model - the changed model
row - the changed row
element - the removed element

elementChanged

public void elementChanged(TimeBarModel model,
                           TimeBarRow row,
                           de.jaret.util.date.Interval element)
An element in a row has changed.

Specified by:
elementChanged in interface TimeBarModelListener
Parameters:
model - the changed model
row - the changed row
element - the element that changed

headerChanged

public void headerChanged(TimeBarModel model,
                          TimeBarRow row,
                          java.lang.Object newHeader)
The header of a row changed.

Specified by:
headerChanged in interface TimeBarModelListener
Parameters:
model - the changed model
row - the changed row
newHeader - the changed header

getFirstRow

public int getFirstRow()
Returns:
Returns the firstRow.

setFirstRow

public void setFirstRow(int firstRow)
Sets the first row to be displayed with a pixel offset 0.

Parameters:
firstRow - The row to be displayed at the topmost position in the viewer.

setFirstRow

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

Parameters:
row - row to be the first row with an offset of 0.

setFirstRow

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

Parameters:
firstRow - upmost row to be displayed
pixOffset - pixel offset

getFirstRowOffset

public int getFirstRowOffset()
Retrieve the pixel offset for the first row.

Returns:
pixel offset of the first row

setFirstRowOffset

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

Parameters:
offset - pixel offset for the first row

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.

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.

Parameters:
row - the row to be displayed at the bottom of the viewer.

getTimeScalePosition

public int getTimeScalePosition()
Returns:
Returns the timeScalePosition.

setTimeScalePosition

public void setTimeScalePosition(int timeScalePosition)
Parameters:
timeScalePosition - The timeScalePosition to set.

getYAxisWidth

public int getYAxisWidth()
Returns:
Returns the yAxisWidth.

setYAxisWidth

public void setYAxisWidth(int axisWidth)
Parameters:
axisWidth - The yAxisWidth to set.

getXAxisHeight

public int getXAxisHeight()
Returns:
Returns the xAxisHeight.

setXAxisHeight

public void setXAxisHeight(int axisHeight)
Set the height of the y axis.

Parameters:
axisHeight - The xAxisHeight to set.

setHierarchyWidth

public void setHierarchyWidth(int width)
Set the width fo rrendering the hierarchy area.

Parameters:
width - width to use

getHierarchyWidth

public int getHierarchyWidth()
Retrieve the width used to draw the hierarchy area.

Returns:
width in pixel

preparePaint

public void preparePaint(int cwidth,
                         int cheight)
Calculate the boundaries of the diagram elements.

Parameters:
cwidth - width of the component client area
cheight - width of the component client area

preparePaintHorizontal

public void preparePaintHorizontal(int cwidth,
                                   int cheight)
Calculate the boundaries of the diagram elements for the horizontal orientation.

Parameters:
cwidth - width of the component client area
cheight - width of the component client area

preparePaintVertical

public void preparePaintVertical(int cwidth,
                                 int cheight)
Calculate the boundaries of the diagram elements for the vertical orientation.

Parameters:
cwidth - width of the component client area
cheight - width of the component client area

getDiagramRect

public java.awt.Rectangle getDiagramRect()
Returns:
Returns the diagramRect.

getXAxisRect

public java.awt.Rectangle getXAxisRect()
Returns:
Returns the xAxisRect.

getYAxisRect

public java.awt.Rectangle getYAxisRect()
Returns:
Returns the yAxisRect.

getHierarchyRect

public java.awt.Rectangle getHierarchyRect()
Returns:
the reactangle to draw the hierchy markers in

getTitleRect

public java.awt.Rectangle getTitleRect()
Retrieve area for drawing a title.

Returns:
title area rectangle

getLastStartDate

public de.jaret.util.date.JaretDate getLastStartDate()
Returns:
Returns the lastStartDate.

setLastStartDate

public void setLastStartDate(de.jaret.util.date.JaretDate lastStartDate)
Parameters:
lastStartDate - The lastStartDate to set.

mousePressed

public void mousePressed(int x,
                         int y,
                         boolean isPopupTrigger,
                         int modifierMask)
Handle press of a mouse button.

Parameters:
x - x coordinate (control)
y - y coordinate (control)
isPopupTrigger - true if the button is the system's popup trigger
modifierMask - modifier mask for keyboard diversification (AWT input event type)

mouseReleased

public void mouseReleased(int x,
                          int y,
                          boolean isPopupTrigger,
                          int modifierMask)
Handle release of mouse button.

Parameters:
x - x coordinate
y - y coordinate
isPopupTrigger - true if the button is the systems popup trigger
modifierMask - modifier mask for keyboard diversification (AWT input event type)

getCtxCoordinate

public java.awt.Point getCtxCoordinate()
Retrieve the location of a context menu popup request.

Returns:
the ccordinate

getCtxRow

public TimeBarRow getCtxRow()
Retrieve the row above that a popup menu request has occurred.

Returns:
the row or null if none could be determined

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.

Returns:
Pair containing the row and date of the click position. Might be null if no click has been recorded.

mouseDragged

public void mouseDragged(int x,
                         int y,
                         int modifierMask)
Handle mouse dragging.

Parameters:
x - new x coordinate
y - new y coordinate
modifierMask - modifiers (awt)

mouseMoved

public void mouseMoved(int x,
                       int y)
Handle simple mouse movements. This mainly means: change he cursor for selective areas.

Parameters:
x - x coordinate
y - y coordinate

rowLineHit

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

Parameters:
x - x coord
y - y coord
Returns:
true if a row line is hit

selectIntervals

public void selectIntervals(java.awt.Rectangle curSelRect)
Ensures that all intervals in the given rectangle are selected. The intervals have to be either complete in the rectangle (complete area) or if the renderer sets the containinng rectangle this rectangle has to be inside the selecting rectangle

Parameters:
curSelRect - selction rectangle

getIntervals

public java.util.List<de.jaret.util.date.Interval> getIntervals(java.awt.Rectangle curSelRect)
Retrieve all intervals inside a selection rectangle.

Parameters:
curSelRect - the marking rectangle.
Returns:
a list of intervals inside the rectangle

getDrawRowGrid

public boolean getDrawRowGrid()
Returns:
Returns the drawRowGrid.

setDrawRowGrid

public void setDrawRowGrid(boolean drawRowGrid)
Parameters:
drawRowGrid - The drawRowGrid to set.

highlightRow

public void highlightRow(int y)
Highlight a row by giving the display y coordinate.

Parameters:
y - y coordinate

highlightRow

public void highlightRow(TimeBarRow row)
Highlight a row.

Parameters:
row - the row to be highlighted

deHighlightRow

public void deHighlightRow()
Dehighlight a highlighted row.


getHighlightedRow

public TimeBarRow getHighlightedRow()
Retrieve the highlighted row if prsent.

Returns:
the highlilghted row or null if no row is highlighted

getDraggedMarker

public TimeBarMarker getDraggedMarker()
Retrieve the marker currently dragged.

Returns:
the currently dragged marker or null if no marker is beeing dragged

getSelectionRect

public java.awt.Rectangle getSelectionRect()
Retrieve the selection rect.

Returns:
the current selection rect if present or null if none is present

setLastSelRect

public void setLastSelRect(java.awt.Rectangle rect)
Set the last selection rectangle.

Parameters:
rect - rectangle

getLastSelRect

public java.awt.Rectangle getLastSelRect()
Retrieve the last selection rectangle.

Returns:
rect last selection rect if any or null

getToolTipText

public java.lang.String getToolTipText(int x,
                                       int y)
Retrieve the tooltip text for a given location.

Parameters:
x - x coordinate in the component
y - y coordinate in the component
Returns:
the tooltip text or null if there is no text

getHeaderRect

public java.awt.Rectangle getHeaderRect(TimeBarRow row)
Calculate the rectangle for drawing the header of a given row.

Parameters:
row - row to calculae the header recct for
Returns:
the rectangle for drawing the the header or null if the header is not visible.

getHierarchyRect

public java.awt.Rectangle getHierarchyRect(TimeBarRow row)
Calculate the rectangle for drawing the hierachy marker of a given row.

Parameters:
row - row to calculate the hierarchy rect for
Returns:
the rectangle for drawing the the hierarchy marker or null if the row is not visible.

toString

public java.lang.String toString()
Produce a simple string representation.

Overrides:
toString in class java.lang.Object
Returns:
simpe string representation

setName

public void setName(java.lang.String name)
Set the name of the viewer/component for display or debugging purposes.

Parameters:
name - name

getName

public java.lang.String getName()
Get the name of the viewer/component.

Returns:
the name or null

setAutoscrollEnabled

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

Parameters:
enableAutoscroll - true for enabling autoscroll

isAutoscrollEnabled

public boolean isAutoscrollEnabled()
Get the autoscroll behaviour.

Returns:
true if autoscroll is enabled.

scrollDateToVisible

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

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.

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.

Parameters:
row - TimeBarRow of the interval
interval - inteval.

isIntervalVisible

public boolean isIntervalVisible(TimeBarRow row,
                                 de.jaret.util.date.Interval interval)
Check whether any part of an interval is visible.

Parameters:
row - row
interval - interval
Returns:
true if any part of the interval is rendered.

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 - inteval.

scrollIntervalToVisible

public void scrollIntervalToVisible(de.jaret.util.date.Interval interval,
                                    double horizontalRatio,
                                    double verticalRatio)
Scroll an interval to specified position (by ration) in the vieable area of the chart. The beginning of the interval will be positioned according to the ratio given.

Parameters:
interval - interval to scroll to
horizontalRatio - horizontal ratio (0 to 1.0 = left to right)
verticalRatio - vertical ratio (0 to 1.0 = top to bottom)

scrollIntervalToVisible

public void scrollIntervalToVisible(TimeBarRow row,
                                    de.jaret.util.date.Interval interval,
                                    double horizontalRatio,
                                    double verticalRatio)
Scroll an interval to specified position (by ration) in the vieable area of the chart. The beginning of the interval will be positioned according to the ratio given.

Parameters:
interval - interval to scroll to
row - row of the interval
horizontalRatio - horizontal ratio (0 to 1.0 = left to right)
verticalRatio - vertical ratio (0 to 1.0 = top to bottom)

addIntervalModificator

public void addIntervalModificator(IntervalModificator intervalModificator)
Add an interval modificator.

Parameters:
intervalModificator - modificator to add

remIntervalModificator

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

Parameters:
intervalModificator - modificator to remove

getTimeBarViewState

public ITimeBarViewState getTimeBarViewState()
Retrieve the timebarviewstate.

Returns:
the timebar viewstate

getHierarchicalViewState

public HierarchicalViewState getHierarchicalViewState()
Retrieve the hierarchical viewstate.

Returns:
the hierarchical viewstate or null if no hierarchical model is used

setHierarchicalViewState

public void setHierarchicalViewState(HierarchicalViewState hvs)
Set the hierarchical viewstate. The hierarchical viewstate will only be used together with a hierarchical model.

Parameters:
hvs - hierachical viewstate to use

setTitle

public void setTitle(java.lang.String title)
Set the title string to be displayed.

Parameters:
title - title to be displayed

getTitle

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

Returns:
the title

isDrawOverlapping

public boolean isDrawOverlapping()
Returns:
true for overlap drawing mode.

setDrawOverlapping

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

Parameters:
drawOverlapping - if set to true all intervals will be painted overlapping each other if they do overlap. False will reduce the space for rendering, stacking the intervals (default).

getMaxOverlapCount

public int getMaxOverlapCount(TimeBarRow row)
Retrieve tha maximal count of overlapping intervals in a row.

Parameters:
row - row to check
Returns:
count of maximum overlapping intervals in the row

filterIntervals

public java.util.List<de.jaret.util.date.Interval> filterIntervals(java.util.List<de.jaret.util.date.Interval> intervals)
Applies the interval filter if set.

Parameters:
intervals - list of intervals to be filtered
Returns:
list of intervals that pass the filter

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

getFocussedInterval

public de.jaret.util.date.Interval getFocussedInterval()
Retrieve the focusef 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

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.

moveFocusRight

public void moveFocusRight()
Move the focus to the right.


moveFocusLeft

public void moveFocusLeft()
Move the focus to the left.


moveFocusUp

public void moveFocusUp()
Move the focus up.


moveFocusDown

public void moveFocusDown()
Move the focus down.


addFocussedIntervalListener

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

Parameters:
listener - listener to be added.

remFocussedIntervalListener

public void remFocussedIntervalListener(FocussedIntervalListener listener)
Remove a focussedIntervalListener.

Parameters:
listener - listener to be removed from the listener list.

fireFocussedIntervalChange

protected void fireFocussedIntervalChange(TimeBarRow newFocussedRow,
                                          de.jaret.util.date.Interval newFocussedInterval)
Inform listeners about a focus change.

Parameters:
newFocussedRow - new (currently focussed row)
newFocussedInterval - new (currently) focussed interval

addSelectionRectListener

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

Parameters:
listener - listener to be added.

remSelectionRectListener

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

Parameters:
listener - listener to be removed from the listener list.

fireSelectionRectChanged

protected void fireSelectionRectChanged()
Inform selection rect listeners about a change of the selection rect.


fireSelectionRectClosed

protected void fireSelectionRectClosed()
Inform selectionRectListeners about the end of the selection rect.


fireRegionRectChanged

protected void fireRegionRectChanged()
Inform selection rect listeners about a change of the region rect.


fireRegionRectClosed

protected void fireRegionRectClosed()
Inform selectionRectListeners about the end of the region rect.


handleKeyPressed

public void handleKeyPressed(int keyCode,
                             int modifierMask)
Handle key events from the time bar viewers.

Parameters:
keyCode - keyCode (Swing)
modifierMask - (Swing)

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

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.

Returns:
true if a varying pps value is used

setVariableXScale

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

Parameters:
state - true if a variable scale should be used.

getPpsRow

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

Returns:
the row or null if no variable xscale has been defined.

getSelectionDelta

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

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.

Parameters:
selectionDelta - max distance for detection

isLineDraggingAllowed

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

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.

Parameters:
lineDraggingAllowed - true for enabling the drag possibility

isMilliAccuracy

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

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.

Parameters:
milliAccuracy - true to use ms accuracy

setDrawingOffset

public void setDrawingOffset(int marginLeft,
                             int marginTop)
Set margins to the left and top to be included in geometry calculations. This is introduced for supporting printing (margins) but might be useful for insets if necessary.

Parameters:
marginLeft - left margin (pixel)
marginTop - top margin (pixel)

getOptimizeScrolling

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

Returns:
true if optimized scrolling is used

setOptimizeScrolling

public void setOptimizeScrolling(boolean optimizeScrolling)
Set whether optimized scrolling should be used (not allowed togeter with a variable xscale).

Parameters:
optimizeScrolling - true for optimized scrolling

getOrientation

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

Returns:
the orientation of the viewer

setOrientation

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

Parameters:
orientation - the new orientation for the viewer

getAutoScaleRows

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

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.

Parameters:
rows - the number of rows or -1 for no special scaling (default)

addTimeBarChangeListener

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

Parameters:
listener - listener

removeTimeBarChangeListener

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

Parameters:
listener - listener to remove

fireIntervalChangeStarted

protected void fireIntervalChangeStarted(TimeBarRow row,
                                         de.jaret.util.date.Interval interval)
Inform time bar change listeners about a beginning interval change.

Parameters:
row - row involved
interval - interval to be changed

fireIntervalIntermediateChange

protected void fireIntervalIntermediateChange(TimeBarRow row,
                                              de.jaret.util.date.Interval interval,
                                              de.jaret.util.date.JaretDate oldBegin,
                                              de.jaret.util.date.JaretDate oldEnd)
Inform time bar change listeners about an intermediate interval change.

Parameters:
row - row involved
interval - interval changing
oldBegin - begin when then change started
oldEnd - end when the change started

fireIntervalChanged

protected void fireIntervalChanged(TimeBarRow row,
                                   de.jaret.util.date.Interval interval,
                                   de.jaret.util.date.JaretDate oldBegin,
                                   de.jaret.util.date.JaretDate oldEnd)
Inform time bar change listeners about a finished interval change.

Parameters:
row - row involved
interval - interval that has been changed
oldBegin - begin when then change started
oldEnd - end when the change started

fireIntervalChangeCancelled

protected void fireIntervalChangeCancelled(TimeBarRow row,
                                           de.jaret.util.date.Interval interval)
Inform time bar change listeners about a cancelled interval change.

Parameters:
row - row involved
interval - interval that's change has been cancelled

fireMarkerDragStarted

protected void fireMarkerDragStarted(TimeBarMarker marker)
Informa listener about a started marker drag.

Parameters:
marker - marker that is beeing dragged

fireMarkerDragStopped

protected void fireMarkerDragStopped(TimeBarMarker marker)
Inform listeners about stopping of a marker drag.

Parameters:
marker - marker that has been dragged

isRowHeightDraggingAllowed

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

Returns:
true if row height dragging is enabled

setRowHeightDraggingAllowed

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

Parameters:
rowHeightDraggingAllowed - true for allowance

isInRowAxis

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

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.

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 setStrictClipTimeCheck(boolean)).

Returns:
true if strict checking is enabled

setStrictClipTimeCheck

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

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.

getScrollLookBackMinutes

public int getScrollLookBackMinutes()
Retrieve the time to be additionally considered (looking back) when deciding which intervals are to be painted.

Returns:
time in mnutes

setScrollLookBackMinutes

public void setScrollLookBackMinutes(int scrollLookBackMinutes)
Set the additional time to be considered when deciding whether to draw an interval looking back.

Parameters:
scrollLookBackMinutes - time in minutes

getScrollLookForwardMinutes

public int getScrollLookForwardMinutes()
Retrieve the time to be additionally considered (looking forward) when deciding which intervals are to be painted.

Returns:
time in mnutes

setScrollLookForwardMinutes

public void setScrollLookForwardMinutes(int scrollLookForwardMinutes)
Set the additional time to be considered when deciding whether to draw an interval looking forward.

Parameters:
scrollLookForwardMinutes - time in minutes

getOverlapStrategy

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

Returns:
the overlap strategy

setOverlapStrategy

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

Parameters:
overlapStrategy - the strytegy to be used. May not be null.

getAutoscrollDelta

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

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.

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.

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.

Parameters:
dragAllSelectedIntervals - true to drag all selcted intervals

getScrollOnFocus

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

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.

Parameters:
scrollOnFocus - true for scrolling to the focussed interval

getHideRoot

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

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.

Parameters:
hideRoot - true if the root node should be hidden

getMarkerDraggingInDiagramArea

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

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).

Parameters:
allowed - true for allowing marker drag in the diagram area.

isMarkerDraggingInProgress

public boolean isMarkerDraggingInProgress()
Check whether a marker is beeing dragged.

Returns:
true if a marker drag is in progress

getIntervalSelectionStrategy

public IIntervalSelectionStrategy getIntervalSelectionStrategy()
Retrieve the interval selection strategy used.

Returns:
the strategy

setIntervalSelectionStrategy

public void setIntervalSelectionStrategy(IIntervalSelectionStrategy intervalSelectionStrategy)
Set the interval selection strategy.

Parameters:
intervalSelectionStrategy - the interval selection strategy to use.

calcRect

public java.awt.Rectangle calcRect(TBRect tbrect)
Calculate the rectangle for screen representation for a tbrect (time and rows).

Parameters:
tbrect - tbrect to be painted
Returns:
rectangle in screen coordinates

getRegionRect

public TBRect getRegionRect()
Retrieve the selected region.

Returns:
the selected region or null

clearRegionRect

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


setRegionRectEnable

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

Parameters:
enabled - true enabling

getRegionRectEnable

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

Returns:
true if region selections are enabled

setUseUniformHeight

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

Parameters:
useUniformHeight - true for uniform heights/widths

getUseUniformHeight

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

Returns:
true if all intervals in a non overlapping drawn row should use the same height/width

componentResized

public void componentResized()
Handle a component resize and scroll down if an empty space would be shown in the newly exposed screen estate.



Copyright © 2012. All Rights Reserved.