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

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by de.jaret.util.ui.timebars.swing.TimeBarViewer
All Implemented Interfaces:
TimeBarViewerInterface, java.awt.event.ComponentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener

public class TimeBarViewer
extends javax.swing.JPanel
implements TimeBarViewerInterface, javax.swing.event.ChangeListener, java.awt.event.ComponentListener

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

NOTE: The Swing version is not as complete as the swt version!

The implementation depends on the TimeBarViewerDelegate for the operations and calculations that is shared between the Swing and the SWT implementation of the viewer. The delegate is accesible via the method getDelegate(). It supplies additional functionality not delegated by methods in this class (will be done in future releases).

Version:
$Id: TimeBarViewer.java 1107 2012-02-09 22:31:29Z kliem $
Author:
Peter Kliem
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
TimeBarViewerInterface.Orientation
 
Field Summary
protected  javax.swing.JPopupMenu _bodyContextMenu
          context menu for the body of the viewer.
protected  TimeBarViewerDelegate _delegate
          The delegate is the heart of the joined implementation between Swing and SWT version of the viewer.
 de.jaret.util.ui.timebars.swing.TimeBarViewer.Diagram _diagram
          the diagram pane itself.
protected  TimeBarGapRenderer _gapRenderer
          gap renderer.
protected  java.util.List<? extends de.jaret.util.date.Interval> _ghostIntervals
          list of ghost intervals to be painted.
protected  java.util.List<java.lang.Integer> _ghostIntervalYCoordinates
          y offsets for the ghost intervals.
protected  java.awt.Point _ghostOrigin
          the origin for painting the ghost intervals/rows.
protected  java.util.List<TimeBarRow> _ghostRows
          list of ghost rows to paint.
protected  java.util.List<java.lang.Integer> _ghostRowYCoordinates
          y offsets for the ghost rows.
protected  IGlobalAssistantRenderer _globalAssistantRenderer
          gloab assistant renderer.
protected  GridRenderer _gridRenderer
          renderer used for rendering the grid/background.
protected  javax.swing.JComponent _gridRendererComponent
          used to cache the grid renderer component.
protected  javax.swing.JPopupMenu _headerContextMenu
          context menu for the header.
protected  HeaderRenderer _headerRenderer
          renderer for the row headers.
protected  javax.swing.JPopupMenu _hierarchyContextMenu
          context menu for the hierarchy area.
protected  HierarchyRenderer _hierarchyRenderer
          renderer for the hierarchy section.
protected  javax.swing.JPanel _horizontalScrollPanel
          panel the horizontal scrollbar is placed on.
protected  IMarkerRenderer _markerRenderer
          marker renderer.
protected  IMiscRenderer _miscRenderer
          Renderer for various elements.
protected  java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,javax.swing.JPopupMenu> _registeredPopupMenues
          map of registered popup menus for intervals.
protected  IRelationRenderer _relationRenderer
          Relation render.
protected  java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> _rendererMap
          mapping between interval classes and renderers.
protected  boolean _requiresPopupTriggerCheck
          flag indicating popupTrigger is not set for MouseReleased event.
protected  javax.swing.JPopupMenu _timeScaleContextMenu
          context menu for the time scale.
protected  TimeScaleRenderer _timeScaleRenderer
          renderer used for the stimescale.
protected  javax.swing.JComponent _timeScaleRendererComponent
          used to cache the time scale component for static use (tooltips).
protected  javax.swing.JPopupMenu _titleContextMenu
          context menu for the title area.
protected  ITitleRenderer _titleRenderer
          Renderer used to render the title area. null indicates no renderer.
protected  boolean _useTitleRendererComponentInPlace
           
protected  javax.swing.JPanel _verticalScrollPanel
          panel the vertical scrollbar is placed on.
protected  javax.swing.JScrollBar _xScrollBar
          horizontal scrollbar if existing.
protected  javax.swing.JScrollBar _yScrollBar
          vertical scrollbar if existing.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
DEFAULT_ROWHEIGHT, DEFAULT_XAXISHEIGHT, DEFAULT_YAXISWIDTH, PROPERTYNAME_FIRSTROW, PROPERTYNAME_FIRSTROWOFFSET, PROPERTYNAME_INTERVALFILTER, PROPERTYNAME_MAXDATE, PROPERTYNAME_MINDATE, PROPERTYNAME_PIXELPERSECOND, PROPERTYNAME_ROWFILTER, PROPERTYNAME_ROWHEIGHT, PROPERTYNAME_ROWHEIGHTDRAGGINGALLOWED, PROPERTYNAME_ROWSORTER, PROPERTYNAME_STARTDATE, PROPERTYNAME_XAXISHEIGHT, PROPERTYNAME_YAXISWIDTH, TIMESCALE_POSITION_BOTTOM, TIMESCALE_POSITION_NONE, TIMESCALE_POSITION_TOP
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TimeBarViewer()
          Constructs a timebarviewer without a model.
TimeBarViewer(TimeBarModel model)
          Constructs a timebarviewer with both y and x scrollbars.
TimeBarViewer(TimeBarModel model, boolean suppressXScroll, boolean suppressYScroll)
          Constructs a timebar viewer.
 
