net.wotonomy.web
Class WODisplayGroup

java.lang.Object
  extended by java.util.Observable
      extended by net.wotonomy.web.WODisplayGroup
All Implemented Interfaces:
java.io.Serializable, net.wotonomy.control.EOEditingContext.Editor, net.wotonomy.control.EOObserving

public class WODisplayGroup
extends java.util.Observable
implements net.wotonomy.control.EOObserving, net.wotonomy.control.EOEditingContext.Editor, java.io.Serializable

WODisplayGroup manages a set of objects, allowing them to be sorted, batched, and filtered. WODisplay also acts as a bridge to the wotonomy's control package, including WODisplayGroup and EOEditingContext.

Version:
$Revision: 905 $
Author:
michael@mpowers.net, $Author: cgruber $
See Also:
Serialized Form

Nested Class Summary
static interface WODisplayGroup.Delegate
          DisplayGroups can delegate important decisions to a Delegate.
 
Field Summary
protected  net.wotonomy.foundation.NSMutableArray allObjects
           
protected  net.wotonomy.foundation.NSArray allObjectsProxy
           
protected  net.wotonomy.foundation.NSMutableArray displayedObjects
           
protected  net.wotonomy.foundation.NSArray displayedObjectsProxy
           
static java.lang.String DisplayGroupWillFetchNotification
          Notification sent when the display group is about to fetch.
protected  net.wotonomy.foundation.NSMutableArray selectedIndexes
           
protected  net.wotonomy.foundation.NSMutableArray selectedObjects
           
protected  net.wotonomy.foundation.NSArray selectedObjectsProxy
           
 
Constructor Summary
WODisplayGroup()
          Creates a new display group.
 
Method Summary
 net.wotonomy.foundation.NSArray allObjects()
          Returns a read-only List containing all objects managed by the display group.
 net.wotonomy.foundation.NSArray allQualifierOperators()
          Returns a list containing all supported qualifier operators.
 int batchCount()
          Returns the total number of batches held by this display group.
 boolean clearSelection()
          Clears the current selection.
 int currentBatchIndex()
          Returns the index of the currently displayed batch.
 net.wotonomy.control.EODataSource dataSource()
          Returns the current data source backing this display group, or null if no dataSource is currently used.
 java.lang.String defaultStringMatchFormat()
          Returns the current string matching format.
 java.lang.String defaultStringMatchOperator()
          Returns the current string matching operator.
 java.lang.Object delegate()
          Returns the current delegate for this display group, or null if no delegate is currently set.
 java.lang.Object delete()
          Convenience for binding to a component action: calls deleteSelection() and then displayBatchContainingSelectedObject() and returns null, which is a suitable result from a component action.
 boolean deleteObjectAtIndex(int anIndex)
          Deletes the object at the specified index, notifying the delegate before and after the operation, and then updating the selection if needed.
 boolean deleteSelection()
          Deletes the currently selected objects.
 java.lang.String detailKey()
          Returns the key by which this display group is bound a master display group, or null if this is not a detail display group.
 java.lang.Object displayBatchContainingSelectedObject()
          Sets the displayed objects to the batch containing the first selected object, and updates the current batch index, and returns null to force a page reload.
 net.wotonomy.foundation.NSArray displayedObjects()
          Returns a read-only List of all objects in the display group that are currently displayed by the associations.
 java.lang.Object displayNextBatch()
          Sets the displayed objects to the next batch and updates the current batch index, and returns null to force a page reload.
 java.lang.Object displayPreviousBatch()
          Sets the displayed objects to the next batch and updates the current batch index, and returns null to force a page reload.
 void editingContextPresentErrorMessage(net.wotonomy.control.EOEditingContext anEditingContext, java.lang.String aMessage)
          Called to display a message for an error that occurred in the specified editing context.
 boolean editingContextShouldContinueFetching(net.wotonomy.control.EOEditingContext anEditingContext, int count, int limit, net.wotonomy.control.EOObjectStore anObjectStore)
          Called by the specified object store to determine whether fetching should continue, where count is the current count and limit is the limit as specified by the fetch specification.
 void editingContextWillSaveChanges(net.wotonomy.control.EOEditingContext anEditingContext)
          Called before the editing context begins to save changes.
 boolean editorHasChangesForEditingContext(net.wotonomy.control.EOEditingContext anEditingContext)
          Called to determine whether this editor has changes that have not been committed to the object in the context.
 boolean endEditing()
          Deprecated: returns true.
 void enterQueryMode(java.lang.Object aSender)
          Sets the display group and associations to edit a "query by example" query object.
 net.wotonomy.foundation.NSDictionary equalToQueryValues()
          Returns a Map containing the mappings of keys to query values that will be used to test for equality.
 java.lang.Object fetch()
          Requests a list of objects from the DataSource and calls setObjectArray to populate the list.
 boolean fetchesOnLoad()
          Returns whether this display group should immediate fetch when loaded.
