|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.font.StyledParagraph
This class stores Font, GraphicAttribute, and Decoration intervals on a paragraph of styled text.
Currently, this class is optimized for a small number of intervals (preferrably 1).
| Field Summary | |
private sun.awt.font.Decoration |
decoration
|
private Vector |
decorations
|
(package private) int[] |
decorationStarts
|
private Object |
font
|
private Vector |
fonts
|
(package private) int[] |
fontStarts
|
private static int |
INITIAL_SIZE
|
private int |
length
|
| Constructor Summary | |
StyledParagraph(AttributedCharacterIterator aci,
char[] chars)
Create a new StyledParagraph over the given styled text. |
|
| Method Summary | |
private void |
addDecoration(sun.awt.font.Decoration d,
int index)
Add a new Decoration run with the given Decoration at the given index. |
private void |
addFont(Object f,
int index)
Add a new Font/GraphicAttribute run with the given object at the given index. |
private void |
addFonts(char[] chars,
Map attributes,
int start,
int limit)
Resolve the given chars into Fonts using FontResolver, then add font runs for each. |
(package private) static Map |
addInputMethodAttrs(Map oldStyles)
Return a Map with entries from oldStyles, as well as input method entries, if any. |
private static int[] |
addToVector(Object obj,
int index,
Vector v,
int[] starts)
Append the given Object to the given Vector. |
static StyledParagraph |
deleteChar(AttributedCharacterIterator aci,
char[] chars,
int deletePos,
StyledParagraph oldParagraph)
Return a StyledParagraph reflecting the insertion of a single character into the text. |
private static void |
deleteFrom(int deleteAt,
int[] starts,
int numStarts)
Adjust indices in starts to reflect a deletion after deleteAt. |
private static int |
findRunContaining(int index,
int[] starts)
Return i such that starts[i] <= index < starts[i+1]. |
sun.awt.font.Decoration |
getDecorationAt(int index)
Return the Decoration in effect at the given index. |
Object |
getFontOrGraphicAt(int index)
Return the Font or GraphicAttribute in effect at the given index. |
private static Object |
getGraphicOrFont(Map attributes)
Extract a GraphicAttribute or Font from the given attributes. |
int |
getRunLimit(int index)
Return the index at which there is a different Font, GraphicAttribute, or Dcoration than at the given index. |
static StyledParagraph |
insertChar(AttributedCharacterIterator aci,
char[] chars,
int insertPos,
StyledParagraph oldParagraph)
Return a StyledParagraph reflecting the insertion of a single character into the text. |
private static void |
insertInto(int pos,
int[] starts,
int numStarts)
Adjust indices in starts to reflect an insertion after pos. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int length
private sun.awt.font.Decoration decoration
private Object font
private Vector decorations
int[] decorationStarts
private Vector fonts
int[] fontStarts
private static int INITIAL_SIZE
| Constructor Detail |
public StyledParagraph(AttributedCharacterIterator aci,
char[] chars)
aci - an iterator over the textchars - the characters extracted from aci| Method Detail |
private static void insertInto(int pos,
int[] starts,
int numStarts)
public static StyledParagraph insertChar(AttributedCharacterIterator aci,
char[] chars,
int insertPos,
StyledParagraph oldParagraph)
aci - an iterator over the text. The text should be the same as the
text used to create (or most recently update) oldParagraph, with
the exception of inserting a single character at insertPos.chars - the characters in aciinsertPos - the index of the new character in acioldParagraph - a StyledParagraph for the text in aci before the
insertion
private static void deleteFrom(int deleteAt,
int[] starts,
int numStarts)
public static StyledParagraph deleteChar(AttributedCharacterIterator aci,
char[] chars,
int deletePos,
StyledParagraph oldParagraph)
aci - an iterator over the text. The text should be the same as the
text used to create (or most recently update) oldParagraph, with
the exception of deleting a single character at deletePos.chars - the characters in acideletePos - the index where a character was removedoldParagraph - a StyledParagraph for the text in aci before the
insertionpublic int getRunLimit(int index)
index - a valid index in the paragraph
public sun.awt.font.Decoration getDecorationAt(int index)
index - a valid index in the paragraph
public Object getFontOrGraphicAt(int index)
index - a valid index in the paragraph
private static int findRunContaining(int index,
int[] starts)
private static int[] addToVector(Object obj,
int index,
Vector v,
int[] starts)
private void addDecoration(sun.awt.font.Decoration d,
int index)
private void addFont(Object f,
int index)
private void addFonts(char[] chars,
Map attributes,
int start,
int limit)
static Map addInputMethodAttrs(Map oldStyles)
private static Object getGraphicOrFont(Map attributes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||