Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.text
Class AttributedString  view AttributedString download AttributedString.java

java.lang.Object
  extended byjava.text.AttributedString

public class AttributedString
extends java.lang.Object

This class models a String with attributes over various subranges of the string. It allows applications to access this information via the AttributedCharacterIterator interface.


Nested Class Summary
(package private)  class AttributedString.AttributeRange
          The attributes and ranges of text over which those attributes apply.
 
Field Summary
private  AttributedString.AttributeRange[] attribs
          The attribute information
private  StringCharacterIterator sci
          The string we are representing.
 
Constructor Summary
AttributedString(AttributedCharacterIterator aci)
          Initializes a new instance of AttributedString that will use the text and attribute information from the specified AttributedCharacterIterator.
AttributedString(AttributedCharacterIterator aci, int begin_index, int end_index)
          Initializes a new instance of AttributedString that will use the text and attribute information from the specified subrange of the specified AttributedCharacterIterator.
AttributedString(AttributedCharacterIterator aci, int begin, int end, AttributedCharacterIterator.Attribute[] attributes)
          Initializes a new instance of AttributedString that will use the text and attribute information from the specified subrange of the specified AttributedCharacterIterator.
AttributedString(java.lang.String str)
          Creates a new instance of AttributedString that represents the specified String with no attributes.
AttributedString(java.lang.String str, java.util.Map attributes)
          Creates a new instance of AttributedString that represents that specified String with the specified attributes over the entire length of the String.
 
Method Summary
 void addAttribute(AttributedCharacterIterator.Attribute attrib, java.lang.Object value)
          Adds a new attribute that will cover the entire string.
 void addAttribute(AttributedCharacterIterator.Attribute attrib, java.lang.Object value, int begin, int end)
          Adds a new attribute that will cover the specified subrange of the string.
 void addAttributes(java.util.Map attributes, int begin_index, int end_index)
          Adds all of the attributes in the specified list to the specified subrange of the string.
 AttributedCharacterIterator getIterator()
          Returns an AttributedCharacterIterator that will iterate over the entire string.
 AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes)
          Returns an AttributedCharacterIterator that will iterate over the entire string.
 AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes, int begin_index, int end_index)
          Returns an AttributedCharacterIterator that will iterate over the specified subrange.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sci

private StringCharacterIterator sci
The string we are representing.


attribs

private AttributedString.AttributeRange[] attribs
The attribute information

Constructor Detail

AttributedString

public AttributedString(java.lang.String str)
Creates a new instance of AttributedString that represents the specified String with no attributes.


AttributedString

public AttributedString(java.lang.String str,
                        java.util.Map attributes)
Creates a new instance of AttributedString that represents that specified String with the specified attributes over the entire length of the String.


AttributedString

public AttributedString(AttributedCharacterIterator aci)
Initializes a new instance of AttributedString that will use the text and attribute information from the specified AttributedCharacterIterator.


AttributedString

public AttributedString(AttributedCharacterIterator aci,
                        int begin_index,
                        int end_index)
Initializes a new instance of AttributedString that will use the text and attribute information from the specified subrange of the specified AttributedCharacterIterator.


AttributedString

public AttributedString(AttributedCharacterIterator aci,
                        int begin,
                        int end,
                        AttributedCharacterIterator.Attribute[] attributes)
Initializes a new instance of AttributedString that will use the text and attribute information from the specified subrange of the specified AttributedCharacterIterator. Only attributes from the source iterator that are present in the specified array of attributes will be included in the attribute list for this object.

Method Detail

addAttribute

public void addAttribute(AttributedCharacterIterator.Attribute attrib,
                         java.lang.Object value)
Adds a new attribute that will cover the entire string.


addAttribute

public void addAttribute(AttributedCharacterIterator.Attribute attrib,
                         java.lang.Object value,
                         int begin,
                         int end)
Adds a new attribute that will cover the specified subrange of the string.


addAttributes

public void addAttributes(java.util.Map attributes,
                          int begin_index,
                          int end_index)
Adds all of the attributes in the specified list to the specified subrange of the string.


getIterator

public AttributedCharacterIterator getIterator()
Returns an AttributedCharacterIterator that will iterate over the entire string.


getIterator

public AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes)
Returns an AttributedCharacterIterator that will iterate over the entire string. This iterator will return information about the list of attributes in the specified array. Attributes not in the array may or may not be returned by the iterator. If the specified array is null, all attributes will be returned.


getIterator

public AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[] attributes,
                                               int begin_index,
                                               int end_index)
Returns an AttributedCharacterIterator that will iterate over the specified subrange. This iterator will return information about the list of attributes in the specified array. Attributes not in the array may or may not be returned by the iterator. If the specified array is null, all attributes will be returned.