static boolean globalDefaultForValidatesChangesImmediately()
          Specifies the default behavior for whether changes should be validated immediately for all display groups.
static java.lang.String globalDefaultStringMatchFormat()
          Specifies the default string matching format for all display groups.
static java.lang.String globalDefaultStringMatchOperator()
          Specifies the default string matching operator for all display groups.
 net.wotonomy.foundation.NSDictionary greaterThanQueryValues()
          Returns a Map containing the mappings of keys to query values that will be used to test for greater value.
 boolean hasDetailDataSource()
          Returns whether the data source is a detail data source, suggesting that this is a detail display group.
 boolean hasMultipleBatches()
          Returns whether the displayed objects have been batched.
 int indexOfFirstDisplayedObject()
          Returns the one-based index within the displayed objects list of the first displayed object in the current batch.
 int indexOfLastDisplayedObject()
          Returns the one-based index within the displayed objects list of the first last object in the current batch.
 boolean inQueryMode()
          Returns whether this display group is in "query by example" mode.
 java.lang.Object insert()
          Convenience to call insertNewObjectAtIndex with the current selection plus one, or at the end of the list if there is no selection.
 net.wotonomy.foundation.NSDictionary insertedObjectDefaultValues()
          Returns a Map of default values that are applied to new objects that are inserted into the list.
 java.lang.Object insertNewObjectAtIndex(int anIndex)
          Creates a new object at the specified index.
 void insertObjectAtIndex(java.lang.Object anObject, int anIndex)
          Inserts the specified object into the list at the specified index.
 net.wotonomy.foundation.NSDictionary lessThanQueryValues()
          Returns a Map containing the mappings of keys to query values that will be used to test for lesser value.
 net.wotonomy.foundation.NSArray localKeys()
          Returns the keys that were declared when read from an external resource file.
 java.lang.Object masterObject()
          Returns the selected object in the master display group, or null if this is not a detail display group.
 int numberOfObjectsPerBatch()
          Returns the number of objects per batch.
 void objectsInvalidatedInEditingContext(net.wotonomy.foundation.NSNotification aNotification)
          Handles notifications from the data source's editing context, looking for InvalidatedAllObjectsInStoreNotification and ObjectsChangedInEditingContextNotification, refetching in the former case and updating displayed objects in the latter.
 void objectWillChange(java.lang.Object anObject)
          Receives notifications of changes from objects that are managed by this display group.
 net.wotonomy.control.EOQualifier qualifier()
          Returns a qualifier that will be applied all the objects in this display group to determine which objects will be displayed.
 net.wotonomy.control.EOQualifier qualifierFromQueryValues()
          Returns a new qualifier built from the three query value maps: greater than, equal to, and less than.
 void qualifyDataSource()
          Calls qualifierFromQueryValues(), applies the result to the data source, and calls fetch().
 void qualifyDisplayGroup()
          Calls qualifierFromQueryValues(), sets the qualifier with setQualifier(), and calls updateDisplayedObjects().
 net.wotonomy.foundation.NSMutableDictionary queryBindings()
          Returns a Map containing the mappings of keys to binding query values.
 net.wotonomy.foundation.NSDictionary queryBindingValues()
          Returns a Map containing the mappings of keys to binding query values.
 net.wotonomy.foundation.NSMutableDictionary queryMatch()
          Returns a Map containing the mappings of keys to binding query values for a matching query.
 net.wotonomy.foundation.NSMutableDictionary queryMax()
          Returns a Map containing the mappings of keys to binding query values for a maximum value query.
 net.wotonomy.foundation.NSMutableDictionary queryMin()
          Returns a Map containing the mappings of keys to binding query values for a minimum value query.
 net.wotonomy.foundation.NSMutableDictionary queryOperator()
          Returns a Map containing the mappings of keys to operator values.
 net.wotonomy.foundation.NSDictionary queryOperatorValues()
          Returns a Map containing the mappings of keys to operator values.
 void redisplay()
          Sets contentsChanged to true and notifies all observers.
 java.lang.Object selectedObject()
          Returns the currently selected object, or null if there is no selection.
 net.wotonomy.foundation.NSArray selectedObjects()
          Returns a read-only List containing all selected objects, if any.
 java.lang.Object selectedObjectValueForKey(java.lang.String aKey)
          Returns a value on the selected object for the specified key.
 net.wotonomy.foundation.NSArray selectionIndexes()
          Returns a read-only List containing the indexes of all selected objects, if any.
 java.lang.Object selectNext()
          Sets the selection to the next displayed object after the current selection.
 boolean selectObject(java.lang.Object anObject)
          Sets the selection to the specified object.
 boolean selectObjectsIdenticalTo(java.util.List anObjectList)
          Sets the selection to the specified objects.
 boolean selectObjectsIdenticalToSelectFirstOnNoMatch(java.util.List anObjectList, boolean selectFirstIfNoMatch)
          Calls selectObjectsIdenticalTo and if false is returned and selectFirstIfNoMatch is true, selects the first object.
 java.lang.Object selectPrevious()
          Sets the selection to the previous displayed object before the current selection.
 boolean selectsFirstObjectAfterFetch()
          Sets whether this display group will select the first object in the list after a fetch.
 void setCurrentBatchIndex(int aBatchIndex)
          Sets the index of the currently displayed batch.
 void setDataSource(net.wotonomy.control.EODataSource aDataSource)
          Sets the data source that will be used by this display group.
 void setDefaultStringMatchFormat(java.lang.String aFormat)
          Sets the default string matching format that will be used by this display group.
 void setDefaultStringMatchOperator(java.lang.String anOperator)
          Sets the default string matching operator that will be used by this display group.
 void setDelegate(java.lang.Object aDelegate)
          Sets the display group delegate that will be used by this display group.
 void setDetailKey(java.lang.String aKey)
          Sets the key by which this display group is bound a master display group.
 void setEqualToQueryValues(java.util.Map aMap)
          Sets the Map that contains the mappings of keys to query values that will be used to test for equality.
 void setFetchesOnLoad(boolean willFetch)
          Sets whether this display group will fetch objects from its data source on load.
