Currently, this class is optimized for a small number of intervals (preferably 1).
| Modifier and Type | Field and Description |
|---|---|
| private Decoration | |
| private Vector | |
| pack-priv int[] | |
| private Object | |
| private Vector | |
| pack-priv int[] | |
| private static int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | StyledParagraph(AttributedCharacterIterator
an iterator over the text aci, char[] the characters extracted from aci chars)Create a new StyledParagraph over the given styled text. |
| Modifier and Type | Method and Description |
|---|---|
| private void | addDecoration(Decoration d, int index)
Add a new Decoration run with the given Decoration at the given index. |
| private void | |
| private void | addFonts(char[] chars, Map<? extends AttributedCharacterIterator.
Resolve the given chars into Fonts using FontResolver, then add font runs for each. |
| pack-priv static Map | addInputMethodAttrs(Map<? extends AttributedCharacterIterator.
Return a Map with entries from oldStyles, as well as input method entries, if any. |
| private static int[] | addToVector(Object obj, int index, Vector<E> v, int[] starts)
Append the given Object to the given Vector. |
| public static StyledParagraph | deleteChar(AttributedCharacterIterator
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. aci, char[] the characters in aci chars, int the index where a character was removed deletePos, StyledParagraph a StyledParagraph for the text in aci before the
insertion 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 | |
| public Decoration | Returns: the Decoration at index.a valid index in the paragraph index)Return the Decoration in effect at the given index. |
| public Object | Returns: the Font or GraphicAttribute at index.a valid index in the paragraph index)Return the Font or GraphicAttribute in effect at the given index. |
| private static Object | getGraphicOrFont(Map<? extends AttributedCharacterIterator.
Extract a GraphicAttribute or Font from the given attributes. |
| public int | Returns: the first index where there is a change in attributes from those at indexa valid index in the paragraph index)Return the index at which there is a different Font, GraphicAttribute, or Decoration than at the given index. |
| public static StyledParagraph | insertChar(AttributedCharacterIterator
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. aci, char[] the characters in aci chars, int the index of the new character in aci insertPos, StyledParagraph a StyledParagraph for the text in aci before the
insertion 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. |
| decoration | back to summary |
|---|---|
| private Decoration decoration | |
| decorations | back to summary |
|---|---|
| private Vector<Decoration> decorations | |
| decorationStarts | back to summary |
|---|---|
| pack-priv int[] decorationStarts | |
| font | back to summary |
|---|---|
| private Object font | |
| fonts | back to summary |
|---|---|
| private Vector<Object> fonts | |
| fontStarts | back to summary |
|---|---|
| pack-priv int[] fontStarts | |
| INITIAL_SIZE | back to summary |
|---|---|
| private static int INITIAL_SIZE | |
| length | back to summary |
|---|---|
| private int length | |
| StyledParagraph | back to summary |
|---|---|
| public StyledParagraph(AttributedCharacterIterator aci, char[] chars) Create a new StyledParagraph over the given styled text.
| |
| addDecoration | back to summary |
|---|---|
| private void addDecoration(Decoration d, int index) Add a new Decoration run with the given Decoration at the given index. | |
| addFont | back to summary |
|---|---|
| private void addFont(Object f, int index) Add a new Font/GraphicAttribute run with the given object at the given index. | |
| addFonts | back to summary |
|---|---|
| private void addFonts(char[] chars, Map<? extends AttributedCharacterIterator. Resolve the given chars into Fonts using FontResolver, then add font runs for each. | |
| addInputMethodAttrs | back to summary |
|---|---|
| pack-priv static Map Return a Map with entries from oldStyles, as well as input method entries, if any. | |
| addToVector | back to summary |
|---|---|
| private static int[] addToVector(Object obj, int index, Vector<E> v, int[] starts) Append the given Object to the given Vector. Add the given index to the given starts array. If the starts array does not have room for the index, a new array is created and returned.
| |
| deleteChar | back to summary |
|---|---|
| public static StyledParagraph deleteChar(AttributedCharacterIterator aci, char[] chars, int deletePos, StyledParagraph oldParagraph) Return a StyledParagraph reflecting the insertion of a single character into the text. This method will attempt to reuse the given paragraph, but may create a new paragraph.
| |
| deleteFrom | back to summary |
|---|---|
| private static void deleteFrom(int deleteAt, int[] starts, int numStarts) Adjust indices in starts to reflect a deletion after deleteAt. Any index in starts greater than deleteAt will be increased by 1. It is the caller's responsibility to make sure that no 0-length runs result. | |
| findRunContaining | back to summary |
|---|---|
| private static int findRunContaining(int index, int[] starts) Return i such that starts[i] <= index < starts[i+1]. starts must be in increasing order, with at least one element greater than index. | |
| getDecorationAt | back to summary |
|---|---|
| public Decoration getDecorationAt(int index) Return the Decoration in effect at the given index.
| |
| getFontOrGraphicAt | back to summary |
|---|---|
| public Object getFontOrGraphicAt(int index) Return the Font or GraphicAttribute in effect at the given index. The client must test the type of the return value to determine what it is.
| |
| getGraphicOrFont | back to summary |
|---|---|
| private static Object getGraphicOrFont(Map<? extends AttributedCharacterIterator. Extract a GraphicAttribute or Font from the given attributes. If attributes does not contain a GraphicAttribute, Font, or Font family entry this method returns null. | |
| getRunLimit | back to summary |
|---|---|
| public int getRunLimit(int index) Return the index at which there is a different Font, GraphicAttribute, or Decoration than at the given index.
| |
| insertChar | back to summary |
|---|---|
| public static StyledParagraph insertChar(AttributedCharacterIterator aci, char[] chars, int insertPos, StyledParagraph oldParagraph) Return a StyledParagraph reflecting the insertion of a single character into the text. This method will attempt to reuse the given paragraph, but may create a new paragraph.
| |
| insertInto | back to summary |
|---|---|
| private static void insertInto(int pos, int[] starts, int numStarts) Adjust indices in starts to reflect an insertion after pos. Any index in starts greater than pos will be increased by 1. | |