Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.custom
Class DefaultLineStyler  view DefaultLineStyler download DefaultLineStyler.java

java.lang.Object
  extended byorg.eclipse.swt.custom.DefaultLineStyler
All Implemented Interfaces:
java.util.EventListener, LineBackgroundListener, LineStyleListener, org.eclipse.swt.internal.SWTEventListener

class DefaultLineStyler
extends java.lang.Object
implements LineStyleListener, LineBackgroundListener


Field Summary
(package private)  StyledTextContent content
           
(package private)  org.eclipse.swt.graphics.Color[] lineBackgrounds
           
(package private)  int lineCount
           
(package private)  int lineExpandExp
           
(package private)  int styleCount
           
(package private)  int styleExpandExp
           
(package private)  StyleRange[] styles
           
 
Constructor Summary
DefaultLineStyler(StyledTextContent content)
          Creates a new default line styler.
 
Method Summary
(package private)  void clearStyle(StyleRange clearStyle)
          Removes style information that is defined for the range of text in clearStyle.
(package private)  void deleteStyle(int index)
          Deletes the style at index.
(package private)  void deleteStyles(int index, int count)
          Delete count styles starting at index.
(package private)  void expandLinesBy(int numLines)
          Increases the linebackgrounds array to accomodate new line background information.
(package private)  org.eclipse.swt.graphics.Color getLineBackground(int index)
          Returns the background color of a line.
(package private)  org.eclipse.swt.graphics.Point getOverlappingStyles(int start, int length)
          Returns the indexes of the styles that overlap the given range.
(package private)  StyleRange getStyleRangeAtOffset(int offset)
          Returns the style for the character at offset.
(package private)  StyleRange[] getStyleRanges()
          Returns the styles that are defined.
(package private)  StyleRange[] getStyleRangesFor(int offset, int length)
          Returns the styles for the given range.
(package private)  boolean insertMergeStyle(StyleRange style, int index)
          Inserts a style, merging it with adjacent styles if possible.
(package private)  void insertStyle(StyleRange style, int index)
          Inserts a style at the given location.
(package private)  void insertStyles(StyleRange[] insertStyles, int index)
          Insert the styles at the given location.
 void lineGetBackground(LineBackgroundEvent event)
          Handles the get line background color callback.
 void lineGetStyle(LineStyleEvent event)
          Handles the get line style information callback.
(package private)  void linesChanging(int start, int delta)
           
(package private)  boolean mergeStyleAfter(StyleRange style, int index)
          Merges the style with the style after it if possible.
(package private)  boolean mergeStyleBefore(StyleRange style, int index)
          Merges the style with the style before it if possible.
(package private)  void release()
           
(package private)  void replaceStyleRanges(int start, int length, StyleRange[] ranges)
          Replace the styles for the given range.
(package private)  int searchForStyle(int start, int end)
          Searches for the first style in the start - end range.
(package private)  void setLineBackground(int startLine, int count, org.eclipse.swt.graphics.Color background)
          Updates the line background colors to reflect a new color.
(package private)  void setStyleRange(StyleRange newStyle)
          Update the styles to reflect the new style.
(package private)  void setStyleRanges(StyleRange[] styles)
          Sets the array of styles and discards old styles.
(package private)  void textChanging(int start, int delta)
           
 void textChanging(TextChangingEvent event)
          Updates the style ranges and line backgrounds to reflect a pending text change.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

content

StyledTextContent content

styles

StyleRange[] styles

styleCount

int styleCount

styleExpandExp

int styleExpandExp

lineExpandExp

int lineExpandExp

lineCount

int lineCount

lineBackgrounds

org.eclipse.swt.graphics.Color[] lineBackgrounds
Constructor Detail

DefaultLineStyler

public DefaultLineStyler(StyledTextContent content)
Creates a new default line styler.

Method Detail

insertStyle

void insertStyle(StyleRange style,
                 int index)
Inserts a style at the given location.


insertStyles

void insertStyles(StyleRange[] insertStyles,
                  int index)
Insert the styles at the given location.


insertMergeStyle

boolean insertMergeStyle(StyleRange style,
                         int index)
Inserts a style, merging it with adjacent styles if possible.


mergeStyleBefore

boolean mergeStyleBefore(StyleRange style,
                         int index)
Merges the style with the style before it if possible.


mergeStyleAfter

boolean mergeStyleAfter(StyleRange style,
                        int index)
Merges the style with the style after it if possible.


clearStyle

void clearStyle(StyleRange clearStyle)
Removes style information that is defined for the range of text in clearStyle.


expandLinesBy

void expandLinesBy(int numLines)
Increases the linebackgrounds array to accomodate new line background information.


deleteStyle

void deleteStyle(int index)
Deletes the style at index.


deleteStyles

void deleteStyles(int index,
                  int count)
Delete count styles starting at index.


getStyleRanges

StyleRange[] getStyleRanges()
Returns the styles that are defined.


lineGetBackground

public void lineGetBackground(LineBackgroundEvent event)
Handles the get line background color callback.

Specified by:
lineGetBackground in interface LineBackgroundListener

lineGetStyle

public void lineGetStyle(LineStyleEvent event)
Handles the get line style information callback.

Specified by:
lineGetStyle in interface LineStyleListener

searchForStyle

int searchForStyle(int start,
                   int end)
Searches for the first style in the start - end range.


setLineBackground

void setLineBackground(int startLine,
                       int count,
                       org.eclipse.swt.graphics.Color background)
Updates the line background colors to reflect a new color. Called by StyledText.


setStyleRange

void setStyleRange(StyleRange newStyle)
Update the styles to reflect the new style. newStyle will replace any old style for the range. When this method is called, the DefaultLineStyler may merge the new style with an existing style (if possible). Called by StyledText when a style is added. Called by StyledText.


replaceStyleRanges

void replaceStyleRanges(int start,
                        int length,
                        StyleRange[] ranges)
Replace the styles for the given range.


setStyleRanges

void setStyleRanges(StyleRange[] styles)
Sets the array of styles and discards old styles. Called by StyledText.


textChanging

public void textChanging(TextChangingEvent event)
Updates the style ranges and line backgrounds to reflect a pending text change. Called by StyledText when a TextChangingEvent is received.


linesChanging

void linesChanging(int start,
                   int delta)

textChanging

void textChanging(int start,
                  int delta)

getOverlappingStyles

org.eclipse.swt.graphics.Point getOverlappingStyles(int start,
                                                    int length)
Returns the indexes of the styles that overlap the given range. Styles that partially or fully overlap the range will be returned.


getLineBackground

org.eclipse.swt.graphics.Color getLineBackground(int index)
Returns the background color of a line. Called by StyledText. It is safe to return the existing Color object since the colors are set and managed by the client.


getStyleRangeAtOffset

StyleRange getStyleRangeAtOffset(int offset)
Returns the style for the character at offset. Called by StyledText. Returns a new style. Does not return the existing style.


getStyleRangesFor

StyleRange[] getStyleRangesFor(int offset,
                               int length)
Returns the styles for the given range. Returns the existing styles, so be careful not to modify the return value. Styles are not cloned in order to make this method as efficient as possible.


release

void release()