static void setGlobalDefaultForValidatesChangesImmediately(boolean validatesImmediately)
          Sets the default behavior for validating changes for all display groups.
static void setGlobalDefaultStringMatchFormat(java.lang.String aFormat)
          Sets the default string matching format that will be used by all display groups.
static void setGlobalDefaultStringMatchOperator(java.lang.String anOperator)
          Sets the default string matching operator that will be used by all display groups.
 void setGreaterThanQueryValues(java.util.Map aMap)
          Sets the mapping that contains the mappings of keys to query values that will be used to test for greater value.
 void setInQueryMode(boolean isInQueryMode)
          Sets whether this display group is in "query by example" mode.
 void setInsertedObjectDefaultValues(java.util.Map aMap)
          Sets the mapping that contains the values that will be applied to new objects inserted into the display group.
 void setLessThanQueryValues(java.util.Map aMap)
          Sets the mapping that contains the mappings of keys to query values that will be used to test for lesser value.
 void setLocalKeys(java.util.List aKeyList)
          Sets the keys that are declared when instantiated from an external resource file.
 void setMasterObject(java.lang.Object anObject)
          Sets the master object in the detail data source.
 void setNumberOfObjectsPerBatch(int aSize)
          Returns the number of objects per batch.
 void setObjectArray(java.util.List anObjectList)
          Sets the objects managed by this display group.
 void setQualifier(net.wotonomy.control.EOQualifier aQualifier)
          Sets the qualifier that will be used by updateDisplayedObjects() to filter displayed objects.
 void setQueryBindingValues(java.util.Map aMap)
          Sets the mapping that contains the mappings of keys to binding values.
 void setQueryOperatorValues(java.util.Map aMap)
          Sets the mapping that contains the mappings of keys to operator values.
 void setSelectedObject(java.lang.Object anObject)
          Sets the currently selected object, or clears the selection if the object is not found or is null.
 void setSelectedObjects(java.util.List aList)
          Sets the current selection to the specified objects.
 boolean setSelectedObjectValue(java.lang.Object aValue, java.lang.String aKey)
          Sets the specified value for the specified key on all selected objects.
 boolean setSelectionIndexes(java.util.List aList)
          Sets the current selection to the objects at the specified indexes.
 void setSelectsFirstObjectAfterFetch(boolean selectsFirst)
          Sets whether the first object in the list will be selected after a fetch.
 void setSortOrderings(java.util.List aList)
          Sets the order of the keys by which this display group will be ordered after a fetch or after a call to updateDisplayedObjects().
 void setUsesOptimisticRefresh(boolean isOptimistic)
          Sets whether only changed objects are refreshed (optimistic), or whether all objects are refreshed (pessimistic, default).
 void setValidatesChangesImmediately(boolean validatesImmediately)
          Sets whether changes made by associations are validated immediately, or when changes are saved.
 boolean setValueForObject(java.lang.Object aValue, java.lang.Object anObject, java.lang.String aKey)
          Sets the specified value for the specified key on the specified object.
 boolean setValueForObjectAtIndex(java.lang.Object aValue, int anIndex, java.lang.String aKey)
          Calls setValueForObject() for the object at the specified index.
 net.wotonomy.foundation.NSArray sortOrderings()
          Returns a read-only List of sort orderings for this display group.
 java.lang.String toString()
          Prints out the list of displayed objects.
 void updateDisplayedObjects()
          Applies the qualifier to all objects and sorts the results to update the list of displayed objects.
 int updatedObjectIndex()
          Returns the index of the changed object.
 boolean usesOptimisticRefresh()
          Returns whether this display group refreshes only the changed objects or all objects on refresh.
 boolean validatesChangesImmediately()
          Returns whether this display group validates changes immediately.
 java.lang.Object valueForObject(java.lang.Object anObject, java.lang.String aKey)
          Returns the value for the specified key on the specified object.
 java.lang.Object valueForObjectAtIndex(int anIndex, java.lang.String aKey)
          Calls valueForObject() for the object at the specified index.