Method Summary
 void addFocussedIntervalListener(FocussedIntervalListener listener)
          Add a listener to be informed when the focus inside the viewer changes.
 void addIntervalModificator(IntervalModificator intervalModificator)
          Add an intervalModificator controlling changes on the intervals.
 void addMarker(TimeBarMarker marker)
          Add a timebar marker.
 void addMarkers(java.util.List<TimeBarMarker> markers)
          Directly set a list of markers.
 void addMouseListener(java.awt.event.MouseListener l)
          
 void addSelectionRectListener(ISelectionRectListener listener)
          Add a listener to be informed when the selection rect changes.
 void addTimeBarChangeListener(ITimeBarChangeListener listener)
          Add a listener to be informaed about interval changes.
 void clearRegionRect()
          Remove the selction of a region if existent.
 void componentHidden(java.awt.event.ComponentEvent e)
          
 void componentMoved(java.awt.event.ComponentEvent e)
          
 void componentResized(java.awt.event.ComponentEvent e)
          
 void componentShown(java.awt.event.ComponentEvent e)
          
 de.jaret.util.date.JaretDate dateForX(int x)
          Get the corresponding date for an x coordinate in the viewer area.
 de.jaret.util.date.JaretDate dateForXY(int x, int y)
          Get the corresponding date for a point in the viewer area.
 void deHighlightRow()
          
 void displayBodyContextMenu(int x, int y)
          Display the context menu for the normal viewer body.
 void displayHeaderContextMenu(TimeBarRow row, int x, int y)
          Display the header context menu.
 void displayHierarchyContextMenu(TimeBarRow row, int x, int y)
          Display the hierarchy area context menu.
 void displayIntervalContextMenu(de.jaret.util.date.Interval interval, int x, int y)
          Display the context menu for an interval.
 void displayTimeScaleContextMenu(int x, int y)
          Display the context menu for the time scale.
 void displayTitleContextMenu(int x, int y)
          Display the title area context menu.
 void doScrollHorizontal(int diff)
          Do horizontal scrolling by diff pixel.
 void doScrollVertical(int diff)
          Do vertical scrolling by diff pixel.
 void firePropertyChangeX(java.lang.String propName, java.lang.Object oldVal, java.lang.Object newVal)
          Fire a property change.
 void fireSelectionChanged()
          Called by the delegate whenever the selection changed (to support selction provider under SWT).
 boolean getAdjustMinMaxDatesByModel()
          Retrieve the adjustment policy for min and max date.
 int getAutoScaleRows()
          Get the number of rows (columns) that the viewer scales itself to.
 int getAutoscrollDelta()
          Retrieve the currently set autoscroll delta.
 javax.swing.JPopupMenu getBodyContextMenu()
          Retrieve the context menu set for the body.
 TimeBarViewerDelegate getDelegate()
          Retrieve the delegate ATTENTION: the delegate is for mostly internal usage only.
 boolean getDragAllSelectedIntervals()
          If true all selected intervals will be dragged together with the interval on that the drag happened.
 boolean getDrawOverlapping()
          Retrieve the drawing mode.
 boolean getDrawRowGrid()
          Retrieve the status of row grid drawing.
 de.jaret.util.date.JaretDate getEndDate()
          
 int getFirstRowDisplayed()
          Retrieve the index of the first row that is displayed.
 int getFirstRowOffset()
          Retrieve the pixeloffset for the first row.
 TimeBarGapRenderer getGapRenderer()
           
 IGlobalAssistantRenderer getGlobalAssistantRenderer()
          Get the current global assistant renderer.
 GridRenderer getGridRenderer()
           
 javax.swing.JPopupMenu getHeaderContextMenu()
          Retrieve the context menu set for the header.
 java.lang.String getHeaderToolTipText(TimeBarRow row, int x, int y)
          Retrieve the tooltip for a position on a row.
 boolean getHideRoot()
          Retrieve whether the root node is shown when using a hierachical model.
 HierarchicalTimeBarModel getHierarchicalModel()
          Retrieve the hierarchical model of the viewer.
 HierarchicalViewState getHierarchicalViewState()
          Retrieve the hierarchical viewstate used by the viewer.
 javax.swing.JPopupMenu getHierarchyContextMenu()
          Retrieve the context menu set for the hierrarchy.
 java.lang.String getHierarchyToolTipText(TimeBarNode node, int x, int y)
          Retrieve the tooltip for a position in the hierarchy.
 int getHierarchyWidth()
          Retrieve the width of the hierarchy area.
 javax.swing.JPanel getHorizontalScrollPanel()
          Retrieve the panel that the horizontal scroll bar is plcaed on (BorderLayout, CENETER).
protected  javax.swing.JComponent getIntervalComponent(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect)
          Retrieve the JComponent for a given row and interval.
protected  javax.swing.JComponent getIntervalComponent(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, boolean overlapping)
          Retrieve the JComponent for an interval.
