Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.javatools.editor.highlight
Class HighlightFragmentsList

java.lang.Object
  extended by oracle.javatools.editor.highlight.HighlightFragmentsList

public class HighlightFragmentsList
extends java.lang.Object

A HighlightFragmentsList is a list of HighlightFragment instances that we can re-use without constantly having to reallocate arrays and fragment objects. This class is similar to the StyledFragmentsList class except that it applies to HighlightFragment objects.

This fragments list is used primarily for rendering highlights, so it will take care of resolving priority levels of highlights as they are added to the list. This means highlights can be added to the list out of order (both in terms of offsets as well as priority levels), relieving the view and renderers from the responsibility of having to pre-sort through the highlights.

Note that unlike the StyledFragmentsList, fragments added to this list are not required, or expected, to be adjacent regions of text.

For more information about how the different attributes (background, foreground, font, underline) of a highlight are applied, refer to HighlightLayer.

See Also:
HighlightFragment, HighlightLayer

Field Summary
static int ATTRIBUTE_ALL
          Constant indicating that all attributes should be included.
static int ATTRIBUTE_BACKGROUND
          Constant indicating that background should be included.
static int ATTRIBUTE_FONT
          Constant indicating that fonts should be included.
static int ATTRIBUTE_FOREGROUND
          Constant indicating that foreground should be included.
static int ATTRIBUTE_UNDERLINE
          Constant indicating that underlines should be included.
static int TYPE_ALL
          Constant indicating that all underline types should be included.
static int TYPE_SEPARATOR
          Constant indicating that seprator type should be included.
static int TYPE_STRIKETHRU
          Constant indicating that strikethru type should be included.
static int TYPE_UNDERLINE
          Constant indicating that underline type should be included.
 
Constructor Summary
HighlightFragmentsList()
          Constructs a new HighlightFragmentsList with an initial size of the default.
 