protected  void willChange()
          Needed because we don't inherit from NSObject.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DisplayGroupWillFetchNotification

public static final java.lang.String DisplayGroupWillFetchNotification
Notification sent when the display group is about to fetch.

See Also:
Constant Field Values

allObjects

protected net.wotonomy.foundation.NSMutableArray allObjects

allObjectsProxy

protected net.wotonomy.foundation.NSArray allObjectsProxy

displayedObjects

protected net.wotonomy.foundation.NSMutableArray displayedObjects

displayedObjectsProxy

protected net.wotonomy.foundation.NSArray displayedObjectsProxy

selectedObjects

protected net.wotonomy.foundation.NSMutableArray selectedObjects

selectedObjectsProxy

protected net.wotonomy.foundation.NSArray selectedObjectsProxy

selectedIndexes

protected net.wotonomy.foundation.NSMutableArray selectedIndexes
Constructor Detail

WODisplayGroup

public WODisplayGroup()
Creates a new display group.

Method Detail

setDataSource

public void setDataSource(net.wotonomy.control.EODataSource aDataSource)
Sets the data source that will be used by this display group.


dataSource

public net.wotonomy.control.EODataSource dataSource()
Returns the current data source backing this display group, or null if no dataSource is currently used.


detailKey

public java.lang.String detailKey()
Returns the key by which this display group is bound a master display group, or null if this is not a detail display group.


setDetailKey

public void setDetailKey(java.lang.String aKey)
Sets the key by which this display group is bound a master display group. Does nothing if this is not a detail display group.


hasDetailDataSource

public boolean hasDetailDataSource()
Returns whether the data source is a detail data source, suggesting that this is a detail display group.


masterObject

public java.lang.Object masterObject()
Returns the selected object in the master display group, or null if this is not a detail display group.


setMasterObject

public void setMasterObject(java.lang.Object anObject)
Sets the master object in the detail data source. Does nothing if there is no detail data source.


setDelegate

public void setDelegate(java.lang.Object aDelegate)
Sets the display group delegate that will be used by this display group.


delegate

public java.lang.Object delegate()
Returns the current delegate for this display group, or null if no delegate is currently set.


defaultStringMatchFormat

public java.lang.String defaultStringMatchFormat()
Returns the current string matching format. If not set, defaults to "%@*".


defaultStringMatchOperator

public java.lang.String defaultStringMatchOperator()
Returns the current string matching operator. If not set, defaults to "caseInsensitiveLike".


enterQueryMode

public void enterQueryMode(java.lang.Object aSender)
Sets the display group and associations to edit a "query by example" query object. This method is used for target/action connections.


fetchesOnLoad

public boolean fetchesOnLoad()
Returns whether this display group should immediate fetch when loaded.


inQueryMode