protected  javax.swing.JComponent getIntervalComponent(TimeBarRow row, de.jaret.util.date.Interval interval)
          Retrieve the JComponent for a given row and interval.
 java.lang.String getIntervalToolTipText(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, int x, int y)
          Get the tooltip text for a given location in a rendered interval.
 boolean getMarkerDraggingInDiagramArea()
          Retrieve whether marker dragging in the diagram area is activated.
 IMarkerRenderer getMarkerRenderer()
          Retrieve the configured marker renderer.
 java.util.List<TimeBarMarker> getMarkers()
          Retrieve the list of al markers.
 int getMarkerWidth(TimeBarMarker marker)
          Get the width for marker painting (as requested by a marker renderer).
 de.jaret.util.date.JaretDate getMaxDate()
          Retrieve the maximum date that can be displayed.
 de.jaret.util.date.JaretDate getMinDate()
          Retrieve the minimum value present in the data of the viewer.
 IMiscRenderer getMiscRenderer()
          Get the current misc renderer.
 TimeBarModel getModel()
          Retrieve the flat model used by the viewer.
 java.lang.String getName()
          Retrieve the name set on the viewer.
 boolean getOptimizeScrolling()
          Get whether optimzed scrollnig is used.
 IOverlapStrategy getOverlapStrategy()
          Retrieve the used strategy for determing overlap information.
 double getPixelPerSecond()
          Return the pixel per second ratio.
 de.jaret.util.misc.Pair<TimeBarRow,de.jaret.util.date.JaretDate> getPopUpInformation()
          Retrieve the row and date of the click leading to the activation of a context menu.
 javax.swing.JPopupMenu getPopupMenu(java.lang.Class<? extends de.jaret.util.date.Interval> clazz)
          Retrieve the popup menu registered for a given interval class.
 TimeBarNode getPpsRow()
          Retrieve the row that hold intervals (PpsIntervals) defining the pps value for different intervals.
 TBRect getRegionRect()
          Retrieve the selected region.
 boolean getRegionRectEnable()
          Retrieve whether region selections are enabled.
 IRelationRenderer getRelationRenderer()
          Retrieve the relation renderer currently set.
 java.util.List<IIntervalRelation> getRelationsForCoord(int x, int y)
          Retrieve the list of relations hit for a coordinate.
 java.lang.String getRelationTooltip(int x, int y)
          Provide the tooltip for a relation if any.
