WODisplayGroup
Inherits from: NSObject
Conforms to: NSCoding
NSObject (NSObject)
Declared in: WebObjects/WODisplayGroup.h
Class Description
A WODisplayGroup is the basic user interface manager for a WebObjects application that accesses a database. It collects objects from an EODataSource (defined in EOControl), filters and sorts them, and maintains a selection in the filtered subset. You bind WebObjects dynamic elements to WODisplayGroup attributes and methods to display information from the database on your web page.
A WODisplayGroup manipulates its EODataSource by sending it fetchObjects, insertObject:, and other messages, and registers itself as an editor and message handler of the EODataSource's EOEditingContext (also defined in EOControl). The EOEditingContext then monitors the WODisplayGroup for changes to objects.
Most of a WODisplayGroup's interactions are with its EODataSource and its EOEditingContext. See the EODataSource, and EOEditingContext class specifications in the Enterprise Objects Framework Reference for more information on these interactions.
The Delegate
The WODisplayGroup delegate offers a number of methods, and WODisplayGroup invokes them as appropriate. Besides displayGroup:displayArrayForObjects:, there are methods that inform the delegate that the WODisplayGroup has fetched, created an object (or failed to create one), inserted or deleted an object, changed the selection, or set a value for a property. There are also methods that request permission from the delegate to perform most of these same actions. The delegate can return YES to permit the action or NO to deny it. See each method's description in the WODisplayGroup.Delegates protocol specification for more information.
Adopted Protocols
NSCoding- encodeWithCoder: - initWithCoder:
Method Types
- Creating instances
- - init
- Configuring behavior
- - setFetchesOnLoad:
- - fetchesOnLoad
- - setSelectsFirstObjectAfterFetch:
- - selectsFirstObjectAfterFetch
- + setGlobalDefaultForValidatesChangesImmediately:
- + globalDefaultForValidatesChangesImmediately
- - setValidatesChangesImmediately:
- - validatesChangesImmediately
- Setting the data source
- - setDataSource:
- - dataSource
- Setting the qualifier and sort ordering
- - setQualifier:
- - qualifier
- - setSortOrderings:
- - sortOrderings
- Managing queries
- - qualifierFromQueryValues
- - queryMatch
- - queryMax
- - queryMin
- - queryOperator
- - allQualifierOperators
- - relationalQualifierOperators
- - stringQualifierOperators
- + setGlobalDefaultStringMatchFormat:
- + globalDefaultStringMatchFormat
- - setDefaultStringMatchFormat:
- - defaultStringMatchFormat
- + setGlobalDefaultStringMatchOperator:
- + globalDefaultStringMatchOperator
- - setDefaultStringMatchOperator:
- - defaultStringMatchOperator
- - qualifyDisplayGroup
- - qualifyDataSource
- - inQueryMode
- - setInQueryMode:
- Fetching objects from the data source
- - fetch
- Getting the objects
- - allObjects
- - displayedObjects
- Batching the results
- - setNumberOfObjectsPerBatch:
- - numberOfObjectsPerBatch
- - hasMultipleBatches
- - displayNextBatch
- - displayPreviousBatch
- - batchCount
- - setCurrentBatchIndex:
- - currentBatchIndex
- - indexOfFirstDisplayedObject
- - indexOfLastDisplayedObject
- - displayBatchContainingSelectedObject
- Updating display of values
- - redisplay
- - updateDisplayedObjects
- Setting the objects
- - setObjectArray:
- Changing the selection
- - clearSelection
- - selectNext
- - selectObjectsIdenticalTo:
- - selectObjectsIdenticalTo:selectFirstOnNoMatch:
- - selectObject:
- - selectPrevious
- - setSelectedObject:
- - setSelectedObjects:
- - setSelectionIndexes:
- Examining the selection
- - selectionIndexes
- - selectedObject
- - selectedObjects
- Inserting and deleting objects
- - insertObject: atIndex:
- - insertObjectAtIndex:
- - insert
- - setInsertedObjectDefaultValues:
- - insertedObjectDefaultValues
- - deleteObjectAtIndex:
- - deleteSelection
- - delete
- Setting up a detail display group
- - hasDetailDataSource
- - setMasterObject:
- - masterObject
- - setDetailKey:
- - detailKey
- Working with named fetch specifications
- - queryBindings
- Setting the delegate
- - setDelegate:
- - delegate
Class Methods
globalDefaultForValidatesChangesImmediately
+ (BOOL)globalDefaultForValidatesChangesImmediately
Returns the class default controlling whether changes are immediately validated.
See Also: - validatesChangesImmediately
globalDefaultStringMatchFormat
+ (NSString *)globalDefaultStringMatchFormat
Returns the default string match format for the class.
See Also: - defaultStringMatchFormat
globalDefaultStringMatchOperator
+ (NSString *)globalDefaultStringMatchOperator
Returns the default string match operator for the class.
See Also: - defaultStringMatchOperator
setGlobalDefaultForValidatesChangesImmediately:
+ (void)setGlobalDefaultForValidatesChangesImmediately:(BOOL)flag
Sets according to flag the class default controlling whether changes are immediately validated.
See Also: - setValidatesChangesImmediately:
setGlobalDefaultStringMatchFormat:
+ (void)setGlobalDefaultStringMatchFormat:(NSString
*)format
Sets the default string match format for the class.
See Also: - setDefaultStringMatchFormat:
setGlobalDefaultStringMatchOperator:
+ (void)setGlobalDefaultStringMatchFormat:(NSString
*)operator
Sets the default string match operator for the class.
See Also: - setDefaultStringMatchOperator:
Instance Methods
allObjects
- (NSArray *)allObjects
See Also: - displayedObjects, - fetch
allQualifierOperators
- (NSArray *)allQualifierOperators
See Also: - queryOperator, - relationalQualifierOperators, - stringQualifierOperators
batchCount
- (unsigned)batchCount
See Also: - currentBatchIndex, - displayNextBatch, - displayPreviousBatch, - hasMultipleBatches, - numberOfObjectsPerBatch
clearSelection
- (BOOL)clearSelection
currentBatchIndex
- (unsigned)currentBatchIndex
See Also: - batchCount, - numberOfObjectsPerBatch, - setCurrentBatchIndex:
dataSource
- (EODataSource *)dataSource
See Also: - hasDetailDataSource, - setDataSource:
defaultStringMatchFormat
- (NSString *)defaultStringMatchFormat
See Also: - defaultStringMatchOperator, - setDefaultStringMatchFormat:, + globalDefaultStringMatchFormat
defaultStringMatchOperator
- (NSString *)defaultStringMatchOperator
See Also: - defaultStringMatchFormat, - setDefaultStringMatchOperator:, + globalDefaultStringMatchOperator
delegate
- (id)delegate
See Also: - setDelegate:
delete
- (id)delete
See Also: - deleteObjectAtIndex:
deleteObjectAtIndex:
- (BOOL)deleteObjectAtIndex:(unsigned)index
This method performs the delete by sending deleteObject to the EODataSource (defined in the EOControl framework). If that message raises an exception, this method fails and returns NO.
See Also: - delete, - deleteSelection
deleteSelection
- (BOOL)deleteSelection
See Also: - delete, - deleteObjectAtIndex:
detailKey
- (NSString *)detailKey
This method returns nil if the receiver is not a detail display group or if the detail key has not yet been set. You typically create a detail display group by dragging a to-many relationship from EOModeler to an open component in WebObjects Builder.
See Also: - hasDetailDataSource, - masterObject, - setDetailKey:
displayBatchContainingSelectedObject
- (id)displayBatchContainingSelectedObject
See Also: - displayNextBatch, - displayPreviousBatch, - setCurrentBatchIndex:
displayedObjects
- (NSArray *)displayedObjects
If batching is in effect, displayedObjects returns the current batch of objects.
See Also: - allObjects, - updateDisplayedObjects, - qualifier, - setSortOrderings:, - displayGroup:displayArrayForObjects: (delegate method)
displayNextBatch
- (id)displayNextBatch
See Also: - batchCount, - currentBatchIndex, - displayBatchContainingSelectedObject, - displayPreviousBatch
displayPreviousBatch
- (id)displayPreviousBatch
See Also: - batchCount, - currentBatchIndex, - displayBatchContainingSelectedObject, - displayNextBatch
fetch
- (id)fetch
Before fetching, this method sends displayGroupShouldFetch: to the delegate. If this method was successful, it then sends a fetchObjects message to the receiver's EODataSource to replace the object array, and if successful sends the delegate a displayGroup:didFetchObjects: message.
This method returns nil to force the page to reload.
See Also: - allObjects, - updateDisplayedObjects
fetchesOnLoad
- (BOOL)fetchesOnLoad
See Also: - fetch, - setFetchesOnLoad:
hasDetailDataSource
- (BOOL)hasDetailDataSource
See Also: - detailKey, - masterObject
hasMultipleBatches
- (BOOL)hasMultipleBatches
See Also: - batchCount, - setNumberOfObjectsPerBatch:
indexOfFirstDisplayedObject
- (unsigned)indexOfFirstDisplayedObject
See Also: - indexOfLastDisplayedObject
indexOfLastDisplayedObject
- (unsigned)indexOfLastDisplayedObject
See Also: - indexOfFirstDisplayedObject
init
- (id)init
inQueryMode
- (BOOL)inQueryMode
See Also: - setInQueryMode:
insert
- (id)insert
This method returns nil to force the page to reload.
insertedObjectDefaultValues
- (NSDictionary *)insertedObjectDefaultValues
insertObjectAtIndex:
- (id)insertObjectAtIndex:(unsigned)index
If the object is successfully created, this method then sets the default values specified by insertedObjectDefaultValues.
See Also: - insert
insertObject: atIndex:
- (void)insertObject:(id)anObject
atIndex:(unsigned)index
Raises an NSRangeException if index is out of bounds.
See Also: - insertObjectAtIndex:, - insert
masterObject
- (id)masterObject
See Also: - detailKey, - hasDetailDataSource, - setMasterObject:
numberOfObjectsPerBatch
- (unsigned)numberOfObjectsPerBatch
qualifier
- (EOQualifier *)qualifier
See Also: - displayedObjects, - setQualifier:, - updateDisplayedObjects
qualifierFromQueryValues
- (EOQualifier *)qualifierFromQueryValues
See Also: - qualifyDataSource, - qualifyDisplayGroup
qualifyDataSource
- (void)qualifyDataSource
See Also: - queryMatch, - queryMax,, - queryMin, - queryOperator
qualifyDisplayGroup
- (void)qualifyDisplayGroup
See Also: - qualifyDataSource, - queryMatch, - queryMax, - - queryMin, - queryOperator
queryBindings
- (NSMutableDictionary *)queryBindings
queryMatch
- (NSMutableDictionary *)queryMatch
Use the queryOperator dictionary to specify the type of matching (=, <, >, like, and so on) for each key in the queryMatch dictionary.
If the queryOperator dictionary does not contain a key contained in the queryMatch dictionary, the default is to match the value exactly (=) if the value is a number or a date and to perform pattern matching if the value is an NSString. In the case of string values, the defaultStringMatchFormat and defaultStringMatchOperator specify exactly how the pattern matching will be performed.
See Also: - allQualifierOperators, - qualifyDataSource, - qualifyDisplayGroup, - relationalQualifierOperators
queryMax
- (NSMutableDictionary *)queryMax
See Also: - qualifyDataSource, - qualifyDisplayGroup, - queryOperator
queryMin
- (NSMutableDictionary *)queryMin
See Also: - qualifyDataSource, - qualifyDisplayGroup, - queryOperator
queryOperator
- (NSMutableDictionary *)queryOperator
See Also: - qualifierFromQueryValues, - queryMax, - queryMin, - relationalQualifierOperators
redisplay
- (void)redisplay
relationalQualifierOperators
- (NSArray *)relationalQualifierOperators
See Also: - allQualifierOperators, - queryOperator, - stringQualifierOperators
selectedObject
- (id)selectedObject
See Also: - displayedObjects, - selectionIndexes, - selectedObjects
selectedObjects
- (NSArray *)selectedObjects
See Also: - displayedObjects, - selectionIndexes, - selectedObject
selectionIndexes
- (NSArray *)selectionIndexes
See Also: - selectedObject, - selectedObjects, - setSelectionIndexes:
selectNext
- (id)selectNext
- If there are no objects, does nothing.
- If there's no selection, selects the object at index zero.
- If the first selected object is the last object in the displayed objects array, selects the first object.
- Otherwise selects the object after the first selected object.
This method returns nil to force the page to reload.
See Also: - selectPrevious, - setSelectionIndexes:
selectObject:
- (BOOL)selectObject:(id)anObject
See Also: - selectNext, - selectPrevious
selectObjectsIdenticalTo:
- (BOOL)selectObjectsIdenticalTo:(NSArray
*)objectSelection
See Also: - setSelectionIndexes:, - selectObjectsIdenticalTo:selectFirstOnNoMatch:
selectObjectsIdenticalTo:selectFirstOnNoMatch:
- (BOOL)selectObjectsIdenticalTo:(NSArray
*)objects
selectFirstOnNoMatch:(BOOL)flag
See Also: - setSelectionIndexes:, - selectObjectsIdenticalTo:
selectPrevious
- (id)selectPrevious
- If there are no objects, does nothing.
- If there's no selection, selects the object at index zero.
- If the first selected object is at index zero, selects the last object.
- Otherwise selects the object before the first selected object.
This method returns nil to force the page to reload.
See Also: - selectNext, - redisplay
selectsFirstObjectAfterFetch
- (BOOL)selectsFirstObjectAfterFetch
WODisplayGroups by default do select the first object after a fetch when there was no previous selection.
See Also: - displayedObjects, - fetch, - setSelectsFirstObjectAfterFetch:
setCurrentBatchIndex:
- (void)setCurrentBatchIndex:(unsigned)anInt
If anInt is greater than the number of batches, this method displays the first batch.
See Also: - batchCount, - currentBatchIndex, - displayBatchContainingSelectedObject, - displayNextBatch, - displayPreviousBatch, - numberOfObjectsPerBatch
setDataSource:
- (void)setDataSource:(EODataSource
*)aDataSource
Sets the receiver's EODataSource (defined in the EOControl framework) to aDataSource. In the process, it performs these actions:
- Unregisters itself as an editor and message handler for the previous EODataSource's EOEditingContext (also defined in EOControl), if necessary, and registers itself with aDataSource's EOEditingContext. If the new EOEditingContext already has a message handler, however, the receiver doesn't assume that role.
- Clears the receiver's array of objects.
- Sends displayGroupDidChangeDataSource: to the delegate if there is one.
See Also: - dataSource
setDefaultStringMatchFormat:
- (void)setDefaultStringMatchFormat:(NSString
*)format
The default format string for pattern matching is "%@*" which means that the string value in the queryMatch dictionary is used as a prefix (this default can be overridden on a class basis using setGlobalDefaultStringMatchFormat:). For example, if the queryMatch dictionary contains a value "Jo" for the key "Name", the query returns all records whose name values begin with "Jo".
See Also: - defaultStringMatchFormat, - setDefaultStringMatchOperator:, + setGlobalDefaultStringMatchFormat:
setDefaultStringMatchOperator:
- (void)setDefaultStringMatchOperator:(NSString
*)operator
The default value for the query match operator is caseInsensitiveLike, which means that the query does not consider case when matching letters (this default can be overridden on a class basis using setGlobalDefaultStringMatchOperator:). The other possible value for this operator is like, which matches the case of the letters exactly.
See Also: - allQualifierOperators, - defaultStringMatchOperator, - relationalQualifierOperators, - setDefaultStringMatchFormat:, + setGlobalDefaultStringMatchOperator:
setDelegate:
- (void)setDelegate:(id)anObject
See Also: - delegate, WODisplayGroup Delegate
setDetailKey:
- (void)setDetailKey:(NSString
*)detailKey
If the receiver is not a detail display group, this method has no effect. A display group is a detail display group if its data source is an EODetailDataSource (defined in the EOControl framework). You typically create a detail display group by dragging a to-many relationship from EOModeler to an open component in WebObjects Builder. Doing so sets the detail key and master object, so you rarely need to use this method.
See Also: - hasDetailDataSource, - detailKey, - setMasterObject:
setFetchesOnLoad:
- (void)setFetchesOnLoad:(BOOL)flag
See Also: - fetch, - fetchesOnLoad
setInQueryMode:
- (void)setInQueryMode:(BOOL)flag
See Also: - inQueryMode
setInsertedObjectDefaultValues:
- (void)setInsertedObjectDefaultValues:(NSDictionary
*)defaultValues
[defaultValues setObject:@"New title" forKey:@"title"]; [movies setInsertedObjectDefaultValues:defaultValues];
See Also: - insertedObjectDefaultValues
setMasterObject:
- (void)setMasterObject:(id)masterObject
Before you use this method, you should use the setDetailKey: to set the key to this relationship. You typically create a detail display group by dragging a to-Many relationship from EOModeler to an open component in WebObjects Builder. Doing so sets the master object and detail key, so you typically do not have to use this method.
If the receiver is not a detail display group, this method has no effect.
See Also: - hasDetailDataSource, - masterObject
setNumberOfObjectsPerBatch:
- (void)setNumberOfObjectsPerBatch:(unsigned)count
See Also: - batchCount, - displayNextBatch, - displayPreviousBatch, - numberOfObjectsPerBatch
setObjectArray:
- (void)setObjectArray:(NSArray
*)objects
After setting the object array, this method restores as much of the original selection as possible. If there's no match and the receiver selects after fetching, then the first object is selected.
See Also: - allObjects, - displayedObjects, - fetch, - selectsFirstObjectAfterFetch
setQualifier:
- (void)setQualifier:(EOQualifier
*)aQualifier
If the receiver's delegate responds to displayGroup:displayArrayForObjects:, that method is used instead of the qualifier to filter the objects.
See Also: - displayedObjects, - qualifier
setSelectedObject:
- (void)setSelectedObject:(id)anObject
See Also: - displayedObjects, - selectionIndexes, - selectedObjects
setSelectedObjects:
- (void)selectedObjects:(NSArray
*)objects
See Also: - displayedObjects, - selectionIndexes, - selectedObject
setSelectionIndexes:
- (BOOL)setSelectionIndexes:(NSArray
*)selection
This method checks the delegate with a displayGroup:shouldChangeSelectionToIndexes: message. If the delegate returns NO, this method also fails and returns NO. If the receiver successfully changes the selection, its observers each receive a displayGroupDidChangeSelection: message and, if necessary, a displayGroupDidChangeSelectedObjects: message.
The selection set here is only a programmatic selection; the objects on the screen are not highlighted in any way. |