com.borland.primetime.editor
Class LineMark

java.lang.Object
  |
  +--com.borland.primetime.editor.LineMark
Direct Known Subclasses:
EditorPane.HighlightMark, GutterMark

public class LineMark
extends java.lang.Object

A LineMark is an object that represents a line position within a document. LineMarks are tracked by the document, and moved around as changes to the document occur. Someone interested in a LineMark can ask the mark for its markLine, which will return the line that it is on.

A LineMark can be constructed as a lightweight mark, in which case it does not store a reference to the document in which it exists, thus it cannot be asked what line it exists on. The purpose of a lightweight mark is to enable the same mark to exist in multiple places in the document (i.e. you can add a lightweight LineMark to the same document over and over again). The lightweight capability was originally created to display executable lines when running the debugger, but it can be used for other types of display-only markup as well.

See Also:
EditorDocument

Constructor Summary
LineMark()
          Create a new "heavyweight" LineMark.
LineMark(boolean lightweight)
          Create a new LineMark.
LineMark(boolean lightweight, javax.swing.text.Style style)
          Create a new LineMark that paints using the specified style.
LineMark(javax.swing.text.Style style)
          Create a new "heavyweight" LineMark that paints using the specified style.
 
Method Summary
 int getDisplayPriority()
          Describes the logical priority this mark belongs to for ordering purposes.
protected  EditorDocument getDocument()
          Get the document that this mark is associated with.
 int getMarkLine()
          Get the current location of this mark.
 javax.swing.text.Style getStyle()
          Get the style to use when painting a line with this mark.
 boolean isLightweight()
          Check to see if this is a lightweight mark or not.
protected  void setDisplayPriority(int priority)
          Set the logical priority this mark belongs to for ordering purposes.
 void setDocument(EditorDocument doc)
          This is called by the document when a mark is inserted.
protected  void setStyle(javax.swing.text.Style style)
          Set the style to use when painting a line with this mark.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineMark

public LineMark()
Create a new "heavyweight" LineMark.

LineMark

public LineMark(boolean lightweight)
Create a new LineMark.
Parameters:
lightweight - True if this is to be a lightweight mark.

LineMark

public LineMark(javax.swing.text.Style style)
Create a new "heavyweight" LineMark that paints using the specified style.
Parameters:
style - The style to use when painting a line with this mark.

LineMark

public LineMark(boolean lightweight,
                javax.swing.text.Style style)
Create a new LineMark that paints using the specified style.
Parameters:
style - The style to use when painting a line with this mark.
Method Detail

isLightweight

public boolean isLightweight()
Check to see if this is a lightweight mark or not.
Returns:
True if this mark is a lightweight mark.

getStyle

public javax.swing.text.Style getStyle()
Get the style to use when painting a line with this mark.
Returns:
The style to use when painting a line with this mark. This may return null if no style is set.

setStyle

protected void setStyle(javax.swing.text.Style style)
Set the style to use when painting a line with this mark.
Parameters:
style - The style.

getDisplayPriority

public int getDisplayPriority()
Describes the logical priority this mark belongs to for ordering purposes. Marks with a higher priority paint over marks with a lower priority, if both are on the same line.

For reference, here are some of the defined priority values:

Returns:
An int value specifying the display priority of this mark.

setDisplayPriority

protected void setDisplayPriority(int priority)
Set the logical priority this mark belongs to for ordering purposes.
Parameters:
priority - An int value specifying the display priority of this mark.
See Also:
getDisplayPriority()

setDocument

public void setDocument(EditorDocument doc)
This is called by the document when a mark is inserted. This is required so that the mark can be used to look up its location, when asked. For lightweight marks, this has no effect.

getDocument

protected EditorDocument getDocument()
Get the document that this mark is associated with.

This is provided so that subclasses can manage themselves, if desired. A subclasses can get access to the document it are associated with so that it can remove itself from that document before placing itself somewhere else.


getMarkLine

public int getMarkLine()
Get the current location of this mark.
Returns:
the current 1-based line number of this mark. -1 is returned if this mark does not exist in a document, or if this mark is lightweight.