public boolean inQueryMode()
Returns whether this display group is in "query by example" mode.


insertedObjectDefaultValues

public net.wotonomy.foundation.NSDictionary insertedObjectDefaultValues()
Returns a Map of default values that are applied to new objects that are inserted into the list.


localKeys

public net.wotonomy.foundation.NSArray localKeys()
Returns the keys that were declared when read from an external resource file.


selectsFirstObjectAfterFetch

public boolean selectsFirstObjectAfterFetch()
Sets whether this display group will select the first object in the list after a fetch.


setDefaultStringMatchFormat

public void setDefaultStringMatchFormat(java.lang.String aFormat)
Sets the default string matching format that will be used by this display group.


setDefaultStringMatchOperator

public void setDefaultStringMatchOperator(java.lang.String anOperator)
Sets the default string matching operator that will be used by this display group.


setFetchesOnLoad

public void setFetchesOnLoad(boolean willFetch)
Sets whether this display group will fetch objects from its data source on load.


setInQueryMode

public void setInQueryMode(boolean isInQueryMode)
Sets whether this display group is in "query by example" mode. If true, all associations will bind to a special "example" object.


setInsertedObjectDefaultValues

public void setInsertedObjectDefaultValues(java.util.Map aMap)
Sets the mapping that contains the values that will be applied to new objects inserted into the display group.


setLocalKeys

public void setLocalKeys(java.util.List aKeyList)
Sets the keys that are declared when instantiated from an external resource file.


setSelectsFirstObjectAfterFetch

public void setSelectsFirstObjectAfterFetch(boolean selectsFirst)
Sets whether the first object in the list will be selected after a fetch.


setSortOrderings

public void setSortOrderings(java.util.List aList)
Sets the order of the keys by which this display group will be ordered after a fetch or after a call to updateDisplayedObjects(). The elements in the display group will be sorted first by the first key, within the first key, by the second key, and so on.


setUsesOptimisticRefresh

public void setUsesOptimisticRefresh(boolean isOptimistic)
Sets whether only changed objects are refreshed (optimistic), or whether all objects are refreshed (pessimistic, default). By default, when the display group receives notification that one of its objects has changed, updateDisplayedObjects is called.


setValidatesChangesImmediately

public void setValidatesChangesImmediately(boolean validatesImmediately)
Sets whether changes made by associations are validated immediately, or when changes are saved.


sortOrderings

public net.wotonomy.foundation.NSArray sortOrderings()
Returns a read-only List of sort orderings for this display group.


usesOptimisticRefresh

public boolean usesOptimisticRefresh()
Returns whether this display group refreshes only the changed objects or all objects on refresh.


validatesChangesImmediately

public boolean validatesChangesImmediately()
Returns whether this display group validates changes immediately. Otherwise, validation should occur when changes are saved. Default is the global default, which is initially true.


qualifier

public net.wotonomy.control.EOQualifier qualifier()
Returns a qualifier that will be applied all the objects in this display group to determine which objects will be displayed.


qualifierFromQueryValues

public net.wotonomy.control.EOQualifier qualifierFromQueryValues()
Returns a new qualifier built from the three query value maps: greater than, equal to, and less than.


qualifyDataSource

public void qualifyDataSource()
Calls qualifierFromQueryValues(), applies the result to the data source, and calls fetch().


qualifyDisplayGroup

public void qualifyDisplayGroup()
Calls qualifierFromQueryValues(), sets the qualifier with setQualifier(), and calls updateDisplayedObjects().


queryBindingValues

public net.wotonomy.foundation.NSDictionary queryBindingValues()
Returns a Map containing the mappings of keys to binding query values.


queryBindings

public net.wotonomy.foundation.NSMutableDictionary queryBindings()
Returns a Map containing the mappings of keys to binding query values.


queryMatch

public net.wotonomy.foundation.NSMutableDictionary queryMatch()
Returns a Map containing the mappings of keys to binding query values for a matching query.


queryMin

public net.wotonomy.foundation.NSMutableDictionary queryMin()
Returns a Map containing the mappings of keys to binding query values for a minimum value query.


queryMax

public net.wotonomy.foundation.NSMutableDictionary queryMax()
Returns a Map containing the mappings of keys to binding query values for a maximum value query.


queryOperator

public net.wotonomy.foundation.NSMutableDictionary queryOperator()
Returns a Map containing the mappings of keys to operator values.


allQualifierOperators

public net.wotonomy.foundation.NSArray allQualifierOperators()
Returns a list containing all supported qualifier operators.