Method Summary
 void add(HighlightStyle highlightStyle, int startOffset, int endOffset)
          Adds the given fragment to the list, accounting for priority and offsets so that the list is always sorted in increasing offsets with higher priority highlights displacing lower priority ones.
 void addSentinel(HighlightStyle highlightStyle)
          Adds a final sentinel fragment for background attribute.
 void clear()
          Discards all fragments from the list.
 void clearAllFilters()
          Utility routine to clear attribute filters.
 void clearAttributeFilter()
          Utility routine to clear attribute filters.
 void clearUnderlineTypeFilter()
          Utility routine to clear underline type filters.
 void compact()
          Utility routine to compact the list if possible, if there are adjacent fragments that are continuous, and have the same styles set.
 HighlightFragment get(int index)
          Get the fragment at the specified index.
 HighlightStyle getSentinelBackground()
          Fetch the final sentinel background style if any.
 HighlightStyle getSentinelUnderline()
          Fetch the final sentinel underline style if any.
 void setAttributeFilter(int attributeFilter)
          Sets the filtering on attributes (when adding highlights to the list) of what to include in the list.
 void setAttributeFontOnly()
          Convenience routine to set filtering to include only highlights with a font attribute defined.
 void setAttributeTextOnly()
          Convenience routine to set filtering to include only highlights with any text attribute (background, foreground, fonts).
 void setAttributeUnderlineOnly()
          Convenience routine to set filtering to include only highlights with an underline attribute defined.
 void setHighlightRegistry(HighlightRegistry registry)
          Set the HighlightRegistry used by this list when building up its list of highlight fragments.
 void setUnderlineTypeFilter(int underlineTypeFilter)
          Sets the filtering on attributes (when adding highlights to the list) of what to include in the list.
 int size()
          Returns the size of the list (number of fragments.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_BACKGROUND

public static final int ATTRIBUTE_BACKGROUND
Constant indicating that background should be included.

See Also:
Constant Field Values

ATTRIBUTE_FOREGROUND

public static final int ATTRIBUTE_FOREGROUND
Constant indicating that foreground should be included.

See Also:
Constant Field Values

ATTRIBUTE_FONT

public static final int ATTRIBUTE_FONT
Constant indicating that fonts should be included.

See Also:
Constant Field Values

ATTRIBUTE_UNDERLINE

public static final int ATTRIBUTE_UNDERLINE
Constant indicating that underlines should be included.

See Also:
Constant Field Values

ATTRIBUTE_ALL

public static final int ATTRIBUTE_ALL
Constant indicating that all attributes should be included.

See Also:
Constant Field Values

TYPE_STRIKETHRU

public static final int TYPE_STRIKETHRU
Constant indicating that strikethru type should be included.

See Also:
Constant Field Values

TYPE_UNDERLINE

public static final int TYPE_UNDERLINE
Constant indicating that underline type should be included.

See Also:
Constant Field Values

TYPE_SEPARATOR

public static final int TYPE_SEPARATOR
Constant indicating that seprator type should be included.

See Also:
Constant Field Values

TYPE_ALL

public static final int TYPE_ALL
Constant indicating that all underline types should be included.

See Also:
Constant Field Values
Constructor Detail

HighlightFragmentsList

public HighlightFragmentsList()
Constructs a new HighlightFragmentsList with an initial size of the default.

Method Detail

setHighlightRegistry

public void setHighlightRegistry(HighlightRegistry registry)
Set the HighlightRegistry used by this list when building up its list of highlight fragments.


addSentinel

public void addSentinel(HighlightStyle highlightStyle)
Adds a final sentinel fragment for background attribute. This is for the final trailing line paint at the end of the buffer.

Parameters:
highlightStyle - the highlight style

getSentinelBackground

public HighlightStyle getSentinelBackground()
Fetch the final sentinel background style if any.

Returns:
the final sentinel background style

getSentinelUnderline

public HighlightStyle getSentinelUnderline()
Fetch the final sentinel underline style if any.

Returns:
the final sentinel underline style

compact

public void compact()
Utility routine to compact the list if possible, if there are adjacent fragments that are continuous, and have the same styles set.


add

public void add(HighlightStyle highlightStyle,
                int startOffset,
                int endOffset)
Adds the given fragment to the list, accounting for priority and offsets so that the list is always sorted in increasing offsets with higher priority highlights displacing lower priority ones. Note that background, foreground, and font attribute are processed separately.

Parameters:
highlightStyle - the highlight style
startOffset - the starting offset of the highlight
endOffset - the ending offset of the highlight

clear

public void clear()
Discards all fragments from the list.


size

public int size()
Returns the size of the list (number of fragments.)

Returns:
the size of the list

get

public HighlightFragment get(int index)
Get the fragment at the specified index.

Parameters:
index - the index of the fragment to retrieve
Returns:
the fragment at the given index.

clearAllFilters

public void clearAllFilters()
Utility routine to clear attribute filters.


clearAttributeFilter

public void clearAttributeFilter()
Utility routine to clear attribute filters.


setAttributeFilter

public void setAttributeFilter(int attributeFilter)
Sets the filtering on attributes (when adding highlights to the list) of what to include in the list.


setAttributeTextOnly

public void setAttributeTextOnly()
Convenience routine to set filtering to include only highlights with any text attribute (background, foreground, fonts).


setAttributeFontOnly

public void setAttributeFontOnly()
Convenience routine to set filtering to include only highlights with a font attribute defined.


setAttributeUnderlineOnly

public void setAttributeUnderlineOnly()
Convenience routine to set filtering to include only highlights with an underline attribute defined.


clearUnderlineTypeFilter

public void clearUnderlineTypeFilter()
Utility routine to clear underline type filters.


setUnderlineTypeFilter

public void setUnderlineTypeFilter(int underlineTypeFilter)
Sets the filtering on attributes (when adding highlights to the list) of what to include in the list.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

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