de.jaret.util.ui.timebars.swing.renderer
Class BoxTimeScaleRenderer

java.lang.Object
  extended by de.jaret.util.ui.timebars.swing.renderer.BoxTimeScaleRenderer
All Implemented Interfaces:
ITickProvider, TimeScaleRenderer

public class BoxTimeScaleRenderer
extends java.lang.Object
implements TimeScaleRenderer, ITickProvider

A default renderer for a time scale to be used in a TimeBarViewer.

Version:
$Id: BoxTimeScaleRenderer.java 1083 2011-07-01 20:29:16Z kliem $
Author:
Peter Kliem

Field Summary
protected  java.util.List<de.jaret.util.date.JaretDate> _majorTicks
          major ticks of the last rendering.
protected  java.util.List<de.jaret.util.date.JaretDate> _minorTicks
          minor ticks of the last rendering.
protected  de.jaret.util.ui.timebars.swing.renderer.BoxTimeScaleRenderer.MyTimeScaleRenderer _renderer
          rendering component.
 
Constructor Summary
BoxTimeScaleRenderer()
           
 
Method Summary
 int getHeight()
          Return the height needed for painting the time scale.
 java.util.List<de.jaret.util.date.JaretDate> getMajorTicks(TimeBarViewerDelegate delegate)
          Provide a list of dates used as major ticks.
 java.util.List<de.jaret.util.date.JaretDate> getMinorTicks(TimeBarViewerDelegate delegate)
          Provide a list of dates used as minor ticks.
 javax.swing.JComponent getRendererComponent(TimeBarViewer tbv, boolean top)
          Return a JComponent to be used to render the time scale.
 void setCorrectDST(boolean correctDST)
          Setup the iterators to do a DST correction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_renderer

protected de.jaret.util.ui.timebars.swing.renderer.BoxTimeScaleRenderer.MyTimeScaleRenderer _renderer
rendering component.


_majorTicks

protected java.util.List<de.jaret.util.date.JaretDate> _majorTicks
major ticks of the last rendering.


_minorTicks

protected java.util.List<de.jaret.util.date.JaretDate> _minorTicks
minor ticks of the last rendering.

Constructor Detail

BoxTimeScaleRenderer

public BoxTimeScaleRenderer()
Method Detail

getRendererComponent

public javax.swing.JComponent getRendererComponent(TimeBarViewer tbv,
                                                   boolean top)
Return a JComponent to be used to render the time scale. The component has to be configured properly before returning it. All needed information about the time scale, major and minor ticks can be obtainend by the TimeBarViewer.

The component may implement getToolTipText(MouseEvent evt) to return a proper tooltip for the location

Specified by:
getRendererComponent in interface TimeScaleRenderer
Parameters:
tbv - the TimeBarViwer the component is used for
top - if true the scale is drawn at the top of the diagram
Returns:
a configured JComponent

getHeight

public int getHeight()
Return the height needed for painting the time scale. The value will be fetched only once when the renderer is set for the TimeBarViewer for reasons of stability in painting.

Specified by:
getHeight in interface TimeScaleRenderer
Returns:
the height of the time scale

getMajorTicks

public java.util.List<de.jaret.util.date.JaretDate> getMajorTicks(TimeBarViewerDelegate delegate)
Provide a list of dates used as major ticks.

Specified by:
getMajorTicks in interface ITickProvider
Parameters:
delegate - the delegate the ticks are used with
Returns:
list of dates

getMinorTicks

public java.util.List<de.jaret.util.date.JaretDate> getMinorTicks(TimeBarViewerDelegate delegate)
Provide a list of dates used as minor ticks.

Specified by:
getMinorTicks in interface ITickProvider
Parameters:
delegate - the delegate the ticks are used with
Returns:
list of dates

setCorrectDST

public void setCorrectDST(boolean correctDST)
Setup the iterators to do a DST correction.

Parameters:
correctDST - true if a correction should be done.


Copyright © 2012. All Rights Reserved.