queryOperatorValues

public net.wotonomy.foundation.NSDictionary queryOperatorValues()
Returns a Map containing the mappings of keys to operator values.


setQualifier

public void setQualifier(net.wotonomy.control.EOQualifier aQualifier)
Sets the qualifier that will be used by updateDisplayedObjects() to filter displayed objects.


setQueryBindingValues

public void setQueryBindingValues(java.util.Map aMap)
Sets the mapping that contains the mappings of keys to binding values.


setQueryOperatorValues

public void setQueryOperatorValues(java.util.Map aMap)
Sets the mapping that contains the mappings of keys to operator values.


equalToQueryValues

public net.wotonomy.foundation.NSDictionary equalToQueryValues()
Returns a Map containing the mappings of keys to query values that will be used to test for equality.


greaterThanQueryValues

public net.wotonomy.foundation.NSDictionary greaterThanQueryValues()
Returns a Map containing the mappings of keys to query values that will be used to test for greater value.


lessThanQueryValues

public net.wotonomy.foundation.NSDictionary lessThanQueryValues()
Returns a Map containing the mappings of keys to query values that will be used to test for lesser value.


setEqualToQueryValues

public void setEqualToQueryValues(java.util.Map aMap)
Sets the Map that contains the mappings of keys to query values that will be used to test for equality.


setGreaterThanQueryValues

public void setGreaterThanQueryValues(java.util.Map aMap)
Sets the mapping that contains the mappings of keys to query values that will be used to test for greater value.


setLessThanQueryValues

public void setLessThanQueryValues(java.util.Map aMap)
Sets the mapping that contains the mappings of keys to query values that will be used to test for lesser value.


endEditing

public boolean endEditing()
Deprecated: returns true.


allObjects

public net.wotonomy.foundation.NSArray allObjects()
Returns a read-only List containing all objects managed by the display group. This includes those objects not visible due to disqualification.


batchCount

public int batchCount()
Returns the total number of batches held by this display group.


currentBatchIndex

public int currentBatchIndex()
Returns the index of the currently displayed batch.


setCurrentBatchIndex

public void setCurrentBatchIndex(int aBatchIndex)
Sets the index of the currently displayed batch.


displayBatchContainingSelectedObject

public java.lang.Object displayBatchContainingSelectedObject()
Sets the displayed objects to the batch containing the first selected object, and updates the current batch index, and returns null to force a page reload. Displays the first batch is there is no selection.


displayNextBatch

public java.lang.Object displayNextBatch()
Sets the displayed objects to the next batch and updates the current batch index, and returns null to force a page reload. If there is no next batch the first batch is displayed.


displayPreviousBatch

public java.lang.Object displayPreviousBatch()
Sets the displayed objects to the next batch and updates the current batch index, and returns null to force a page reload. If there is no previous batch, the last batch is displayed.


hasMultipleBatches

public boolean hasMultipleBatches()
Returns whether the displayed objects have been batched.


indexOfFirstDisplayedObject

public int indexOfFirstDisplayedObject()
Returns the one-based index within the displayed objects list of the first displayed object in the current batch.


indexOfLastDisplayedObject

public int indexOfLastDisplayedObject()
Returns the one-based index within the displayed objects list of the first last object in the current batch.


numberOfObjectsPerBatch

public int numberOfObjectsPerBatch()
Returns the number of objects per batch.


setNumberOfObjectsPerBatch

public void setNumberOfObjectsPerBatch(int aSize)
Returns the number of objects per batch.


clearSelection

public boolean clearSelection()
Clears the current selection.

Returns:
True is the selection was cleared, False if the selection could not be cleared
See Also:
setSelectionIndexes(java.util.List)

delete

public java.lang.Object delete()
Convenience for binding to a component action: calls deleteSelection() and then displayBatchContainingSelectedObject() and returns null, which is a suitable result from a component action.


deleteObjectAtIndex

public boolean deleteObjectAtIndex(int anIndex)
Deletes the object at the specified index, notifying the delegate before and after the operation, and then updating the selection if needed.

Returns:
True if delete was successful, false if the object was not deleted.

deleteSelection

public boolean deleteSelection()
Deletes the currently selected objects. This implementation calls deleteObjectAtIndex() for each index in the selection list, immediately returning false if any delete operation fails.

Returns:
True if all selected objects were deleted, false if any deletion failed.

displayedObjects

public net.wotonomy.foundation.NSArray displayedObjects()
Returns a read-only List of all objects in the display group that are currently displayed by the associations.


fetch

public java.lang.Object fetch()
Requests a list of objects from the DataSource and calls setObjectArray to populate the list. More specifically, calls endEditing(), asks the delegate, fetches the objects, notifies the delegate, and populates the list. Returns null to force a page reload.


insert

public java.lang.Object insert()
Convenience to call insertNewObjectAtIndex with the current selection plus one, or at the end of the list if there is no selection. Returns null to force a page reload.


insertNewObjectAtIndex

public java.lang.Object insertNewObjectAtIndex(int anIndex)
Creates a new object at the specified index. Calls insertObjectAtIndex() with the result from sending createObject() to the data source.

Returns:
the newly created object.

insertObjectAtIndex

public void insertObjectAtIndex(java.lang.Object anObject,
                                int anIndex)
Inserts the specified object into the list at the specified index.


redisplay

public void redisplay()
Sets contentsChanged to true and notifies all observers.


selectNext

public java.lang.Object selectNext()
Sets the selection to the next displayed object after the current selection. If the last object is selected, or if no object is selected, then the first object becomes selected. If multiple items are selected, the first selected item is considered the selected item for the purposes of this method. Does not call redisplay().

Returns:
null to force a page reload.

selectObject

public boolean selectObject(java.lang.Object anObject)
Sets the selection to the specified object. If the specified object is null or does not exist in the list of displayed objects, the selection will be cleared.

Returns:
true if the object was selected.

selectObjectsIdenticalTo

public boolean selectObjectsIdenticalTo(java.util.List anObjectList)
Sets the selection to the specified objects. If the specified list is null or if none of the objects in the list exist in the list of displayed objects, the selection will be cleared.

Returns:
true if all specified objects were selected.

selectObjectsIdenticalToSelectFirstOnNoMatch

public boolean selectObjectsIdenticalToSelectFirstOnNoMatch(java.util.List anObjectList,
                                                            boolean selectFirstIfNoMatch)
Calls selectObjectsIdenticalTo and if false is returned and selectFirstIfNoMatch is true, selects the first object.


selectPrevious

public java.lang.Object selectPrevious()
Sets the selection to the previous displayed object before the current selection. If the first object is selected, or if no object is selected, then the last object becomes selected. If multiple items are selected, the first selected item is considered the selected item for the purposes of this method. Does not call redisplay().

Returns:
null to force a page reload.

selectedObject

public java.lang.Object selectedObject()
Returns the currently selected object, or null if there is no selection.


selectedObjects

public net.wotonomy.foundation.NSArray selectedObjects()
Returns a read-only List containing all selected objects, if any. Returns an empty list if no objects are selected.


selectionIndexes

public net.wotonomy.foundation.NSArray selectionIndexes()
Returns a read-only List containing the indexes of all selected objects, if any. The list contains instances of java.lang.Number; call intValue() to retrieve the index.


setObjectArray

public void setObjectArray(java.util.List anObjectList)
Sets the objects managed by this display group. updateDisplayedObjects() is called to filter the display objects. The previous selection will be maintained if possible. The data source is not notified.


setSelectedObject

public void setSelectedObject(java.lang.Object anObject)
Sets the currently selected object, or clears the selection if the object is not found or is null. Note: it's not clear how this differs from selectObject in the spec. It is recommended that you call selectObject for now.


setSelectedObjects

public void setSelectedObjects(java.util.List aList)
Sets the current selection to the specified objects. The previous selection is cleared, and any objects in the display group that are in the specified list are then selected. If no items in the specified list are found in the display group, then the selection is effectively cleared. Note: it's not clear how this differs from selectObjectsIdenticalTo in the spec. It is recommended that you call that method for now.


setSelectionIndexes

public boolean setSelectionIndexes(java.util.List aList)
Sets the current selection to the objects at the specified indexes. Items in the list are assumed to be instances of java.lang.Number. The previous selection is cleared, and any objects in the display group that are in the specified list are then selected. If no items in the specified list are found in the display group, then the selection is effectively cleared.


updateDisplayedObjects

public void updateDisplayedObjects()
Applies the qualifier to all objects and sorts the results to update the list of displayed objects. Observing associations are notified to reflect the changes.


updatedObjectIndex

public int updatedObjectIndex()
Returns the index of the changed object. If more than one object has changed, -1 is returned.


selectedObjectValueForKey

public java.lang.Object selectedObjectValueForKey(java.lang.String aKey)
Returns a value on the selected object for the specified key.


