API  1.0.0
CPArrayController Class Reference

#import <CPArrayController.h>

+ Inheritance diagram for CPArrayController:

Instance Methods

(void) - add:
 
(void) - addObject:
 
(void) - addObjects:
 
(BOOL) - alwaysUsesMultipleValuesMarker
 
(id) - arrangedObjects
 
(CPArray) - arrangeObjects:
 
(BOOL) - automaticallyRearrangesObjects
 
(BOOL) - avoidsEmptySelection
 
(void) - awakeFromCib
 
(BOOL) - canInsert
 
(BOOL) - canSelectNext
 
(BOOL) - canSelectPrevious
 
(BOOL) - clearsFilterPredicateOnInsertion
 
(id) - contentArray
 
(id) - contentSet
 
(void) - encodeWithCoder:
 
(CPPredicate) - filterPredicate
 
(id) - init
 
(id) - initWithCoder:
 
(void) - insert:
 
(void) - insertObject:atArrangedObjectIndex:
 
(void) - prepareContent
 
(BOOL) - preservesSelection
 
(void) - rearrangeObjects
 
(void) - remove:
 
(void) - removeObject:
 
(void) - removeObjectAtArrangedObjectIndex:
 
(void) - removeObjects:
 
(void) - removeObjectsAtArrangedObjectIndexes:
 
(CPArray) - selectedObjects
 
(unsigned) - selectionIndex
 
