T
- data type of the displaygroup's objectspublic class ERXBatchingDisplayGroup<T> extends ERXDisplayGroup<T>
WODisplayGroup
in order to provide real batching. This is
done by adding database specific code to the select statement from the
EOFetchSpecification
from the WODisplayGroup
's
EODataSource
which must be an EODatabaseDataSource
.
If used with other datasources, it reverts to the default behaviour.Modifier and Type | Class and Description |
---|---|
static class |
ERXBatchingDisplayGroup.FakeArray
Dummy array class that is used to provide a certain number of entries.
|
WODisplayGroup.Delegate
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
Modifier and Type | Field and Description |
---|---|
protected int |
_batchCount
total number of batches
|
protected NSArray<T> |
_displayedObjects
cache for the displayed objects
|
protected Boolean |
_isBatching
cache batching flag
|
protected NSArray<String> |
_prefetchingRelationshipKeyPaths |
protected int |
_rowCount |
protected boolean |
_shouldRememberRowCount |
DisplayGroupWillFetchNotification
_CLASS, NullValue
_CLASS
_CLASS
_CLASS
_CLASS
Constructor and Description |
---|
ERXBatchingDisplayGroup()
Creates a new ERXBatchingDisplayGroup.
|
Modifier and Type | Method and Description |
---|---|
int |
batchCount()
Overridden to return the pre-calculated number of batches.
|
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
Decodes an ERXBatchingDisplayGroup from the given unarchiver.
|
NSArray<T> |
displayedObjects()
Overridden method in order to fetch -only- the rows that are needed.
|
Object |
fetch()
Overridden to fetch only within displayed limits.
|
protected EOFetchSpecification |
fetchSpecification()
Utility to get the fetch specification from the datasource and the filter
qualifier.
|
NSArray<T> |
filteredObjects()
Overridden to return allObjects() when batching, as we can't qualify in memory.
|
boolean |
hasMultipleBatches()
Overridden to refetchIfNecessary() first to ensure we get a correct result in cases
where this is called before displayedObjects().
|
protected boolean |
isBatching()
Determines if batching is possible.
|
boolean |
isRawRowsForCustomQueries()
Returns whether or not fetch specification with custom queries should use raw rows.
|
protected NSArray<T> |
objectsInRange(int start,
int end)
Utility to fetch the object in a given range.
|
NSArray<String> |
prefetchingRelationshipKeyPaths()
Returns the prefetching key paths overriding those in the underlying fetch spec.
|
protected void |
refetch()
Utility that does the actual fetching, if a qualifier() is set, it adds
it to the dataSource() fetch qualifier.
|
protected void |
refetchIfNecessary()
If we're batching and the displayed objects have not been fetched,
do a refetch() of them.
|
int |
rowCount()
Utility to get at the number of rows when batching.
|
Object |
selectFilteredObjects()
Selects the visible objects, overridden to fetch all objects.
|
void |
setCurrentBatchIndex(int index)
Overridden to clear out our array of fetched objects.
|
void |
setDataSource(EODataSource datasource)
Overridden to set the isBatching flag to
true if we have an
EODatabaseDataSource. |
void |
setNumberOfObjectsPerBatch(int count)
Overridden to clear out our array of fetched objects.
|
void |
setObjectArray(NSArray objects)
Overridden to update the batch count.
|
void |
setPrefetchingRelationshipKeyPaths(ERXKey<?>... prefetchingRelationshipKeyPaths)
Sets the prefetching key paths to override those in the underlying fetch spec.
|
void |
setPrefetchingRelationshipKeyPaths(NSArray<String> prefetchingRelationshipKeyPaths)
Sets the prefetching key paths to override those in the underlying fetch spec.
|
void |
setQualifier(EOQualifier qualifier)
Overridden to trigger a refetch.
|
void |
setRawRowsForCustomQueries(boolean rawRowsForCustomQueries)
Sets whether or not fetch specification with custom queries should use raw rows.
|
void |
setRowCount(int rowCount)
Override the number of rows of results (if you can
provide a better estimate than the default behavior).
|
void |
setShouldRememberRowCount(boolean shouldRememberRowCount)
Set to
true to retain the rowCount() after it is determined once for a particular
qualifier. |
void |
setSortOrderings(NSArray<EOSortOrdering> sortOrderings)
Overridden to preserve the selected objects.
|
boolean |
shouldRememberRowCount() |
protected void |
updateBatchCount() |
void |
updateDisplayedObjects() |
addToSelection, addToSelection, allObjects, allQualifierOperators, clearExtraQualifiers, displayNextBatch, displayPreviousBatch, indexOfFirstDisplayedObject, indexOfLastDisplayedObject, qualifierForKey, qualifierFromQueryValues, removeFromSelection, removeFromSelection, selectedObject, selectedObjects, setQualifierForKey, setSelectedObjects, setSelectionIndexes, sortedObjects, sortOrderings
_beginObserverNotification, _deleteObject, _insertObjectAtIndex, _lastObserverNotified, awakeFromKeyValueUnarchiver, clearSelection, currentBatchIndex, dataSource, defaultStringMatchFormat, defaultStringMatchOperator, delegate, delete, deleteObjectAtIndex, deleteSelection, detailKey, displayBatchContainingSelectedObject, dispose, editingContextPresentErrorMessage, encodeWithCoder, encodeWithKeyValueArchiver, endEditing, fetchesOnLoad, finishInitialization, globalDefaultForValidatesChangesImmediately, globalDefaultStringMatchFormat, globalDefaultStringMatchOperator, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasDetailDataSource, initWithCoder, inQueryMode, insert, insertedObjectDefaultValues, insertNewObjectAtIndex, insertObjectAtIndex, localKeys, masterObject, numberOfObjectsPerBatch, objectsChangedInEditingContext, objectsInvalidatedInEditingContext, qualifier, qualifyDataSource, qualifyDisplayGroup, queryBindings, queryMatch, queryMax, queryMin, queryOperator, redisplay, relationalQualifierOperators, selectionIndexes, selectNext, selectObject, selectObjectsIdenticalTo, selectObjectsIdenticalToSelectFirstOnNoMatch, selectPrevious, selectsFirstObjectAfterFetch, setDefaultStringMatchFormat, setDefaultStringMatchOperator, setDelegate, setDetailKey, setFetchesOnLoad, setGlobalDefaultForValidatesChangesImmediately, setGlobalDefaultStringMatchFormat, setGlobalDefaultStringMatchOperator, setInQueryMode, setInsertedObjectDefaultValues, setLocalKeys, setMasterObject, setSelectedObject, setSelectsFirstObjectAfterFetch, setValidatesChangesImmediately, stringQualifierOperators, takeValueForKey, toString, unableToSetNullForKey, undoManager, validatesChangesImmediately, valueForKey, willChange
protected int _batchCount
protected Boolean _isBatching
protected int _rowCount
protected boolean _shouldRememberRowCount
public ERXBatchingDisplayGroup()
public void setRawRowsForCustomQueries(boolean rawRowsForCustomQueries)
rawRowsForCustomQueries
- whether or not fetch specification with custom queries should use raw rowspublic boolean isRawRowsForCustomQueries()
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
unarchiver
- the unarchiver to construct this display group withprotected void refetchIfNecessary()
protected boolean isBatching()
true
if dataSource is an instance of EODatabaseDataSourcepublic void setDataSource(EODataSource datasource)
true
if we have an
EODatabaseDataSource.setDataSource
in class ERXDisplayGroup<T>
datasource
- the EODataSource to usepublic int batchCount()
batchCount
in class WODisplayGroup
public void setCurrentBatchIndex(int index)
setCurrentBatchIndex
in class WODisplayGroup
index
- the index of the batch to displaypublic void setNumberOfObjectsPerBatch(int count)
setNumberOfObjectsPerBatch
in class ERXDisplayGroup<T>
count
- the maximum number of objects to display per batchpublic NSArray<T> displayedObjects()
WODisplayGroup
would always fetch from the start until the end of the objects from the
fetch limit.displayedObjects
in class ERXDisplayGroup<T>
public boolean hasMultipleBatches()
hasMultipleBatches
in class WODisplayGroup
true
if batchCount is greater than 1, false
otherwisepublic NSArray<T> filteredObjects()
filteredObjects
in class ERXDisplayGroup<T>
public void setQualifier(EOQualifier qualifier)
setQualifier
in class ERXDisplayGroup<T>
qualifier
- the qualifier for the display grouppublic void setSortOrderings(NSArray<EOSortOrdering> sortOrderings)
setSortOrderings
in class ERXDisplayGroup<T>
sortOrderings
- the proposed EOSortOrdering objectspublic void setPrefetchingRelationshipKeyPaths(NSArray<String> prefetchingRelationshipKeyPaths)
prefetchingRelationshipKeyPaths
- the prefetching key paths to override those in the underlying fetch specpublic void setPrefetchingRelationshipKeyPaths(ERXKey<?>... prefetchingRelationshipKeyPaths)
prefetchingRelationshipKeyPaths
- the prefetching key paths to override those in the underlying fetch specpublic NSArray<String> prefetchingRelationshipKeyPaths()
protected EOFetchSpecification fetchSpecification()
public int rowCount()
public void setRowCount(int rowCount)
rowCount
- the number of rows of resultspublic boolean shouldRememberRowCount()
true
if the rowCount() should be remembered after being determined
or false
if rowCount() should be re-calculated when the batch changespublic void setShouldRememberRowCount(boolean shouldRememberRowCount)
true
to retain the rowCount() after it is determined once for a particular
qualifier. Set to false
to have rowCount() re-calculated when the batch changes.
The default is true
.shouldRememberRowCount
- the shouldRememberRowCount to setprotected NSArray<T> objectsInRange(int start, int end)
start
- start index of the rangeend
- end index of the rangeprotected void refetch()
protected void updateBatchCount()
public void setObjectArray(NSArray objects)
setObjectArray
in class WODisplayGroup
objects
- the object array to setpublic Object fetch()
fetch
in class ERXDisplayGroup<T>
null
to force the page to reloadpublic void updateDisplayedObjects()
updateDisplayedObjects
in class WODisplayGroup
public Object selectFilteredObjects()
selectFilteredObjects
in class ERXDisplayGroup<T>
null
to force the page to reloadCopyright © 2002 – 2024 Project Wonder.