protected  TimeBarRenderer getRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> clazz)
          Retrieve a renderer for a given class.
 java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,TimeBarRenderer> getRendererMapping()
          Retrieve the complete renderer map.
 TimeBarRowFilter getRowFilter()
          
 TimeBarRow getRowForXY(int x, int y)
          Retrieve the row for a given point.
 TimeBarRow getRowForY(int y)
          Retrieve the row for a given y coodinate (x if oriented vertcal; use getRowForXY instead!).
 int getRowHeight()
          Retrieve the current row height or the default row height if variable row heights/widths are enabled.
 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()
          Get the selection model of the viewer.
 de.jaret.util.date.JaretDate getStartDate()
          Retrive the current start date of the displayed time span.
 boolean getStrictClipTimeCheck()
          Retrieve the strategy for filtering when painting (see TimeBarViewerInterface.setStrictClipTimeCheck(boolean)).
 TimeBarViewerInterface.Orientation getTBOrientation()
          Retrieve the orientation of the viewer.
 TimeBarRenderer getTimeBarRenderer()
          Retrieve the default renderer currently used for rendering intervals (regsitered for Interval.class).
 ITimeBarViewState getTimeBarViewState()
          Retrieve the statndard viewstate of the viewer containing the row heights/column widths.
 javax.swing.JPopupMenu getTimeScaleContextMenu()
          Retrieve the context menu set for the time scale.
 TimeScaleRenderer getTimeScaleRenderer()
           
 java.lang.String getTimeScaleToolTipText(int x, int y)
          Retrieve the tooltip for a position on the timescale.
 java.lang.String getTitle()
          Retrieve the title.
 javax.swing.JPopupMenu getTitleContextMenu()
          Retrieve the context menu set for the title area.
 ITitleRenderer getTitleRenderer()
          Retrieve the renderer that is currently used to render the title area.
 boolean getUseUniformHeight()
          Retrieve whether uniform height is use for all intervals in a row.
 javax.swing.JPanel getVerticalScrollPanel()
          Retrieve the panel that the vertical scroll bar is plcaed on (BorderLayout, CENETER).
 int getXAxisHeight()
          Retrieve the height (or width when orientation is vertical) of the timescale.
 javax.swing.JScrollBar getXScrollBar()
          Retrieve the x scroll bar.
 int getYAxisWidth()
          Retrieve the width of the y axis (header area).
 int getYForRow(TimeBarRow row)
          Retrieve the y coordinate in the diagram pane for the given row.
 javax.swing.JScrollBar getYScrollBar()
          Retrieve the y scroll bar.
 boolean hasVariableXScale()
          Retrieve the state of the variable xscale state.
 void highlightRow(int y)
          
 void highlightRow(TimeBarRow timeBarRow)
          
 boolean isAutoscrollEnabled()
          Get the autoscroll behaviour.
 boolean isDisplayed(de.jaret.util.date.JaretDate date)
          Check whether a date is currently visible.
 boolean isInDiagram(int x, int y)
          Check whether a given point is in the main diagram area.
 boolean isInHierarchySelectionArea(TimeBarNode node, int x, int y)
          Check whether the given position is in the selection area of the hierarchy.
 boolean isInRowAxis(int x, int y)
          Check whether a given point is in the row axis area (hierarchy or header).
 boolean isInToggleArea(TimeBarNode node, int x, int y)
          Check whether the given position should toggle expanded state of a node.
 boolean isLineDraggingAllowed()
          Check whether it is allowed to drag the limiting lines of the hierarchy ara and the header (yaxis) area.
 boolean isMilliAccuracy()
          Check whether th delegate is setup for millisecond accuracy.
 boolean isRowHeightDragginAllowed()
          Check whether row height dragging is allowed.
 void registerPopupMenu(java.lang.Class<? extends de.jaret.util.date.Interval> clazz, javax.swing.JPopupMenu popup)
          Register a popup menu for a given interval class.
 void registerTimeBarRenderer(java.lang.Class<? extends de.jaret.util.date.Interval> intervalClass, TimeBarRenderer renderer)
          Register a renderer for an interval class or interface.
 void remFocussedIntervalListener(FocussedIntervalListener listener)
          Remove a focussedIntervalListener.
 void remIntervalModificator(IntervalModificator intervalModificator)
          Remove an interval modificator.
 void remMarker(TimeBarMarker marker)
          Remove a timebar marker.
 void removeTimeBarChangeListener(ITimeBarChangeListener listener)
          Remove a timebar change listener.
 void remSelectionRectListener(ISelectionRectListener listener)
          Remove a selection rect listener.
 void repaint(java.awt.Rectangle r)
          Mark area to be repainted.
 TimeBarRow rowForY(int y)
          
 boolean rowLineHit(int x, int y)
          Check whether a row delimiter line is hit by a coordinate.
 int scrollDateToVisible(de.jaret.util.date.JaretDate date)
          Scroll a date into the visible area of the viewer.
 void scrollIntervalToVisible(TimeBarRow row, de.jaret.util.date.Interval interval)
          Make sure the specified interval is in the visibe area of the viewer.
 void scrollRowToVisible(TimeBarRow row)
          Make sure the specified row is visible.
 void setAdjustMinMaxDatesByModel(boolean adjust)
          Set the adjustment policy.
 void setAutoScaleRows(int rows)
          Set a number of rows (columns) to be displayed by the viewer.
 void setAutoscrollDelta(int autoscrollDelta)
          Set the autoscroll delta.
 void setAutoscrollEnabled(boolean enableAutoscroll)
          Set the autoscroll behaviour.
 void setBodyContextMenu(javax.swing.JPopupMenu bodyContextMenu)
          Set the context menu to be used for the body area.
 void setCursor(int cursorType)
          Set the cursor type.
 void setDragAllSelectedIntervals(boolean dragAllSelectedIntervals)
          If set to true all selected intervals are dragged when an interval is dragged.
 void setDrawOverlapping(boolean drawOverlapping)
          Set the drawing mode.
 void setDrawRowGrid(boolean drawRowGrid)
          Set the row grid drawing status.
 void setFirstRow(int firstRow, int pixOffset)
          Set the first row to be displayed.
 void setFirstRowDisplayed(int rowIdx)
          Set the first row to be displayed.
 void setFirstRowDisplayed(TimeBarRow row)
          Set the the first row to be displayed.
 void setFirstRowOffset(int offset)
          Set the pixeloffset of the first row.
 void setGapRenderer(TimeBarGapRenderer gapRenderer)
           
 void setGhostIntervals(java.util.List<? extends de.jaret.util.date.Interval> intervals, java.util.List<java.lang.Integer> yCoordinates)
          Set the list of ghost intervals to be drawn.
 void setGhostOrigin(int x, int y)
          Set the origin (current drag position) to shift the ghost elements.
 void setGlobalAssistantRenderer(IGlobalAssistantRenderer globalAssistantRenderer)
          Set a gloabl assistant renederer.
 void setGridRenderer(GridRenderer gridRenderer)
           
 void setHeaderContextMenu(javax.swing.JPopupMenu headerContextMenu)
          Set the context menu to be used for the header area.
 void setHeaderRenderer(HeaderRenderer renderer)
          Set the renderer to be used for rendering the row headers.
 void setHideRoot(boolean hideRoot)
          Set whether the root node should be shown when using a hierachical model.
 void setHierarchicalViewState(HierarchicalViewState hierarchicalViewState)
          Set the hierarchical viewstate to be used.
 void setHierarchyContextMenu(javax.swing.JPopupMenu hierarchyContextMenu)
          Set the context menu to be used for the hierarchy area.
 void setHierarchyRenderer(HierarchyRenderer renderer)
          Set the renderer to be used for rendering the hierarchy area.
 void setHierarchyWidth(int width)
          Set the width of the hierarchy area of the viewer.
 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)
          
 void setLastRow(int index)
          Set the last row in the viewer.
 void setLastRow(TimeBarRow row)
          Set the last row in the viewer.
 void setLineDraggingAllowed(boolean lineDraggingAllowed)
          Set the allowance for line dragging of the limiting lines for hierarchy and header(yaxis) areas.
 void setMarkerDraggingInDiagramArea(boolean allowed)
          Set whether marker dragging is allowed in the diagram area (If intervals are modificable the marker will only be grabbed when no other operation is applicable).
 void setMarkerRenderer(IMarkerRenderer markerRenderer)
          Set the marker renderer to be used.
 void setMaxDate(de.jaret.util.date.JaretDate maxDate)
          Set the maximum date to be displayed.
 void setMilliAccuracy(boolean milliAccuracy)
          Set the delegates status concerning millisecond accuracy.
 void setMinDate(de.jaret.util.date.JaretDate minDate)
          Set the minimum date to be displayed.
 void setMiscRenderer(IMiscRenderer miscRenderer)
          Set the misc renderer to be used for rendering some parts/elements in the viewer.
 void setModel(HierarchicalTimeBarModel hModel)
          Set a hierarchical model to be displayed.
 void setModel(TimeBarModel model)
          Set the flat model to be displayed.
 void setName(java.lang.String name)
          Set a name as a simple string property for internal application use.
 void setOptimizeScrolling(boolean optimizeScrolling)
          Set whether optimized scrolling should be used.
 void setOverlapStrategy(IOverlapStrategy overlapStrategy)
          Set the strategy to be used for calculating overlap information.
 void setPixelPerSecond(double pixelPerSecond)
          Sets the scale of the x axis as pixel per second, thus a value of 1000.0 / (24.0 * 60 * 60) will result in displaying one day over 1000 pixel.
 void setRegionRectEnable(boolean enabled)
          Enable/Disable region selections.
 void setRelationRenderer(IRelationRenderer relationRenderer)
          Set the relation renderer to use.
 void setRowFilter(TimeBarRowFilter rowFilter)
          
 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)
          
 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)
          Set the selectionmodel to be used by the viewer.
 void setStartDate(de.jaret.util.date.JaretDate startDate)
          Set the start date of the display.
 void setStrictClipTimeCheck(boolean strictClipTimeCheck)
          Set the optimization strategy for interval filtering when painting.
 void setTBOrientation(TimeBarViewerInterface.Orientation orientation)
          Set the orientation of the viewer.
 void setTimeBarRenderer(TimeBarRenderer renderer)
          Set the default renderer to be used for rendering the timebars.
 void setTimeScaleContextMenu(javax.swing.JPopupMenu timeScaleContextMenu)
          Set the context menu to be used for the time scale area.
 void setTimeScalePosition(int timeScalePosition)
          
 void setTimeScaleRenderer(TimeScaleRenderer timeScaleRenderer)
          Set a renderer for the x axis.
 void setTitle(java.lang.String title)
          Set a title for the viewer to be displayed.
 void setTitleContextMenu(javax.swing.JPopupMenu titleContextMenu)
          Set the context menu to be used for the titel area.
 void setTitleRenderer(ITitleRenderer titleRenderer)
          Set the title renderer.
 void setUseTitleRendererComponentInPlace(boolean useTitleRendererComponentInPlace)
          If set to true this will cause the title renderer component to be used directly instead of beeing just used to paint.
 void setUseUniformHeight(boolean useUniformHeight)
          Set whether all intervals in a non overlapping drawn row should use the same height/width.
 void setVariableXScale(boolean state)
          Set the state for the variable xscale.
 void setXAxisHeight(int height)
          Set the height (or width) of the timescale.
 void setYAxisWidth(int width)
          Set the width of the y axis (the header area).
 void stateChanged(javax.swing.event.ChangeEvent e)
          Invoked when one of the scrollbars was moved.
 java.awt.Rectangle timeBarContainingRect(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, boolean overlapping)
          Calculate/get the containing rectangle of a rendered interval.
 boolean timeBarContains(de.jaret.util.date.Interval interval, java.awt.Rectangle intervalRect, int x, int y, boolean overlapping)
          Check whether a location is contained in a rendered interval.
 void updateXScrollBar(int max, int pos, int secondsDisplayed)
          Update the x scrollbar.
 void updateYScrollBar(int max, int pos, int rowsDisplayed)
          Update the y scrollbar.
 int xForDate(de.jaret.util.date.JaretDate date)
          Get the corresponding x coordinate in the viewer area for a given date.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.jaret.util.ui.timebars.TimeBarViewerInterface