(CPIndexSet- selectionIndexes
 
(void) - selectNext:
 
(void) - selectPrevious:
 
(BOOL) - selectsInsertedObjects
 
(void) - setAlwaysUsesMultipleValuesMarker:
 
(void) - setAutomaticallyRearrangesObjects:
 
(void) - setAvoidsEmptySelection:
 
(void) - setClearsFilterPredicateOnInsertion:
 
(void) - setContent:
 
(void) - setFilterPredicate:
 
(void) - setPreservesSelection:
 
(BOOL) - setSelectedObjects:
 
(BOOL) - setSelectionIndex:
 
(BOOL) - setSelectionIndexes:
 
(void) - setSelectsInsertedObjects:
 
(void) - setSortDescriptors:
 
(CPArray) - sortDescriptors
 
- Instance Methods inherited from CPObjectController
(void) - addObserver:forKeyPath:options:context:
 
(BOOL) - automaticallyPreparesContent
 
(BOOL) - canAdd
 
(BOOL) - canRemove
 
(id) - content
 
(CPString- entityName
 
(CPPredicate) - fetchPredicate
 
(id) - initWithContent:
 
(BOOL) - isEditable
 
(id) - newObject
 
(Class) - objectClass
 
(id) - observedKeys
 
(void) - removeObserver:forKeyPath:
 
(id) - selection
 
(void) - setAutomaticallyPreparesContent:
 
(void) - setEditable:
 
(void) - setEntityName:
 
(void) - setFetchPredicate:
 
(void) - setObjectClass:
 
(void) - setUsesLazyFetching:
 
(BOOL) - usesLazyFetching
 
- Instance Methods inherited from CPController
(BOOL) - commitEditing
 
(void) - discardEditing
 
(BOOL) - isEditing
 
(void) - objectDidBeginEditing:
 
(void) - objectDidEndEditing:
 
- Instance Methods inherited from CPObject
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(void) + initialize
 
(CPSet) + keyPathsForValuesAffectingArrangedObjects
 
(CPSet) + keyPathsForValuesAffectingCanRemove
 
(CPSet) + keyPathsForValuesAffectingCanSelectNext
 
(CPSet) + keyPathsForValuesAffectingCanSelectPrevious
 
(CPSet) + keyPathsForValuesAffectingContentArray
 
(CPSet) + keyPathsForValuesAffectingSelectedObjects
 
(CPSet) + keyPathsForValuesAffectingSelection
 
(CPSet) + keyPathsForValuesAffectingSelectionIndex
 
(CPSet) + keyPathsForValuesAffectingSelectionIndexes
 
- Class Methods inherited from CPObjectController
(BOOL) + automaticallyNotifiesObserversForKey:
 
(CPSet) + keyPathsForValuesAffectingCanAdd
 
(CPSet) + keyPathsForValuesAffectingCanInsert
 
(CPSet) + keyPathsForValuesAffectingContentObject
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

CPArrayController is a bindings compatible class that manages an array. CPArrayController also provides selection management and sorting capabilities.

Definition at line 2 of file CPArrayController.h.

Method Documentation

◆ add:()

- (void) add: (id)  sender
implementation

Creates and adds a new object to the receiver's content and arranged objects.

Parameters
idsender - The sender of the message.

Reimplemented from CPObjectController.

Definition at line 906 of file CPArrayController.j.

◆ addObject:()

- (void) addObject: (id)  object
implementation

Adds object to the receiver's content collection and the arranged objects array.

Parameters
idanObject - the object to add the controller.

Reimplemented from CPObjectController.

Definition at line 736 of file CPArrayController.j.

◆ addObjects:()

- (void) addObjects: (CPArray)  objects
implementation

Adds an array of objects to the controller's collection.

Parameters
CPArrayanArray - The array of objects to add to the collection.

Definition at line 1013 of file CPArrayController.j.

◆ alwaysUsesMultipleValuesMarker()

- (BOOL) alwaysUsesMultipleValuesMarker
implementation

Whether the receiver will always return the multiple values marker when multiple items are selected, even if the items have the same value.

Returns
BOOL YES if the receiver always uses the multiple values marker

Returns a BOOL indicating whether the receiver always returns the multiple values marker when multiple objects are selected.

Returns
BOOL YES is the controller always uses multiple value markers, otherwise NO.

Definition at line 223 of file CPArrayController.j.

◆ arrangedObjects()

- (id) arrangedObjects
implementation

Returns an array of the controller's objects sorted and filtered.

Returns
- array of objects

Definition at line 440 of file CPArrayController.j.

◆ arrangeObjects:()

- (CPArray) arrangeObjects: (CPArray)  objects
implementation

Sorts and filters a given array and returns it.

Parameters
CPArrayanArray - an array of objects.
Returns
CPArray - the array of sorted objects.

Definition at line 370 of file CPArrayController.j.

◆ automaticallyRearrangesObjects()

- (BOOL) automaticallyRearrangesObjects
implementation

Whether the receiver will rearrange its contents automatically whenever the sort descriptors or filter predicates are changed.

NOTE: not yet implemented. Cappuccino always act as if this value was YES.

Returns
BOOL YES if the receiver will automatically rearrange its content on new sort descriptors or filter predicates

Definition at line 248 of file CPArrayController.j.

◆ avoidsEmptySelection()

- (BOOL) avoidsEmptySelection
implementation
Returns
BOOL - YES if the controller should try to avoid an empty selection otherwise NO.

Definition at line 183 of file CPArrayController.j.

◆ awakeFromCib()

- (void) awakeFromCib
implementation

Reimplemented from CPObjectController.

Provided by category CPArrayController(CPCoding).

Definition at line 1233 of file CPArrayController.j.

◆ canInsert()

- (BOOL) canInsert
implementation

Returns a BOOL indicating whether an object can be inserted into the controller's collection.

Returns
BOOL - YES if an object can be inserted, otherwise NO.

Definition at line 1084 of file CPArrayController.j.

◆ canSelectNext()

- (BOOL) canSelectNext
implementation

Returns YES if the next object, relative to the current selection, in the controller's content array can be selected.

Returns
BOOL - YES if the object can be selected, otherwise NO.

Definition at line 712 of file CPArrayController.j.

◆ canSelectPrevious()

- (BOOL) canSelectPrevious
implementation

Returns YES if the previous object, relative to the current selection, in the controller's content array can be selected.

Returns
BOOL - YES if the object can be selected, otherwise NO.

Definition at line 690 of file CPArrayController.j.

◆ clearsFilterPredicateOnInsertion()

- (BOOL) clearsFilterPredicateOnInsertion
implementation

Whether the receiver will clear its filter predicate when a new object is inserted.

Returns
BOOL YES if the receiver clears filter predicates on insert

Definition at line 202 of file CPArrayController.j.

◆ contentArray()

- (id) contentArray
implementation

Returns the content array of the controller.

Returns
id the content array of the receiver

Definition at line 349 of file CPArrayController.j.

◆ contentSet()

- (id) contentSet
implementation

Returns the content of the receiver as a CPSet.

Returns
id - the content of the controller as a set.

Definition at line 359 of file CPArrayController.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Reimplemented from CPObjectController.

Reimplemented in CPDictionaryController.

Provided by category CPArrayController(CPCoding).

Definition at line 1220 of file CPArrayController.j.

◆ filterPredicate()

- (CPPredicate) filterPredicate
implementation

Returns the predicate used by the controller to filter the contents of the receiver. If no predicate is set nil is returned.

Returns
CPPredicate the predicate used by the controller

Definition at line 476 of file CPArrayController.j.

◆ init()

- (id) init
implementation

Reimplemented from CPObjectController.

Reimplemented in CPDictionaryController.

Definition at line 111 of file CPArrayController.j.

◆ initialize()

+ (void) initialize
implementation

Reimplemented from CPObjectController.

Definition at line 52 of file CPArrayController.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Reimplemented from CPObjectController.

Reimplemented in CPDictionaryController.

Provided by category CPArrayController(CPCoding).

Definition at line 1196 of file CPArrayController.j.

◆ insert:()

- (void) insert: (id)  sender
implementation

Creates a new object and inserts it into the receiver's content array.

Parameters
idsender - The sender of the message.

Definition at line 920 of file CPArrayController.j.

◆ insertObject:atArrangedObjectIndex:()

- (void) insertObject: (id)  anObject
atArrangedObjectIndex: (int)  anIndex 
implementation

Adds an object at a given index in the receiver's arrangedObjects. Also add the object to the content collection (although at the end rather than the given index).

Parameters
idanObject - The object to add to the collection.
intanIndex - The index to insert the object at.

Definition at line 812 of file CPArrayController.j.

◆ keyPathsForValuesAffectingArrangedObjects()

+ (CPSet) keyPathsForValuesAffectingArrangedObjects
implementation

Definition at line 66 of file CPArrayController.j.

◆ keyPathsForValuesAffectingCanRemove()

+ (CPSet) keyPathsForValuesAffectingCanRemove
implementation

Reimplemented from CPObjectController.

Definition at line 95 of file CPArrayController.j.

◆ keyPathsForValuesAffectingCanSelectNext()

+ (CPSet) keyPathsForValuesAffectingCanSelectNext
implementation

Definition at line 100 of file CPArrayController.j.

◆ keyPathsForValuesAffectingCanSelectPrevious()

+ (CPSet) keyPathsForValuesAffectingCanSelectPrevious
implementation

Definition at line 105 of file CPArrayController.j.

◆ keyPathsForValuesAffectingContentArray()

+ (CPSet) keyPathsForValuesAffectingContentArray
implementation

Definition at line 61 of file CPArrayController.j.

◆ keyPathsForValuesAffectingSelectedObjects()

+ (CPSet) keyPathsForValuesAffectingSelectedObjects
implementation

Definition at line 89 of file CPArrayController.j.

◆ keyPathsForValuesAffectingSelection()

+ (CPSet) keyPathsForValuesAffectingSelection
implementation

Definition at line 72 of file CPArrayController.j.

◆ keyPathsForValuesAffectingSelectionIndex()

+ (CPSet) keyPathsForValuesAffectingSelectionIndex
implementation

Definition at line 77 of file CPArrayController.j.

◆ keyPathsForValuesAffectingSelectionIndexes()

+ (CPSet) keyPathsForValuesAffectingSelectionIndexes
implementation

Definition at line 82 of file CPArrayController.j.

◆ prepareContent()

- (void) prepareContent
implementation

Overridden by a subclass that require control over the creation of new objects.

Reimplemented from CPObjectController.

Definition at line 140 of file CPArrayController.j.

◆ preservesSelection()

- (BOOL) preservesSelection
implementation

Returns YES if the selection should try to be preserved when the content changes, otherwise NO.

Returns
BOOL YES if the selection is preserved, otherwise NO.

Definition at line 148 of file CPArrayController.j.

◆ rearrangeObjects()

- (void) rearrangeObjects
implementation

Triggers the filtering of the objects in the controller.

Definition at line 392 of file CPArrayController.j.

◆ remove:()

- (void) remove: (id)  sender
implementation

Removes the controller's selected objects from the controller's collection.

Parameters
idsender - The sender of the message.

Reimplemented from CPObjectController.

Definition at line 938 of file CPArrayController.j.

◆ removeObject:()

- (void) removeObject: (id)  object
implementation

Removes a given object from the receiver's collection.

Parameters
idanObject - The object to remove from the collection.

Reimplemented from CPObjectController.

Definition at line 872 of file CPArrayController.j.

◆ removeObjectAtArrangedObjectIndex:()

- (void) removeObjectAtArrangedObjectIndex: (int)  index
implementation

Removes the object at the specified index in the controller's arranged objects from the content array.

Parameters
intindex - index of the object to remove.

Definition at line 947 of file CPArrayController.j.

◆ removeObjects:()

- (void) removeObjects: (CPArray)  objects
implementation

Removes an array of objects from the collection.

Parameters
CPArrayanArray - The array of objects to remove

Definition at line 1033 of file CPArrayController.j.

◆ removeObjectsAtArrangedObjectIndexes:()

- (void) removeObjectsAtArrangedObjectIndexes: (CPIndexSet anIndexSet
implementation

Removes the objects at the specified indexes in the controller's arranged objects from the content array.

Parameters
CPIndexSetindexes - indexes of the objects to remove.

Definition at line 956 of file CPArrayController.j.

◆ selectedObjects()

- (CPArray) selectedObjects
implementation

Returns an array of the selected objects.

Returns
CPArray - the selected objects.

Reimplemented from CPObjectController.

Definition at line 632 of file CPArrayController.j.

◆ selectionIndex()

- (unsigned) selectionIndex
implementation

Returns the index of the first object in the controller's selection.

Returns
unsigned - Index of the first selected object.

Definition at line 527 of file CPArrayController.j.

◆ selectionIndexes()

- (CPIndexSet) selectionIndexes
implementation

Returns an index set of the selected indexes.

Returns
CPIndexSet - The selected indexes.

Definition at line 548 of file CPArrayController.j.

◆ selectNext:()

- (void) selectNext: (id)  sender
implementation

Selects the next object, relative to the current selection, in the controllers arranged content.

Parameters
idsender - the sender of the message.

Definition at line 721 of file CPArrayController.j.

◆ selectPrevious:()

- (void) selectPrevious: (id)  sender
implementation

Selects the previous object, relative to the current selection, in the controllers arranged content.

Parameters
idsender - the sender of the message.

Definition at line 699 of file CPArrayController.j.

◆ selectsInsertedObjects()

- (BOOL) selectsInsertedObjects
implementation
Returns
BOOL - Returns YES if new objects are automatically selected, otherwise NO.

Definition at line 166 of file CPArrayController.j.

◆ setAlwaysUsesMultipleValuesMarker:()

- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)  aFlag
implementation

Sets whether the receiver should always return the multiple values marker when multiple items are selected, even if the items have the same value.

Parameters
BOOLaFlag YES if the receiver should always use the multiple values marker

Definition at line 234 of file CPArrayController.j.

◆ setAutomaticallyRearrangesObjects:()

- (void) setAutomaticallyRearrangesObjects: (BOOL)  aFlag
implementation

Sets whether the receiver should rearrange its contents automatically whenever the sort descriptors or filter predicates are changed.

NOTE: not yet implemented. Cappuccino always act as if this value was YES.

Parameters
BOOLYES if the receiver should automatically rearrange its content on new sort descriptors or filter predicates

Definition at line 262 of file CPArrayController.j.

◆ setAvoidsEmptySelection:()

- (void) setAvoidsEmptySelection: (BOOL)  value
implementation

Sets whether the controller should try to avoid an empty selection.

Parameters
BOOLaFlag - YES if the receiver should attempt to avoid an empty selection, otherwise NO.

Definition at line 192 of file CPArrayController.j.

◆ setClearsFilterPredicateOnInsertion:()

- (void) setClearsFilterPredicateOnInsertion: (BOOL)  aFlag
implementation

Sets whether the receiver should clear its filter predicate when a new object is inserted.

Parameters
BOOLYES if the receiver should clear filter predicates on insert

Definition at line 212 of file CPArrayController.j.

◆ setContent:()

- (void) setContent: (id)  value
implementation

Sets the controller's content object.

Parameters
idvalue - the content object of the controller.

Reimplemented from CPObjectController.

Definition at line 272 of file CPArrayController.j.

◆ setFilterPredicate:()

- (void) setFilterPredicate: (CPPredicate)  value
implementation

Sets the predicate for the controller to filter the content. Passing nil will remove an existing prediate.

Parameters
CPPrediateaPredicate - the new predicate.

Definition at line 487 of file CPArrayController.j.

◆ setPreservesSelection:()

- (void) setPreservesSelection: (BOOL)  value
implementation

Sets whether the selection is kept when the content changes.

Parameters
BOOLaFlag - YES if the selection should be kept, otherwise NO.

Definition at line 158 of file CPArrayController.j.

◆ setSelectedObjects:()

- (BOOL) setSelectedObjects: (CPArray)  objects
implementation

Sets the selected objects of the controller.

Parameters
CPArrayanArray - the objects to select
Returns
BOOL - Returns YES if the selection was changed, otherwise NO.

Definition at line 645 of file CPArrayController.j.

◆ setSelectionIndex:()

- (BOOL) setSelectionIndex: (unsigned)  index
implementation

Sets the selected index

Parameters
unsignedanIndex - the new index to select
Returns
BOOL - Returns YES if the selection was changed, otherwise NO.

Definition at line 538 of file CPArrayController.j.

◆ setSelectionIndexes:()

- (BOOL) setSelectionIndexes: (CPIndexSet indexes
implementation

Sets the selection indexes of the controller.

Parameters
CPIndexSetindexes - the indexes to select
Returns
BOOL - Returns YES if the selection changed, otherwise NO.

Definition at line 559 of file CPArrayController.j.

◆ setSelectsInsertedObjects:()

- (void) setSelectsInsertedObjects: (BOOL)  value
implementation

Sets whether the controller will automatically select objects as they are inserted.

Returns
BOOL - YES if new objects are selected, otherwise NO.

Definition at line 175 of file CPArrayController.j.

◆ setSortDescriptors:()

- (void) setSortDescriptors: (CPArray)  value
implementation

Sets the sort descriptors for the controller.

Parameters
CPArraydescriptors - the new sort descriptors.

Definition at line 459 of file CPArrayController.j.

◆ sortDescriptors()

- (CPArray) sortDescriptors
implementation

Returns the receiver's array of sort descriptors.

Returns
CPArray an array of sort descriptors

Definition at line 449 of file CPArrayController.j.


The documentation for this class was generated from the following files: