Extension SDK 10.1.2

oracle.javatools.editor.underline
Class UnderlineLayer

java.lang.Object
  extended byoracle.javatools.editor.underline.UnderlineLayer

public final class UnderlineLayer
extends java.lang.Object

An UnderlineLayer is a container for underlines added to an editor pane. Underlines are used to draw the user's attention to a region of text - this can be either an entire line, or short runs of text. These underlines are created in different contains, or layers, so that different modules can maintain and manipulate their underlines in separate layers without affecting each other.

An underline consists of 2 pieces - an underline style (enabled, priority level, color, underline shape), and a line number or n offset range.

There are two types of underlines, line or text. A "line" type is used as a separator to separate portions of the editor, and span across an entire line. They are drawn below the specified line. A "text" type is used to "mark" a run of text to draw the user's attention to it, and is specified using a start offset (inclusive) and an end offset (exclusive.)

Note that "text" type underlines are always higher priority than "line" type underlines. When rendering a given region or line of text, the highest priority "line" type and highest priority "text" types are chosen. The "line" type underline is drawn first, followed by the "text" type on top.


Constructor Summary
UnderlineLayer(BasicEditorPane editor)
          Constructs a new underline layer associated with the given editor.
 
Method Summary
 UnderlinedLine addUnderlinedLine(UnderlineStyle style, int line)
          Adds an underline across the entire line using the specified style and offsets.
 UnderlinedText addUnderlinedText(UnderlineStyle style, int startOffset, int endOffset)
          Adds an underline to a run of text using the specified style and offsets.
 void changeUnderline(UnderlinedLine underlinedLine, UnderlineStyle style, int line)
          Moves the underlined line of text to a new location, and changes the underline style used.
 void changeUnderline(UnderlinedText underlinedText, UnderlineStyle style, int startOffset, int endOffset)
          Moves the underlined run of text to a new location, and changes the underline style used.
 void removeAllUnderlines()
          Removes all underlines in this layer from the associated editor pane.
 void removeUnderline(UnderlinedLine underlinedLine)
          Removes the given underline from the editor.
 void removeUnderline(UnderlinedText underlinedText)
          Removes the given underline from the editor.
 void renderUnderlinedLines(UnderlinedFragmentsList fragmentsList, int startLine, int endLine)
          This routine is used by the editor view to obtain the underlines in this underline layer for only line underlines in the given line range.
 void renderUnderlinedText(UnderlinedFragmentsList fragmentsList, int startOffset, int endOffset)
          This routine is used by the editor view to obtain the underlines in this underline layer for only text underlines in the given offset range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnderlineLayer

public UnderlineLayer(BasicEditorPane editor)
Constructs a new underline layer associated with the given editor.

Method Detail

addUnderlinedText

public UnderlinedText addUnderlinedText(UnderlineStyle style,
                                        int startOffset,
                                        int endOffset)
Adds an underline to a run of text using the specified style and offsets.

Parameters:
style - the underline style to use
startOffset - the start of the run of text
endOffset - the end of the run of text

addUnderlinedLine

public UnderlinedLine addUnderlinedLine(UnderlineStyle style,
                                        int line)
Adds an underline across the entire line using the specified style and offsets. As with underline text, the underline is drawn below the specified line.

Parameters:
style - the underline style to use
line - the (0-based) line to underline

removeUnderline

public void removeUnderline(UnderlinedText underlinedText)
Removes the given underline from the editor.

Parameters:
underlinedText - the underlined segment to remove

removeUnderline

public void removeUnderline(UnderlinedLine underlinedLine)
Removes the given underline from the editor.

Parameters:
underlinedLine - the underlined line to remove

removeAllUnderlines

public void removeAllUnderlines()
Removes all underlines in this layer from the associated editor pane.


changeUnderline

public void changeUnderline(UnderlinedText underlinedText,
                            UnderlineStyle style,
                            int startOffset,
                            int endOffset)
Moves the underlined run of text to a new location, and changes the underline style used.

Parameters:
underlinedText - the underline that was previously created
style - the new underline style (can be same as old)
startOffset - the new start offset
endOffset - the new end offset

changeUnderline

public void changeUnderline(UnderlinedLine underlinedLine,
                            UnderlineStyle style,
                            int line)
Moves the underlined line of text to a new location, and changes the underline style used.

Parameters:
underlinedLine - the underline that was previously created
style - the new underline style (can be same as old)
line - the new (0-based) line

renderUnderlinedText

public void renderUnderlinedText(UnderlinedFragmentsList fragmentsList,
                                 int startOffset,
                                 int endOffset)
This routine is used by the editor view to obtain the underlines in this underline layer for only text underlines in the given offset range.

Parameters:
fragmentsList - the list to add the fragments to
startOffset - the start of the painting area (inclusive)
endOffset - the end of the painting area (exclusive)

renderUnderlinedLines

public void renderUnderlinedLines(UnderlinedFragmentsList fragmentsList,
                                  int startLine,
                                  int endLine)
This routine is used by the editor view to obtain the underlines in this underline layer for only line underlines in the given line range.

Parameters:
fragmentsList - the list to add the fragments to
startLine - the 0-based starting line (inclusive)
endLine - the 0-based ending line (exclusive)

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.