addPropertyChangeListener, firePropertyChange, getHeight, getToolTipText, getWidth, removePropertyChangeListener, repaint, repaint
 

Field Detail

_delegate

protected TimeBarViewerDelegate _delegate
The delegate is the heart of the joined implementation between Swing and SWT version of the viewer.


_timeScaleRenderer

protected transient TimeScaleRenderer _timeScaleRenderer
renderer used for the stimescale.


_timeScaleRendererComponent

protected javax.swing.JComponent _timeScaleRendererComponent
used to cache the time scale component for static use (tooltips).


_gridRenderer

protected transient GridRenderer _gridRenderer
renderer used for rendering the grid/background.


_gridRendererComponent

protected javax.swing.JComponent _gridRendererComponent
used to cache the grid renderer component.


_gapRenderer

protected TimeBarGapRenderer _gapRenderer
gap renderer.


_headerRenderer

protected HeaderRenderer _headerRenderer
renderer for the row headers.


_hierarchyRenderer

protected HierarchyRenderer _hierarchyRenderer
renderer for the hierarchy section.


_miscRenderer

protected transient IMiscRenderer _miscRenderer
Renderer for various elements.


_titleRenderer

protected transient ITitleRenderer _titleRenderer
Renderer used to render the title area. null indicates no renderer.


_relationRenderer

protected transient IRelationRenderer _relationRenderer
Relation render.


_markerRenderer

protected transient IMarkerRenderer _markerRenderer
marker renderer.


_globalAssistantRenderer

protected transient IGlobalAssistantRenderer _globalAssistantRenderer
gloab assistant renderer.


_xScrollBar

protected javax.swing.JScrollBar _xScrollBar
horizontal scrollbar if existing.


_yScrollBar

protected javax.swing.JScrollBar _yScrollBar
vertical scrollbar if existing.


_diagram

public de.jaret.util.ui.timebars.swing.TimeBarViewer.Diagram _diagram
the diagram pane itself.


_rendererMap

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


_registeredPopupMenues

protected java.util.Map<java.lang.Class<? extends de.jaret.util.date.Interval>,javax.swing.JPopupMenu> _registeredPopupMenues
map of registered popup menus for intervals.


_bodyContextMenu

protected javax.swing.JPopupMenu _bodyContextMenu
context menu for the body of the viewer.


_timeScaleContextMenu

protected javax.swing.JPopupMenu _timeScaleContextMenu
context menu for the time scale.


_headerContextMenu

protected javax.swing.JPopupMenu _headerContextMenu
context menu for the header.


_hierarchyContextMenu

protected javax.swing.JPopupMenu _hierarchyContextMenu
context menu for the hierarchy area.


_titleContextMenu

protected javax.swing.JPopupMenu _titleContextMenu
context menu for the title area.


_requiresPopupTriggerCheck

protected boolean _requiresPopupTriggerCheck
flag indicating popupTrigger is not set for MouseReleased event.


_horizontalScrollPanel

protected javax.swing.JPanel _horizontalScrollPanel
panel the horizontal scrollbar is placed on.


_verticalScrollPanel

protected javax.swing.JPanel _verticalScrollPanel
panel the vertical scrollbar is placed on.


_useTitleRendererComponentInPlace

protected boolean _useTitleRendererComponentInPlace

_ghostIntervals

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


_ghostIntervalYCoordinates

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


_ghostOrigin

protected java.awt.Point _ghostOrigin
the origin for painting the ghost intervals/rows. The ghosted elements will paintetd relative to the y coordinate.


_ghostRows

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


_ghostRowYCoordinates

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

Constructor Detail

TimeBarViewer

public TimeBarViewer(TimeBarModel model,
                     boolean suppressXScroll,
                     boolean suppressYScroll)
Constructs a timebar viewer.

Parameters:
model - TimeBarModel to be used. The model may be null.
suppressXScroll - if true the x scrollbar will not be displayed
suppressYScroll - if true the y scrollbar will not be displayed

TimeBarViewer

public TimeBarViewer(TimeBarModel model)
Constructs a timebarviewer with both y and x scrollbars.

Parameters:
model - timebarmodel to be displayed. The model may be null.

TimeBarViewer

public TimeBarViewer()
Constructs a timebarviewer without a model.

Method Detail

getXScrollBar

public javax.swing.JScrollBar getXScrollBar()
Retrieve the x scroll bar.

Returns:
the x scroll bar or null if the scroll bar has been suppressed

getYScrollBar

public javax.swing.JScrollBar getYScrollBar()
Retrieve the y scroll bar.

Returns:
the y scroll bar or null if the scroll bar has been suppressed

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)

Overrides:
addMouseListener in class java.awt.Component

setModel

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

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

getModel

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

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

setRowFilter

public void setRowFilter(TimeBarRowFilter rowFilter)


getRowFilter

public TimeBarRowFilter getRowFilter()


setRowSorter

public void setRowSorter(TimeBarRowSorter rowSorter)


getRowSorter

public TimeBarRowSorter getRowSorter()


setIntervalFilter

public void setIntervalFilter(TimeBarIntervalFilter intervalFilter)


setTimeBarRenderer

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

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

getTimeBarRenderer

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

Returns:
the renderer

registerTimeBarRenderer

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

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

getRendererMapping

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

Returns:
the renderer map

getRenderer

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

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

setHeaderRenderer

public void setHeaderRenderer(HeaderRenderer renderer)
Set the renderer to be used for rendering the row headers.

Parameters:
renderer - HeaderRenderer to be used or null indicating headers should not be rendered

setHierarchyRenderer

public void setHierarchyRenderer(HierarchyRenderer renderer)
Set the renderer to be used for rendering the hierarchy area.

Parameters:
renderer - HierarchyRenderer to be used or null indicating headers should not be rendered

setPixelPerSecond

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

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

getPixelPerSecond

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

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

setRowHeight

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

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

getRowHeight

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

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

updateXScrollBar

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

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

updateYScrollBar

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

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

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Invoked when one of the scrollbars was moved.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - event
See Also:
ChangeListener.stateChanged(javax.swing.event.ChangeEvent)

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)

Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)

Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)

Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)

Specified by:
componentShown in interface java.awt.event.ComponentListener

getIntervalComponent

protected javax.swing.JComponent getIntervalComponent(TimeBarRow row,
                                                      de.jaret.util.date.Interval interval)
Retrieve the JComponent for a given row and interval.

Parameters:
row - row
interval - interval
Returns:
JComponent set up for rendering or other tasks (bounds are set)

getIntervalComponent

protected javax.swing.JComponent getIntervalComponent(de.jaret.util.date.Interval interval,
                                                      java.awt.Rectangle intervalRect)
Retrieve the JComponent for a given row and interval.

Parameters:
interval - interval
intervalRect - rectangle denoting the area of the interval
Returns:
JComponent set up for rendering or other tasks (bounds are set)

getIntervalComponent

protected javax.swing.JComponent getIntervalComponent(de.jaret.util.date.Interval interval,
                                                      java.awt.Rectangle intervalRect,
                                                      boolean overlapping)
Retrieve the JComponent for an interval.

Parameters:
interval - the interval
intervalRect - rectangle marking the drawing bounds
overlapping - if the interval is overlapping
Returns:
the configured JComponent

getTimeScaleRenderer

public TimeScaleRenderer getTimeScaleRenderer()
Returns:
Returns the timeScaleRenderer.

setTimeScaleRenderer

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

Parameters:
timeScaleRenderer - The timeScaleRenderer to set.

getMiscRenderer

public IMiscRenderer getMiscRenderer()
Get the current misc renderer.

Returns:
the misc renderer

setMiscRenderer

public void setMiscRenderer(IMiscRenderer miscRenderer)
Set the misc renderer to be used for rendering some parts/elements in the viewer.

Parameters:
miscRenderer - the renderer to use

getTitleRenderer

public ITitleRenderer getTitleRenderer()
Retrieve the renderer that is currently used to render the title area.

Returns:
the renderer or null if no renderer is set.

setTitleRenderer

public void setTitleRenderer(ITitleRenderer titleRenderer)
Set the title renderer.

Parameters:
titleRenderer - the new renderer or null to disable titel rendering.

getRelationRenderer

public IRelationRenderer getRelationRenderer()
Retrieve the relation renderer currently set.

