COCommandGroup class documentation
COCommandGroup : NSObject <COTrackNode, ETCollection, NSCopying>Overview
See COCommand for a detailed presentation.
Basic Properties
- - (COUndoTrack *) parentUndoTrack
The undo track on which the command was recorded.
Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .
- - (void) setParentUndoTrack: (COUndoTrack *)parentUndoTrack
The undo track on which the command was recorded.
Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .
- - (ETUUID *) UUID
The commit UUID.
Allows an in-memory instance to be unambiguously mapped to a row in the SQL database behind COUndoTrack. Generated when the command is created, persists across reads and writes to the database, but not preserved across calls to -inverse .
- - (void) setUUID: (ETUUID *)UUID
The commit UUID.
Allows an in-memory instance to be unambiguously mapped to a row in the SQL database behind COUndoTrack. Generated when the command is created, persists across reads and writes to the database, but not preserved across calls to -inverse .
- - (COCommitDescriptor *) commitDescriptor
The commit descriptor matching the commit identifier in -metadata.
COCommand overrides -localizedTypeDescription and -localizedShortDescription to return the equivalent commit descriptor descriptions.
- - (ETUUID *) parentUUID
The UUID of the parent command.
The parent command is the command upon on this one is based, it is not necessarily the previous command by -sequenceNumber .
An Undo track can contain divergences that look like "branches" in the Undo history. After an undo, any new commit makes the Undo track diverges. At this point, the last undo and the previously created commands that follow it, don't appear in the Undo track unless divergent commands are explicitly shown.
The first command in a track is always a non-persistent COEndOfUndoTrackPlaceholderNode instance; its parent UUID is nil. The first persistent commands in a track have a parent UUID equal to [[COEndOfUndoTrackPlaceholderNode sharedInstance] UUID].
- - (void) setParentUUID: (ETUUID *)parentUUID
The UUID of the parent command.
The parent command is the command upon on this one is based, it is not necessarily the previous command by -sequenceNumber .
An Undo track can contain divergences that look like "branches" in the Undo history. After an undo, any new commit makes the Undo track diverges. At this point, the last undo and the previously created commands that follow it, don't appear in the Undo track unless divergent commands are explicitly shown.
The first command in a track is always a non-persistent COEndOfUndoTrackPlaceholderNode instance; its parent UUID is nil. The first persistent commands in a track have a parent UUID equal to [[COEndOfUndoTrackPlaceholderNode sharedInstance] UUID].
- - (id <COTrackNode>) parentNode
The parent command, see -parentUUID .
Returns [COEndOfUndoTrackPlaceholderNode sharedInstance] for the first COCommandGroup(s) on a track.
- - (id <COTrackNode>) mergeParentNode
Returns nil.
Applying and Reverting Changes
- - (COCommandGroup *) inverse
Returns a command that represents an inverse action.
You can use the inverse to unapply the receiver changes in an editing context.
[[command inverse] inverse] must be equal [command inverse].
- - (BOOL) canApplyToContext: (COEditingContext *)aContext
Returns whether the receiver changes can be applied to the editing context.
- - (void) applyToContext: (COEditingContext *)aContext
Applies the receiver changes to the editing context.
- - (void) addToStoreTransaction: (COStoreTransaction *)txn withRevisionMetadata: (NSDictionary *)metadata assumingEditingContextState: (COEditingContext *)ctx
Applies the receiver changes directly to a store transaction.
Framework Private
- - (instancetype) initWithSerializedCommand: (COUndoTrackSerializedCommand *)aCommand owner: (COUndoTrack *)anOwner
Initializes a command group from a serialized represention and with a parent undo track.