LPEX
4.4.0

com.ibm.lpex.alef
Class LpexAnnotationRulerColumn

java.lang.Object
  extended by com.ibm.lpex.alef.LpexAnnotationRulerColumn

public class LpexAnnotationRulerColumn
extends Object

A vertical ruler column connected to an LpexCompositeRuler. It shows graphical representations of annotations (tasks, bookmarks, ranges, etc.).

Eclipse's org.eclipse.jface.text.source.AnnotationRulerColumn assumes StyledText as the viewer's text widget. LPEX currently uses its own text widget.

Note in AnnotationRulerColumn: will become final, do not subclass.


Constructor Summary
LpexAnnotationRulerColumn(IAnnotationModel model, int width)
          Constructs this column with the given arguments.
LpexAnnotationRulerColumn(IAnnotationModel model, int width, IAnnotationAccess annotationAccess)
          Constructs this column with the given arguments.
LpexAnnotationRulerColumn(int width)
          Constructs this column with the given width.
LpexAnnotationRulerColumn(int width, IAnnotationAccess annotationAccess)
          Constructs a vertical ruler with the given width and the given annotation access.
 
Method Summary
 void addAnnotationType(Object annotationType)
          Adds the given annotation type to this annotation ruler column.
 void addVerticalRulerListener(IVerticalRulerListener listener)
           
 Control createControl(CompositeRuler parentRuler, Composite parentControl)
          Creates the vertical ruler's SWT control, a Canvas, for the LpexCompositeRuler specified.
protected  void doPaint(GC gc)
          Draws the vertical ruler annotations (without drawing the Canvas background).
protected  ITextViewer getCachedTextViewer()
          Returns the cached text viewer.
 Control getControl()
          Returns the vertical ruler's SWT control, if any was created yet.
 IAnnotationHover getHover()
           
 int getLineOfLastMouseButtonActivity()
           
 IAnnotationModel getModel()
          Returns the current annotation model of this ruler, or null if the ruler has no model.
 int getWidth()
          Returns the width of this ruler's control.
protected  boolean hasAnnotation(int lineNumber)
          Returns whether the given line contains an annotation.
protected  boolean isPropagatingMouseListener()
          Tells whether this ruler column propagates mouse listener events to its parent.
protected  void mouseClicked(int rulerLine)
          Hook method for a mouse click event on the given ruler line.
protected  void mouseDoubleClicked(int rulerLine)
          Hook method for a mouse double click event on the given ruler line.
protected  void mouseDown(int rulerLine)
          Hook method for a mouse down event on the given ruler line.
 void redraw()
          Redraws the vertical ruler.
 void removeAnnotationType(Object annotationType)
          Removes the given annotation type from this annotation ruler column.
 void removeVerticalRulerListener(IVerticalRulerListener listener)
           
 void setFont(Font font)
          Set the font of this vertical ruler.
 void setHover(IAnnotationHover hover)
           
 void setModel(IAnnotationModel model)
          Associates an annotation model with this vertical ruler.
 int toDocumentLineNumber(int y_coordinate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LpexAnnotationRulerColumn

public LpexAnnotationRulerColumn(IAnnotationModel model,
                                 int width,
                                 IAnnotationAccess annotationAccess)
Constructs this column with the given arguments.

Parameters:
model - the annotation model to get the annotations from
width - the width of the vertical ruler
annotationAccess - the annotation access

LpexAnnotationRulerColumn

public LpexAnnotationRulerColumn(int width,
                                 IAnnotationAccess annotationAccess)
Constructs a vertical ruler with the given width and the given annotation access.

Parameters:
width - the width of the vertical ruler
annotationAccess - the annotation access

LpexAnnotationRulerColumn

public LpexAnnotationRulerColumn(IAnnotationModel model,
                                 int width)
Constructs this column with the given arguments.

Parameters:
model - the annotation model to get the annotations from
width - the width of the vertical ruler

LpexAnnotationRulerColumn

public LpexAnnotationRulerColumn(int width)
Constructs this column with the given width. The actual vertical-ruler SWT control is only created when createControl() is invoked.

Parameters:
width - the width of the vertical ruler
Method Detail

getControl

public Control getControl()
Returns the vertical ruler's SWT control, if any was created yet.

See Also:
IVerticalRulerColumn

getWidth

public int getWidth()
Returns the width of this ruler's control.

See Also:
IVerticalRulerColumn

createControl

public Control createControl(CompositeRuler parentRuler,
                             Composite parentControl)
Creates the vertical ruler's SWT control, a Canvas, for the LpexCompositeRuler specified.

Parameters:
parentRuler - the parent LpexCompositeRuler associated with this ruler column
parentControl - the control of the parent ruler
See Also:
IVerticalRulerColumn

isPropagatingMouseListener

protected boolean isPropagatingMouseListener()
Tells whether this ruler column propagates mouse listener events to its parent.

Returns:
true if propagating to parent

mouseDoubleClicked

protected void mouseDoubleClicked(int rulerLine)
Hook method for a mouse double click event on the given ruler line.

Parameters:
rulerLine - the ruler line

mouseClicked

protected void mouseClicked(int rulerLine)
Hook method for a mouse click event on the given ruler line.

Parameters:
rulerLine - the ruler line

hasAnnotation

protected boolean hasAnnotation(int lineNumber)
Returns whether the given line contains an annotation.

Parameters:
lineNumber - the line number in the document
Returns:
true if the given document line contains an annotation

doPaint

protected void doPaint(GC gc)
Draws the vertical ruler annotations (without drawing the Canvas background).

Parameters:
gc - the GC to draw on

redraw

public void redraw()
Redraws the vertical ruler.

See Also:
IVerticalRulerColumn

setModel

public void setModel(IAnnotationModel model)
Associates an annotation model with this vertical ruler. If the ruler is visible, it must display those annotations of the annotation model whose visual representation overlaps with the viewport of the text viewer. A null value clears the ruler.

See Also:
IVerticalRulerColumn

setFont

public void setFont(Font font)
Set the font of this vertical ruler.

See Also:
IVerticalRulerColumn

getCachedTextViewer

protected ITextViewer getCachedTextViewer()
Returns the cached text viewer.

Returns:
the cached text viewer

getModel

public IAnnotationModel getModel()
Returns the current annotation model of this ruler, or null if the ruler has no model.

See Also:
IVerticalRulerInfoExtension

addAnnotationType

public void addAnnotationType(Object annotationType)
Adds the given annotation type to this annotation ruler column. Starting with this call, annotations of the given type are shown in this annotation ruler column.

Parameters:
annotationType - the annotation type

getLineOfLastMouseButtonActivity

public int getLineOfLastMouseButtonActivity()

toDocumentLineNumber

public int toDocumentLineNumber(int y_coordinate)

removeAnnotationType

public void removeAnnotationType(Object annotationType)
Removes the given annotation type from this annotation ruler column. Annotations of the given type are no longer shown in this annotation ruler column.

Parameters:
annotationType - the annotation type

getHover

public IAnnotationHover getHover()

setHover

public void setHover(IAnnotationHover hover)
Parameters:
hover - The hover to set.

addVerticalRulerListener

public void addVerticalRulerListener(IVerticalRulerListener listener)

removeVerticalRulerListener

public void removeVerticalRulerListener(IVerticalRulerListener listener)

mouseDown

protected void mouseDown(int rulerLine)
Hook method for a mouse down event on the given ruler line.

Parameters:
rulerLine - the ruler line
Since:
3.5

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.