Class RulerComposite

All Implemented Interfaces:
Drawable

public class RulerComposite extends Composite
A RulerComposite is used to show rulers to the north and west of the control of a given graphical viewer. The rulers will be shown based on whether or not horizontal ruler and vertical ruler properties are set on the given viewer, and the value of the visibility property.
Since:
3.0
  • Constructor Details

  • Method Details

    • calculateEditorTrim

      public static Rectangle calculateEditorTrim(Canvas canvas)
      Calculates the proper trim. Includes scrollbars' sizes only if they're visible.
      Parameters:
      canvas - The canvas.
      Since:
      3.6
    • calculateRulerTrim

      public static Rectangle calculateRulerTrim(Canvas canvas)
      Calculates the proper trim for the ruler.
      Parameters:
      canvas - The canvas.
      Since:
      3.6
    • doLayout

      public void doLayout()
      Perform the ruler layout.
      Since:
      3.6
    • layout

      public void layout(boolean change)
      Overrides:
      layout in class Composite
      See Also:
    • setGraphicalViewer

      public void setGraphicalViewer(ScrollingGraphicalViewer primaryViewer)
      Creates rulers for the given graphical viewer.

      The primaryViewer or its Control cannot be null. The primaryViewer's Control should be a FigureCanvas and a child of this Composite. This method should only be invoked once.

      To create ruler(s), simply add the RulerProvider(s) (with the right key: RulerProvider.PROPERTY_HORIZONTAL_RULER or RulerProvider.PROPERTY_VERTICAL_RULER) as a property on the given viewer. It can be done after this method is invoked. RulerProvider.PROPERTY_RULER_VISIBILITY can be used to show/hide the rulers.

      Parameters:
      primaryViewer - The graphical viewer for which the rulers have to be created
    • getLeft

      protected GraphicalViewer getLeft()
      Retrieve the left ruler graphical viewer.
      Returns:
      The left ruler graphical viewer.
      Since:
      3.6
    • getTop

      protected GraphicalViewer getTop()
      Retrieve the top ruler graphical viewer.
      Returns:
      The top ruler graphical viewer.
      Since:
      3.6
    • getEditor

      protected FigureCanvas getEditor()
      Retrieve the editor figure canvas.
      Returns:
      The editor figure canvas.
      Since:
      3.6