java.text
Class CharacterIteratorFieldDelegate

java.lang.Object
  extended byjava.text.CharacterIteratorFieldDelegate
All Implemented Interfaces:
Format.FieldDelegate

class CharacterIteratorFieldDelegate
extends Object
implements Format.FieldDelegate

CharacterIteratorFieldDelegate combines the notifications from a Format into a resulting AttributedCharacterIterator. The resulting AttributedCharacterIterator can be retrieved by way of the getIterator method.


Field Summary
private  ArrayList attributedStrings
          Array of AttributeStrings.
private  int size
          Running count of the number of characters that have been encountered.
 
Constructor Summary
(package private) CharacterIteratorFieldDelegate()
           
 
Method Summary
 void formatted(Format.Field attr, Object value, int start, int end, StringBuffer buffer)
          Notified when a particular region of the String is formatted.
 void formatted(int fieldID, Format.Field attr, Object value, int start, int end, StringBuffer buffer)
          Notified when a particular region of the String is formatted.
 AttributedCharacterIterator getIterator(String string)
          Returns an AttributedCharacterIterator that can be used to iterate over the resulting formatted String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributedStrings

private ArrayList attributedStrings
Array of AttributeStrings. Whenever formatted is invoked for a region > size, a new instance of AttributedString is added to attributedStrings. Subsequent invocations of formatted for existing regions result in invoking addAttribute on the existing AttributedStrings.


size

private int size
Running count of the number of characters that have been encountered.

Constructor Detail

CharacterIteratorFieldDelegate

CharacterIteratorFieldDelegate()
Method Detail

formatted

public void formatted(Format.Field attr,
                      Object value,
                      int start,
                      int end,
                      StringBuffer buffer)
Description copied from interface: Format.FieldDelegate
Notified when a particular region of the String is formatted. This method will be invoked if there is no corresponding integer field id matching attr.

Specified by:
formatted in interface Format.FieldDelegate
Parameters:
attr - Identifies the field matched
value - Value associated with the field
start - Beginning location of the field, will be >= 0
end - End of the field, will be >= start and <= buffer.length()
buffer - Contains current formatted value, receiver should NOT modify it.

formatted

public void formatted(int fieldID,
                      Format.Field attr,
                      Object value,
                      int start,
                      int end,
                      StringBuffer buffer)
Description copied from interface: Format.FieldDelegate
Notified when a particular region of the String is formatted.

Specified by:
formatted in interface Format.FieldDelegate
Parameters:
fieldID - Identifies the field by integer
attr - Identifies the field matched
value - Value associated with the field
start - Beginning location of the field, will be >= 0
end - End of the field, will be >= start and <= buffer.length()
buffer - Contains current formatted value, receiver should NOT modify it.

getIterator

public AttributedCharacterIterator getIterator(String string)
Returns an AttributedCharacterIterator that can be used to iterate over the resulting formatted String.