setSelectedObjectValue

public boolean setSelectedObjectValue(java.lang.Object aValue,
                                      java.lang.String aKey)
Sets the specified value for the specified key on all selected objects.


setValueForObject

public boolean setValueForObject(java.lang.Object aValue,
                                 java.lang.Object anObject,
                                 java.lang.String aKey)
Sets the specified value for the specified key on the specified object. Validations may be triggered, and error dialogs may appear to the user.

Returns:
True if the value was set successfully, false if the value could not be set and the update operation should not continue.

setValueForObjectAtIndex

public boolean setValueForObjectAtIndex(java.lang.Object aValue,
                                        int anIndex,
                                        java.lang.String aKey)
Calls setValueForObject() for the object at the specified index.


valueForObject

public java.lang.Object valueForObject(java.lang.Object anObject,
                                       java.lang.String aKey)
Returns the value for the specified key on the specified object.


valueForObjectAtIndex

public java.lang.Object valueForObjectAtIndex(int anIndex,
                                              java.lang.String aKey)
Calls valueForObject() for the object at the specified index. Returns null if out of bounds.


toString

public java.lang.String toString()
Prints out the list of displayed objects.

Overrides:
toString in class java.lang.Object

objectsInvalidatedInEditingContext

public void objectsInvalidatedInEditingContext(net.wotonomy.foundation.NSNotification aNotification)
Handles notifications from the data source's editing context, looking for InvalidatedAllObjectsInStoreNotification and ObjectsChangedInEditingContextNotification, refetching in the former case and updating displayed objects in the latter. Note: This method is not in the public specification.


globalDefaultForValidatesChangesImmediately

public static boolean globalDefaultForValidatesChangesImmediately()
Specifies the default behavior for whether changes should be validated immediately for all display groups.


globalDefaultStringMatchFormat

public static java.lang.String globalDefaultStringMatchFormat()
Specifies the default string matching format for all display groups.


globalDefaultStringMatchOperator

public static java.lang.String globalDefaultStringMatchOperator()
Specifies the default string matching operator for all display groups.


setGlobalDefaultForValidatesChangesImmediately

public static void setGlobalDefaultForValidatesChangesImmediately(boolean validatesImmediately)
Sets the default behavior for validating changes for all display groups.


setGlobalDefaultStringMatchFormat

public static void setGlobalDefaultStringMatchFormat(java.lang.String aFormat)
Sets the default string matching format that will be used by all display groups.


setGlobalDefaultStringMatchOperator

public static void setGlobalDefaultStringMatchOperator(java.lang.String anOperator)
Sets the default string matching operator that will be used by all display groups.


willChange

protected void willChange()
Needed because we don't inherit from NSObject. Calls EOObserverCenter.notifyObserversObjectWillChange.


objectWillChange

public void objectWillChange(java.lang.Object anObject)
Receives notifications of changes from objects that are managed by this display group. This implementation sets updatedObjectIndex as appropriate.

Specified by:
objectWillChange in interface net.wotonomy.control.EOObserving

editingContextWillSaveChanges

public void editingContextWillSaveChanges(net.wotonomy.control.EOEditingContext anEditingContext)
Called before the editing context begins to save changes. This implementation calls endEditing().

Specified by:
editingContextWillSaveChanges in interface net.wotonomy.control.EOEditingContext.Editor

editorHasChangesForEditingContext

public boolean editorHasChangesForEditingContext(net.wotonomy.control.EOEditingContext anEditingContext)
Called to determine whether this editor has changes that have not been committed to the object in the context. This implementation returns false.

Specified by:
editorHasChangesForEditingContext in interface net.wotonomy.control.EOEditingContext.Editor

editingContextPresentErrorMessage

public void editingContextPresentErrorMessage(net.wotonomy.control.EOEditingContext anEditingContext,
                                              java.lang.String aMessage)
Called to display a message for an error that occurred in the specified editing context. If the delegate allows, this implementation writes a message to the standard output. Override to customize.


editingContextShouldContinueFetching

public boolean editingContextShouldContinueFetching(net.wotonomy.control.EOEditingContext anEditingContext,
                                                    int count,
                                                    int limit,
                                                    net.wotonomy.control.EOObjectStore anObjectStore)
Called by the specified object store to determine whether fetching should continue, where count is the current count and limit is the limit as specified by the fetch specification. This implementation returns true. Override to customize.



Copyright © 2006 null. All Rights Reserved.