Returns:
the relation renderer or null if none is set.

setRelationRenderer

public void setRelationRenderer(IRelationRenderer relationRenderer)
Set the relation renderer to use.

Parameters:
relationRenderer - the renderer or null to disable relation rendering.

getMarkerRenderer

public IMarkerRenderer getMarkerRenderer()
Retrieve the configured marker renderer.

Returns:
the marker renderer

setMarkerRenderer

public void setMarkerRenderer(IMarkerRenderer markerRenderer)
Set the marker renderer to be used.

Parameters:
markerRenderer - the marker renderer to be used.

getGlobalAssistantRenderer

public IGlobalAssistantRenderer getGlobalAssistantRenderer()
Get the current global assistant renderer.

Returns:
the renderer currently in use

setGlobalAssistantRenderer

public void setGlobalAssistantRenderer(IGlobalAssistantRenderer globalAssistantRenderer)
Set a gloabl assistant renederer.

Parameters:
globalAssistantRenderer - the renderer

getGridRenderer

public GridRenderer getGridRenderer()
Returns:
Returns the gridRenderer.

setGridRenderer

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

getGapRenderer

public TimeBarGapRenderer getGapRenderer()
Returns:
Returns the gapRenderer.

setGapRenderer

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

registerPopupMenu

public void registerPopupMenu(java.lang.Class<? extends de.jaret.util.date.Interval> clazz,
                              javax.swing.JPopupMenu popup)
Register a popup menu for a given interval class.

Parameters:
clazz - class that the menu is for
popup - popup menu to show

getPopupMenu

public javax.swing.JPopupMenu getPopupMenu(java.lang.Class<? extends de.jaret.util.date.Interval> clazz)
Retrieve the popup menu registered for a given interval class.

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

firePropertyChangeX

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

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

timeBarContains

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

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

timeBarContainingRect

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

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

setCursor

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

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

getIntervalToolTipText

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

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

getStartDate

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

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

setStartDate

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

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

getMinDate

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

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

setMinDate

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

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

getMaxDate

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

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

setMaxDate

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

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

getSelectionModel

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

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

setSelectionModel

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

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

getFirstRowDisplayed

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

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

setFirstRowDisplayed

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

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

setFirstRowDisplayed

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

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

setFirstRow

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

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

setLastRow

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

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

setLastRow

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

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

getEndDate

public de.jaret.util.date.JaretDate getEndDate()


getFirstRowOffset

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

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

setFirstRowOffset

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

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

setTimeScalePosition

public void setTimeScalePosition(int timeScalePosition)


setAdjustMinMaxDatesByModel

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

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

getAdjustMinMaxDatesByModel

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

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

rowForY

public TimeBarRow rowForY(int y)


dateForX

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

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

dateForXY

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

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

xForDate

public int xForDate(de.jaret.util.date.JaretDate date)
Get the corresponding x coordinate in the viewer area for a given date.

Specified by:
xForDate in interface TimeBarViewerInterface
Parameters:
date - Date
Returns:
x coordinate in the viewer area

highlightRow

public void highlightRow(int y)


highlightRow

public void highlightRow(TimeBarRow timeBarRow)


deHighlightRow

public void deHighlightRow()


setDrawRowGrid

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

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

getDrawRowGrid

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

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

setYAxisWidth

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

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

getYAxisWidth

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

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

setHierarchyWidth

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

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

getHierarchyWidth

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

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

addIntervalModificator

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

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

remIntervalModificator

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

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

setAutoscrollEnabled

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

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

isAutoscrollEnabled

public boolean isAutoscrollEnabled()
Get the autoscroll behaviour.

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

getTimeScaleToolTipText

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

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

getHeaderToolTipText

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

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

getHierarchyToolTipText

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

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

getHierarchicalViewState

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

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

setHierarchicalViewState

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

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

setModel

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

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

getHierarchicalModel

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

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

getMarkerWidth

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

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

setTitle

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

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

getTitle

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

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

getBodyContextMenu

public javax.swing.JPopupMenu getBodyContextMenu()
Retrieve the context menu set for the body.

Returns:
the context menu or null

setBodyContextMenu

public void setBodyContextMenu(javax.swing.JPopupMenu bodyContextMenu)
Set the context menu to be used for the body area.

Parameters:
bodyContextMenu - context menu or null for no context menu

getTimeScaleContextMenu

public javax.swing.JPopupMenu getTimeScaleContextMenu()
Retrieve the context menu set for the time scale.

Returns:
the context menu or null

setTimeScaleContextMenu

public void setTimeScaleContextMenu(javax.swing.JPopupMenu timeScaleContextMenu)
Set the context menu to be used for the time scale area.

Parameters:
timeScaleContextMenu - context menu or null for no context menu

getHeaderContextMenu

public javax.swing.JPopupMenu getHeaderContextMenu()
Retrieve the context menu set for the header.

Returns:
the context menu or null

setHeaderContextMenu

public void setHeaderContextMenu(javax.swing.JPopupMenu headerContextMenu)
Set the context menu to be used for the header area.

Parameters:
headerContextMenu - context menu or null for no context menu

getHierarchyContextMenu

public javax.swing.JPopupMenu getHierarchyContextMenu()
Retrieve the context menu set for the hierrarchy.

Returns:
the context menu or null

setHierarchyContextMenu

public void setHierarchyContextMenu(javax.swing.JPopupMenu hierarchyContextMenu)
Set the context menu to be used for the hierarchy area.

Parameters:
hierarchyContextMenu - context menu or null for no context menu

getTitleContextMenu

