#import <CPPredicateEditorRowTemplate.h>
Instance Methods | |
Initializing a Template | |
CPPredicateEditorRowTemplate describes available predicates and how to display them. You can create instances of CPPredicateEditorRowTemplate programmatically or in Interface Builder. By default, a non-compound row template has three views: a popup (or static text field) on the left, a popup or static text field for operators, and either a popup or other view on the right. You can subclass CPPredicateEditorRowTemplate to create a row template with different numbers or types of views. CPPredicateEditorRowTemplate is a concrete class, but it has five primitive methods which are called by CPPredicateEditor: -templateViews (CPPredicateEditorRowTemplate), -matchForPredicate: (CPPredicateEditorRowTemplate), -setPredicate: (CPPredicateEditorRowTemplate), -displayableSubpredicatesOfPredicate: (CPPredicateEditorRowTemplate), and -predicateWithSubpredicates: (CPPredicateEditorRowTemplate). CPPredicateEditorRowTemplate implements all of them, but you can override them for custom templates. The primitive methods are used by an instance of CPPredicateEditor as follows. First, an instance of CPPredicateEditor is created, and some row templates are set on it—either through a nib file or programmatically. The first thing predicate editor does is ask each of the templates for their views, using templateViews. After setting up the predicate editor, you typically send it a setObjectValue: (CPControl) message to restore a saved predicate. CPPredicateEditor needs to determine which of its templates should display each predicate in the predicate tree. It does this by sending each of its row templates a matchForPredicate: message and choosing the one that returns the highest value. After finding the best match for a predicate, CPPredicateEditor copies that template to get fresh views, inserts them into the proper row, and then sets the predicate on the template using setPredicate:. Within that method, the CPPredicateEditorRowTemplate object must set its views' values to represent that predicate. CPPredicateEditorRowTemplate next asks the template for the “displayable sub-predicates” of the predicate by sending a -displayableSubpredicatesOfPredicate: (CPPredicateEditorRowTemplate) message. If a template represents a predicate in its entirety, or if the predicate has no subpredicates, it can return nil for this. Otherwise, it should return a list of predicates to be made into sub-rows of that template's row. The whole process repeats for each sub-predicate. At this point, the user sees the predicate that was saved. If the user then makes some changes to the views of the templates, this causes CPPredicateEditor to recompute its predicate by asking each of the templates to return the predicate represented by the new view values, passing in the subpredicates represented by the sub-rows (an empty array if there are none, or nil if they aren't supported by that predicate type). | |
(id) | - initWithLeftExpressions:rightExpressions:modifier:operators:options: |
Initializes and returns a “pop-up-pop-up-pop-up”-style row template. More... | |
(id) | - initWithLeftExpressions:rightExpressionAttributeType:modifier:operators:options: |
Initializes and returns a “pop-up-pop-up-view”-style row template. More... | |
(id) | - initWithCompoundTypes: |
Initializes and returns a row template suitable for displaying compound predicates. More... | |
Primitive Methods | |
(double) | - matchForPredicate: |
Returns a positive number if the receiver can represent a given predicate, and 0 if it cannot. More... | |
(CPArray) | - templateViews |
Returns the views for the receiver. More... | |
(void) | - setPredicate: |
Sets the value of the views according to the given predicate. More... | |
(CPArray) | - displayableSubpredicatesOfPredicate: |
Returns the subpredicates that should be made sub-rows of a given predicate. More... | |
(CPPredicate) | - predicateWithSubpredicates: |
Returns the predicate represented by the receiver’s views' values and the given sub-predicates. More... | |
Information About a Row Template | |
(CPArray) | - leftExpressions |
Returns the left hand expressions for the receiver. More... | |
(CPArray) | - rightExpressions |
Returns the right hand expressions for the receiver. More... | |
(CPArray) | - compoundTypes |
Returns the compound predicate types for the receiver. More... | |
(CPComparisonPredicateModifier) | - modifier |
Returns the comparison predicate modifier for the receiver. More... | |
(CPArray) | - operators |
Returns Returns the array of operators for the receiver. More... | |
(int) | - options |
Returns the comparison predicate options for the receiver. More... | |
(CPAttributeType) | - rightExpressionAttributeType |
Returns the attribute type of the receiver’s right expression. More... | |
(CPAttributeType) | - leftExpressionAttributeType |
Returns the attribute type of the receiver’s left expression. More... | |
Instance Methods inherited from CPObject | |
(void) | - addObserver:forKeyPath:options:context: |
(void) | - applyChange:toKeyPath: |
(id) | - autorelease |
(id) | - awakeAfterUsingCoder: |
(void) | - awakeFromCib |
(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: |
(id) | - init |
(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 |
(void) | - removeObserver:forKeyPath: |
(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: |
Additional Inherited Members | |
Class Methods inherited from CPObject | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + alloc |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(void) | + cancelPreviousPerformRequestsWithTarget: |
(void) | + cancelPreviousPerformRequestsWithTarget:selector:object: |
(Class) | + class |
(BOOL) | + conformsToProtocol: |
(void) | + exposeBinding: |
(void) | + initialize |
(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 |
Definition at line 2 of file CPPredicateEditorRowTemplate.h.
|
implementation |
Returns the compound predicate types for the receiver.
CompoundPredicateTypes
for possible values. Definition at line 315 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the subpredicates that should be made sub-rows of a given predicate.
predicate | A predicate object. |
nil
. If a template represents a predicate in its entirety, or if the predicate has no subpredicates, returns nil
. You can override this method to create custom templates that handle complicated compound predicates. Definition at line 231 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Initializes and returns a row template suitable for displaying compound predicates.
compoundTypes | An array of CPNumber objects specifying compound predicate types. See CPCompoundPredicateTypes for possible values. |
Definition at line 146 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Initializes and returns a “pop-up-pop-up-view”-style row template.
leftExpressions | An array of CPExpression objects that represent the left hand side of a predicate. |
attributeType | An attribute type for the right hand side of a predicate. This value dictates the type of view created, and how the control’s object value is coerced before putting it into a predicate. |
modifier | A modifier for the predicate (see CPComparisonPredicateModifier for possible values). |
operators | An array of CPNumber objects specifying the operator type (see CPPredicateOperatorType for possible values). |
options | Options for the predicate (see CPComparisonPredicateOptions for possible values). |
Definition at line 118 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Initializes and returns a “pop-up-pop-up-pop-up”-style row template.
leftExpressions | An array of CPExpression objects that represent the left hand side of a predicate. |
rightExpressions | An array of CPExpression objects that represent the right hand side of a predicate. |
modifier | A modifier for the predicate (see CPComparisonPredicateModifier for possible values). |
operators | An array of CPNumber objects specifying the operator type (see CPPredicateOperatorType for possible values). |
options | Options for the predicate (see CPComparisonPredicateOptions for possible values). |
Definition at line 86 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the attribute type of the receiver’s left expression.
Definition at line 378 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the left hand expressions for the receiver.
Definition at line 285 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns a positive number if the receiver can represent a given predicate, and 0 if it cannot.
0
if it cannot. By default, returns values in the range 0
to 1
. The highest match among all the templates determines which template is responsible for displaying the predicate. You can override this to determine which predicates your custom template handles. Definition at line 175 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the comparison predicate modifier for the receiver.
Definition at line 330 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns Returns the array of operators for the receiver.
Definition at line 342 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the comparison predicate options for the receiver.
CPComparisonPredicateOptions
for possible values. Returns 0
if this does not apply (for example, for a compound template initialized with -initWithCompoundTypes:). Definition at line 357 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the predicate represented by the receiver’s views' values and the given sub-predicates.
subpredicates | An array of predicates. |
You can override this method to return the predicate represented by a custom view.
Definition at line 253 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the attribute type of the receiver’s right expression.
Definition at line 369 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the right hand expressions for the receiver.
Definition at line 300 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Sets the value of the views according to the given predicate.
predicate | The predicate value for the receiver. This method is only called if -matchForPredicate: returned a positive value for the receiver. |
You can override this to set the values of custom views.
Definition at line 217 of file CPPredicateEditorRowTemplate.j.
|
implementation |
Returns the views for the receiver.
Definition at line 205 of file CPPredicateEditorRowTemplate.j.