PATH  Documentation > Mac OS X > Foundation Reference: Java



Table of Contents

NSMutableAttributedString


Inherits from:
NSAttributedString : NSObject
Package:
com.apple.yellow.foundation


Class Description


NSMutableAttributedString declares the programmatic interface to objects that manage mutable attributed strings. You can add and remove characters (raw strings) and attributes separately, or together as attributed strings. See NSAttributedString's class description for more information about attributed strings.

When working with the Application Kit, you must also clean up changed attributes using the various fix... methods. See the Application Kit's specification for this class cluster for more information on fixing attributes.

NSMutableAttributedString adds two primitive methods to those of NSAttributedString. These primitive methods provide the basis for all the other methods in its class. The primitive replaceCharactersInRange method replaces a range of characters with those from a string, leaving all attribute information outside that range intact. The primitive setAttributesInRange method sets attributes and values for a given range of characters, replacing any previous attributes and values for that range.




Method Types


Constructors
NSMutableAttributedString
Retrieving character information
mutableStringReference
Changing characters
deleteCharactersInRange:
Changing attributes
setAttributesInRange
addAttributeInRange
addAttributesInRange
removeAttributeInRange
Changing characters and attributes
appendAttributedString:
applyFontTraitsInRange
fixAttachmentAttributeInRange
fixAttributesInRange
fixFontAttributeInRange
fixParagraphStyleAttributeInRange
insertAttributedStringAtIndex
replaceCharactersInRange
setAlignmentInRange
setAttributedString
subscriptRange
superscriptRange
unscriptRange
updateAttachmentsFromPath
Grouping changes
beginEditing
endEditing


Constructors



NSMutableAttributedString

public NSMutableAttributedString()

Description forthcoming.

public NSMutableAttributedString(NSAttributedString anAttributedString)

Description forthcoming.

public NSMutableAttributedString( NSData aData, NSMutableDictionary aMutableDictionary)

Description forthcoming.

public NSMutableAttributedString( NSData aData, Object anObject, NSMutableDictionary aMutableDictionary)

Description forthcoming.

public NSMutableAttributedString( Object anObject, NSMutableDictionary aMutableDictionary)

Description forthcoming.

public NSMutableAttributedString(String aString)

Description forthcoming.

public NSMutableAttributedString( String aString, NSDictionary aDictionary)

Description forthcoming.

public NSMutableAttributedString( java.net.URL anURL, NSMutableDictionary aMutableDictionary)

Description forthcoming.


Instance Methods



addAttributeInRange

public void addAttributeInRange( String name, Object value, NSRange aRange)

Adds an attribute with the given name and value to the characters in aRange. Throws an InvalidArgumentException if name or value is null, and a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: addAttributesInRange, removeAttributeInRange



addAttributesInRange

public void addAttributesInRange( NSDictionary attributes, NSRange aRange)

Adds the collection of attributes in attributes to the characters in aRange. Throws an InvalidArgumentException if attributes is null and a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: addAttributeInRange, removeAttributeInRange



appendAttributedString:

public void appendAttributedString(NSAttributedString attributedString)

Adds the characters and attributes of attributedString to the end of the receiver.

See Also: insertAttributedStringAtIndex



applyFontTraitsInRange

public void applyFontTraitsInRange( int anInt, NSRange aRange)

Description forthcoming.

beginEditing

public void beginEditing()

Overridden by subclasses to buffer or optimize a series of changes to the receiver's characters or attributes, until it receives a matching endEditing message, upon which it can consolidate changes and notify any observers that it has changed. You can nest pairs of beginEditing and endEditing messages.

deleteCharactersInRange:

public void deleteCharactersInRange(NSRange aRange)

Deletes the characters in aRange along with their associated attributes. Throws a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: replaceCharactersInRange



endEditing

public void endEditing()

Overridden by subclasses to consolidate changes made since a previous beginEditing message and to notify any observers of the changes. NSMutableAttributedString's implementation does nothing. NSTextStorage, for example, overrides this method to invoke fixAttributesInRange and to inform its NSLayoutManagers that they need to re-lay the text.

See Also: - processEditing (NSTextStorage class in the Application Kit)



fixAttachmentAttributeInRange

public void fixAttachmentAttributeInRange(NSRange aRange)

Description forthcoming.

fixAttributesInRange

public void fixAttributesInRange(NSRange aRange)

Description forthcoming.

fixFontAttributeInRange

public void fixFontAttributeInRange(NSRange aRange)

Description forthcoming.

fixParagraphStyleAttributeInRange

public void fixParagraphStyleAttributeInRange(NSRange aRange)

Description forthcoming.

insertAttributedStringAtIndex

public void insertAttributedStringAtIndex( NSAttributedString attributedString, int index)

Inserts the characters and attributes of attributedString into the receiver, so the new characters and attributes begin at index and the existing characters and attributes from index to the end are shifted by the length of attributedString. Throws a RangeException if index lies beyond the end of the receiver's characters.

See Also: appendAttributedString:



mutableStringReference

public NSMutableStringReference mutableStringReference()

Returns the character contents of the receiver as an NSMutableStringReference object. The receiver tracks changes to this string and keeps its attribute mappings up to date.

removeAttributeInRange

public void removeAttributeInRange( String name, NSRange aRange)

Removes the attribute named name from the characters in aRange. Throws a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: addAttributeInRange, addAttributesInRange



replaceCharactersInRange

public void replaceCharactersInRange( NSRange aRange, NSAttributedString attributedString)

Replaces the characters and attributes in aRange with the characters and attributes of attributedString. Throws a RangeException if any part of aRange lies beyond the end of the receiver's characters.

public void replaceCharactersInRange( NSRange aRange, String aString)

Replaces the characters in aRange with the characters of aString. The new characters inherit the attributes of the first replaced character from aRange. Where the length of aRange is zero, the new characters inherit the attributes of the character preceding aRange if it has any, otherwise of the character following aRange.

Throws a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: insertAttributedStringAtIndex, deleteCharactersInRange:



setAlignmentInRange

public void setAlignmentInRange( int anInt, NSRange aRange)

Description forthcoming.

setAttributedString

public void setAttributedString(NSAttributedString attributedString)

Replaces the receiver's entire contents with the characters and attributes of attributedString.

See Also: appendAttributedString:



setAttributesInRange

public void setAttributesInRange( NSDictionary attributes, NSRange aRange)

Sets the attributes for the characters in aRange to attributes. These new attributes replace any attributes previously associated with the characters in aRange. Throws a RangeException if any part of aRange lies beyond the end of the receiver's characters.

See Also: addAttributesInRange, removeAttributeInRange



subscriptRange

public void subscriptRange(NSRange aRange)

Description forthcoming.

superscriptRange

public void superscriptRange(NSRange aRange)

Description forthcoming.

unscriptRange

public void unscriptRange(NSRange aRange)

Description forthcoming.

updateAttachmentsFromPath

public void updateAttachmentsFromPath(String aString)

Description forthcoming.


Table of Contents