javax.swing.text
Class TextLayoutStrategy.AttributedSegment

java.lang.Object
  extended byjavax.swing.text.Segment
      extended byjavax.swing.text.TextLayoutStrategy.AttributedSegment
All Implemented Interfaces:
AttributedCharacterIterator, CharacterIterator, Cloneable
Enclosing class:
TextLayoutStrategy

static class TextLayoutStrategy.AttributedSegment
extends Segment
implements AttributedCharacterIterator

Implementation of AttributedCharacterIterator that supports the GlyphView attributes for rendering the glyphs through a TextLayout.


Nested Class Summary
 
Nested classes inherited from class java.text.AttributedCharacterIterator
AttributedCharacterIterator.Attribute
 
Field Summary
(package private) static Set keys
           
(package private)  View v
           
 
Fields inherited from class javax.swing.text.Segment
array, count, offset
 
Fields inherited from interface java.text.CharacterIterator
DONE
 
Constructor Summary
(package private) TextLayoutStrategy.AttributedSegment()
           
 
Method Summary
 Set getAllAttributeKeys()
          Returns the keys of all attributes defined on the iterator's text range.
 Object getAttribute(AttributedCharacterIterator.Attribute attribute)
          Returns the value of the named attribute for the current character.
 Map getAttributes()
          Returns a map with the attributes defined on the current character.
(package private)  Font getFont(int childIndex)
          Get the font at the given child index.
(package private)  int getFontBoundary(int childIndex, int dir)
          Get a boundary position for the font.
 int getRunLimit()
          Returns the index of the first character following the run with respect to all attributes containing the current character.
 int getRunLimit(AttributedCharacterIterator.Attribute attribute)
          Returns the index of the first character following the run with respect to the given attribute containing the current character.
 int getRunLimit(Set attributes)
          Returns the index of the first character following the run with respect to the given attributes containing the current character.
 int getRunStart()
          Returns the index of the first character of the run with respect to all attributes containing the current character.
 int getRunStart(AttributedCharacterIterator.Attribute attribute)
          Returns the index of the first character of the run with respect to the given attribute containing the current character.
 int getRunStart(Set attributes)
          Returns the index of the first character of the run with respect to the given attributes containing the current character.
(package private)  View getView()
           
(package private)  void setView(View v)
           
(package private)  int toIteratorIndex(int pos)
           
(package private)  int toModelPosition(int index)
           
 
Methods inherited from class javax.swing.text.Segment
clone, current, first, getBeginIndex, getEndIndex, getIndex, isPartialReturn, last, next, previous, setIndex, setPartialReturn, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.text.CharacterIterator
clone, current, first, getBeginIndex, getEndIndex, getIndex, last, next, previous, setIndex
 

Field Detail

v

View v

keys

static Set keys
Constructor Detail

TextLayoutStrategy.AttributedSegment

TextLayoutStrategy.AttributedSegment()
Method Detail

getView

View getView()

setView

void setView(View v)

getFontBoundary

int getFontBoundary(int childIndex,
                    int dir)
Get a boundary position for the font. This is implemented to assume that two fonts are equal if their references are equal (i.e. that the font came from a cache).

Returns:
the location in model coordinates. This is not the same as the Segment coordinates.

getFont

Font getFont(int childIndex)
Get the font at the given child index.


toModelPosition

int toModelPosition(int index)

toIteratorIndex

int toIteratorIndex(int pos)

getRunStart

public int getRunStart()
Returns the index of the first character of the run with respect to all attributes containing the current character.

Specified by:
getRunStart in interface AttributedCharacterIterator

getRunStart

public int getRunStart(AttributedCharacterIterator.Attribute attribute)
Returns the index of the first character of the run with respect to the given attribute containing the current character.

Specified by:
getRunStart in interface AttributedCharacterIterator

getRunStart

public int getRunStart(Set attributes)
Returns the index of the first character of the run with respect to the given attributes containing the current character.

Specified by:
getRunStart in interface AttributedCharacterIterator

getRunLimit

public int getRunLimit()
Returns the index of the first character following the run with respect to all attributes containing the current character.

Specified by:
getRunLimit in interface AttributedCharacterIterator

getRunLimit

public int getRunLimit(AttributedCharacterIterator.Attribute attribute)
Returns the index of the first character following the run with respect to the given attribute containing the current character.

Specified by:
getRunLimit in interface AttributedCharacterIterator

getRunLimit

public int getRunLimit(Set attributes)
Returns the index of the first character following the run with respect to the given attributes containing the current character.

Specified by:
getRunLimit in interface AttributedCharacterIterator

getAttributes

public Map getAttributes()
Returns a map with the attributes defined on the current character.

Specified by:
getAttributes in interface AttributedCharacterIterator

getAttribute

public Object getAttribute(AttributedCharacterIterator.Attribute attribute)
Returns the value of the named attribute for the current character. Returns null if the attribute is not defined.

Specified by:
getAttribute in interface AttributedCharacterIterator
Parameters:
attribute - the key of the attribute whose value is requested.

getAllAttributeKeys

public Set getAllAttributeKeys()
Returns the keys of all attributes defined on the iterator's text range. The set is empty if no attributes are defined.

Specified by:
getAllAttributeKeys in interface AttributedCharacterIterator