public javax.swing.JPopupMenu getTitleContextMenu()
Retrieve the context menu set for the title area.

Returns:
the context menu or null

setTitleContextMenu

public void setTitleContextMenu(javax.swing.JPopupMenu titleContextMenu)
Set the context menu to be used for the titel area.

Parameters:
titleContextMenu - context menu or null for no context menu

displayBodyContextMenu

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

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

displayTimeScaleContextMenu

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

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

displayIntervalContextMenu

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

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

displayHeaderContextMenu

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

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

displayHierarchyContextMenu

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

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

displayTitleContextMenu

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

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

isInToggleArea

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

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

isInHierarchySelectionArea

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

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

setDrawOverlapping

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

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

getDrawOverlapping

public boolean getDrawOverlapping()
Retrieve the drawing mode.

Returns:
the drawing mode

addMarker

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

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

remMarker

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

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

getMarkers

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

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

addMarkers

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

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

getSelectionDelta

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

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

setSelectionDelta

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

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

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

isLineDraggingAllowed

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

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

setLineDraggingAllowed

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

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

getYForRow

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

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

getRowForY

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

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

getRowForXY

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

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

isMilliAccuracy

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

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

setMilliAccuracy

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

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

getPpsRow

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

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

hasVariableXScale

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

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

setVariableXScale

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

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

doScrollHorizontal

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

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

doScrollVertical

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

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

getOptimizeScrolling

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

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

setOptimizeScrolling

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

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

getTBOrientation

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

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

setTBOrientation

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

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

getAutoScaleRows

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

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

setAutoScaleRows

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

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

getXAxisHeight

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

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

setXAxisHeight

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

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

fireSelectionChanged

public void fireSelectionChanged()
Called by the delegate whenever the selection changed (to support selction provider under SWT).

Specified by:
fireSelectionChanged in interface TimeBarViewerInterface

addTimeBarChangeListener

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

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

removeTimeBarChangeListener

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

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

addFocussedIntervalListener

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

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

remFocussedIntervalListener

public void remFocussedIntervalListener(FocussedIntervalListener listener)
Remove a focussedIntervalListener.

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

getTimeBarViewState

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

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

isRowHeightDragginAllowed

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

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

setRowHeightDraggingAllowed

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

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

rowLineHit

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

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

isInRowAxis

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

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

isInDiagram

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

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

getStrictClipTimeCheck

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

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

setStrictClipTimeCheck

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

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

getSecondsDisplayed

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

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

getOverlapStrategy

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

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

setOverlapStrategy

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

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

getScrollLookBackMinutes

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

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

setScrollLookBackMinutes

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

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

setScrollLookForwardMinutes

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

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

getScrollLookForwardMinutes

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

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

getName

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

Specified by:
getName in interface TimeBarViewerInterface
Overrides:
getName in class java.awt.Component
Returns:
the name or null if no name has been set

setName

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

Specified by:
setName in interface TimeBarViewerInterface
Overrides:
setName in class java.awt.Component
Parameters:
name - name of the viewer

getDelegate

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

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

getAutoscrollDelta

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

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

setAutoscrollDelta

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

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

getDragAllSelectedIntervals

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

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

setDragAllSelectedIntervals

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

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

getRelationsForCoord

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

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

getRelationTooltip

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

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

getScrollOnFocus

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

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

setScrollOnFocus

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

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

addSelectionRectListener

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

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

remSelectionRectListener

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

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

getHideRoot

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

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

setHideRoot

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

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

getMarkerDraggingInDiagramArea

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

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

setMarkerDraggingInDiagramArea

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

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

clearRegionRect

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

Specified by:
clearRegionRect in interface TimeBarViewerInterface

getRegionRect

public TBRect getRegionRect()
Retrieve the selected region.

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

getRegionRectEnable

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

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

setRegionRectEnable

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

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

repaint

public void repaint(java.awt.Rectangle r)
Mark area to be repainted. Repaint a rectangle. Overridden and extended widht and height by 1.

Specified by:
repaint in interface TimeBarViewerInterface
Overrides:
repaint in class javax.swing.JComponent
Parameters:
r - java.awt.Rectangle that needs to be repainted

getUseUniformHeight

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

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

setUseUniformHeight

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

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

setSecondsDisplayed

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

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

setSecondsDisplayed

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

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

isDisplayed

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

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

setInitialDisplayRange

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

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

getHorizontalScrollPanel

public javax.swing.JPanel getHorizontalScrollPanel()
Retrieve the panel that the horizontal scroll bar is plcaed on (BorderLayout, CENETER). This can be used to add special extensions in the scroll bar area.

Returns:
th panel or null if the scroll bar has been suppressed

getVerticalScrollPanel

public javax.swing.JPanel getVerticalScrollPanel()
Retrieve the panel that the vertical scroll bar is plcaed on (BorderLayout, CENETER). This can be used to add special extensions in the scroll bar area.

Returns:
th panel or null if the scroll bar has been suppressed

getPopUpInformation

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

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

setGhostIntervals

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

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

setGhostOrigin

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

Parameters:
x - x coordinate
y - y coordniate

setUseTitleRendererComponentInPlace

public void setUseTitleRendererComponentInPlace(boolean useTitleRendererComponentInPlace)
If set to true this will cause the title renderer component to be used directly instead of beeing just used to paint.

Parameters:
useTitleRendererComponentInPlace - true for direct use of the component

scrollDateToVisible

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

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

scrollRowToVisible

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

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

scrollIntervalToVisible

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

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


Copyright © 2012. All Rights Reserved.