Class orion.textview.Ruler
This interface represents a ruler for the text view.
A Ruler is a graphical element that is placed either on the left or on the right side of the view. It can be used to provide the view with per line decoration such as line numbering, bookmarks, breakpoints, folding disclosures, etc.
There are two types of rulers: page and document. A page ruler only shows the content for the lines that are visible, while a document ruler always shows the whole content.
See:orion.textview.LineNumberRuler
orion.textview.AnnotationRuler
orion.textview.OverviewRuler
orion.textview.TextView
orion.textview.TextView#addRuler
Defined in: </shared/eclipse/e4/orion/I201107200200/plugins/org.eclipse.orion.client.editor/web/orion/textview/rulers.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.textview.Ruler(rulerLocation, rulerOverview, rulerStyle)
Contructs a new ruler.
|
Method Attributes | Method Name and Description |
---|---|
Returns the indices of the lines that have decoration.
|
|
getHTML(lineIndex)
Returns the HTML content for the decoration of a given line.
|
|
Returns the ruler location.
|
|
Returns the ruler overview type.
|
|
getStyle(lineIndex)
Returns the CSS styling information for the decoration of a given line.
|
|
setView(view)
Sets the view for the ruler.
|
Event Attributes | Event Name and Description |
---|---|
onClick(lineIndex, e)
This event is sent when the user clicks a line decoration.
|
|
onDblClick(lineIndex, e)
This event is sent when the user double clicks a line decoration.
|
The default implementation does not implement all the methods in the interface and is useful only for objects implementing rulers.
- Parameters:
- {String} rulerLocation Optional, Default: "left"
- the location for the ruler.
- {String} rulerOverview Optional, Default: "page"
- the overview for the ruler.
- {orion.textview.Style} rulerStyle Optional
- the style for the ruler.
This function is only called for rulers with "document" overview type.
- Returns:
- {Number[]} an array of line indices.
If the line index is -1
, the HTML content for the decoration
that determines the width of the ruler should be returned.
- Parameters:
- {Number} lineIndex
- the line index
- Returns:
- {String} the HTML content for a given line, or generic line.
- See:
- #getStyle
- Returns:
- {String} the ruler location, which is either "left" or "right".
- See:
- #getOverview
- Returns:
- {String} the overview type, which is either "page" or "document".
- See:
- #getLocation
If the line index is -1
, the CSS styling information for the decoration
that determines the width of the ruler should be returned. If the line is
undefined
, the ruler styling information should be returned.
- Parameters:
- {Number} lineIndex
- the line index
- Returns:
- {orion.textview.Style} the CSS styling for ruler, given line, or generic line.
- See:
- #getHTML
- Parameters:
- {orion.textview.TextView} view
- the text view.
- Parameters:
- {Number} lineIndex
- the line index of the clicked decoration.
- {DOMEvent} e
- the click event.
- Parameters:
- {Number} lineIndex
- the line index of the double clicked decoration.
- {DOMEvent} e
- the double click event.