Extension SDK 9.0.5

oracle.javatools.editor.underline
Class UnderlinedFragmentsList

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

public final class UnderlinedFragmentsList
extends java.lang.Object

An UnderlinedFragmentsList is just a list of UnderlinedFragments that we can re-use without having to constantly reallocate arrays and UnderlinedFragment objects. This class is similar to the HighlightedFragmentsList except that it applies to UnderlinedFragments.

Since this fragments list is typically used for rendering underlines, it will take care of resolving priority levels of underlines as they are added to the list. This means underlines 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 manually sort through the underlines.

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


Constructor Summary
UnderlinedFragmentsList()
          Constructs a new UnderlinedFragmentList with an initial size of the default.
 
Method Summary
 void add(UnderlineStyle underlineStyle, 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 underlines displacing lower priority ones.
 void clear()
          Discards all fragments from the list.
 UnderlinedFragment get(int index)
          Get the fragment at the specified index.
 void setUnderlineRegistry(UnderlineRegistry registry)
          Set the UnderlineRegistry used by this list when building up its list of underline fragments.
 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
 

Constructor Detail

UnderlinedFragmentsList

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

Method Detail

setUnderlineRegistry

public void setUnderlineRegistry(UnderlineRegistry registry)
Set the UnderlineRegistry used by this list when building up its list of underline fragments.


add

public void add(UnderlineStyle underlineStyle,
                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 underlines displacing lower priority ones.

Parameters:
underlineStyle - the underline style
startOffset - the starting offset of the underline
endOffset - the ending offset of the underline

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 UnderlinedFragment 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.

Extension SDK

 

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