- Inherits from:
- EOComponentController : EOController : Object
- Implements:
- EOObserving
- EOObjectDisplay
- EOAssociationConnector
- EOComponentController.EndEditing
- NSInlineObservable (Inherited from EOController)
- NSDisposable (Inherited from EOController)
- EOKeyValueCodingAdditions (Inherited from EOController)
- EOAction.Enabling (Inherited from EOController)
- EOKeyValueCoding (Inherited from EOKeyValueCodingAdditions)
- NSKeyValueCoding (Inherited from EOKeyValueCoding)
- Package:
- com.apple.client.eoapplication
The EOEntityController class provides behavior for displaying enterprise objects in a user interface that can optionally be loaded from an archive (a nib file). EOEntityController's most basic API is specified by the interface EOObjectDisplay, which identifies an implementation strategy that uses EOEditingContexts and EODisplayGroups to manage an entity controller's enterprise objects. An entity controller has an entity name, which identifies the kind of enterprise objects the controller works with. Additionally it has an editing context that manages the controller's enterprise objects, a display group that displays the enterprise objects and manages a selection, and a controller display group that connects controller methods to the user interface. For more information, see the EOObjectDisplay interface specification.
As a subclass of EOComponentController, EOEntityController manages a user interface component. However, whereas component controllers dynamically generate their components, entity controllers have the ability to load their components from an archive. An entity controller has an archive name, which specifies the archive from which to load the controller's component. If, however, a controller doesn't have an archive name, the controller can fall back on dynamically generating its component (an empty EOView).
As mentioned earlier, EOEntityController uses an editing context to manage its enterprise objects. By default, an entity controller attempts to get its editing context from a supercontroller. An entity controller looks up the controller hierarchy for the first EOObjectDisplay ancestor that has an editing context. If it finds one, the entity controller uses that supercontroller's editing context. If it doesn't find one, it creates one.
You can change the way an entity controller gets its editing context by specifying a provider method with setEditingContextProviderMethodName. If an entity controller has an editing context provider method, it gets its editing context by invoking that method.
The provider method name is a string, which can be a key path or the name of an arbitrary class's static method. For an example of setting the method name to a key path, consider a subclass of EOEntityController that implements the method customizedEditingContext to return an editing context for the controller to use. In this case, the provider method name could be set to "customizedEditingContext".
If the provider method name is the name of a static method, the format of the string is "<class name>:<static method name>". For example, suppose that you've written a subclass of EOApplication that implements a static method, customizedEditingContextForAllControllers, to return an editing context for all an application's controllers to share. Then the editing context provider method name for all entity controllers could be set to "CustomApplicationClass:customizedEditingContextForAllControllers".
EOEntityController provides two methods that you can use as provider methods: newEditingContext and nestedEditingContext. The former simply creates a new editing context and is a convenience for setting the provider method. The latter attempts to create a new editing context that's nested inside an ancestor's editing context. If no ancestors provide an editing context to be a parent, nestedEditingContext simply creates a new editing context.
EOEntityController uses a display group to display its enterprise objects. By default, an entity controller attempts to get its display group from a supercontroller. An entity controller looks up the controller hierarchy for the first EOObjectDisplay ancestor. If that supercontroller has the same entity name and a display group, the entity controller uses that supercontroller's display group. If it doesn't find one, it invokes loadArchive to see if a display group is provided in the archive. If the controller still doesn't have a display group, it simply creates one.
You can change the way an entity controller gets its display group by specifying a provider method with setDisplayGroupProviderMethodName. If an entity controller has a display group provider method, it gets its display group by invoking that method. The display group provider method name works the same way the editing context provider method name works. For more information, see "Managing the Editing Context" .
EOEntityController provides two methods that you can use as provider methods: newDisplayGroup and newDisplayGroupUsingOptimisticRefresh. The simply create new display groups and are convenience methods for setting the provider method.
The following tables identify the controllerType
,
XML tag, and XML attributes used by the rule system and EOXMLUnarchiver
to generate a controller hierarchy. For more information, see the
section "Rule System and XML Description" in the package introduction.
Default Rule System Controller Type |
entityController |
XML Tag |
ENTITYCONTROLLER |
XML Attribute | Value | Description |
archive |
string | The name of a nib file from which the controller loads its component (instead of dynamically creating it). |
displayGroupProviderMethodName |
string | A key path or string of the form "<class name>:<method name>" that names a method the controller uses to create its display group. |
editingContextProviderMethodName |
string | A key path or string of the form "<class name>:<method name>" that names a method the controller uses to create its editing context. |
entity |
string | Name of the controller's entity. |
EOObserving
- objectWillChange
EOObjectDisplay
- controllerDisplayGroup
- displayGroup
- editingContext
- entityName
EOAssociationConnector
- takeResposibilityForConnectionOfAssociation
EOComponentController.EndEditing
- endEditing
NSInlineObservable (Inherited from EOController)
NSDisposable (Inherited from EOController)
- dispose
EOKeyValueCodingAdditions (Inherited from EOController)
EOAction.Enabling (Inherited from EOController)
EOKeyValueCoding (Inherited from EOKeyValueCodingAdditions)
NSKeyValueCoding (Inherited from EOKeyValueCoding)
- Constructors
- EOEntityController
- Setting the entity
- setEntityName
- Loading an archive
- prepareComponent
- loadArchive
- controllerDidLoadArchive
- objectForOutletPath
- setArchiveName
- archiveName
- Managing the editing context
- newEditingContext
- setEditingContext
- setEditingContextProviderMethodName
- editingContextProviderMethodName
- nestedEditingContext
- startListeningToEditingContext
- stopListeningToEditingContext
- handleEditingContextNotification
- setResetsEditingContextWhenPreparingForNewTask
- resetsEditingContextWhenPreparingForNewTask
- Managing the controller display group
- setControllerDisplayGroup
- hasControllerDisplayGroup
- Managing the objects display group
- newDataSource
- newDisplayGroup
- newDisplayGroupUsingOptimisticRefresh
- setDisplayGroup
- startListeningToDisplayGroup
- stopListeningToDisplayGroup
- setObjectWithGlobalID
- setObjectsWithFetchSpecification
- displayGroupSortOrderings
- setDisplayGroupProviderMethodName
- displayGroupProviderMethodName
- Accessing selected objects
- selectedObject
- selectedObjectGlobalID
- selectedObjects
- selectedObjectsGlobalIDs
- Fetching
- fetchesOnConnect
- setFetchesOnConnect
- Determining the root document controller
- isRootEntityController
- Notifying observers of change
- willChange
- Methods inherited from EOController
- connectionWasBroken
- connectionWasEstablished
- establishConnection
- prepareForNewTask
- Methods inherited from Object
- toString
public EOEntityController(EOXMLUnarchiver unarchiver)
public String archiveName()
protected void connectionWasBroken()
protected void connectionWasEstablished()
protected void controllerDidLoadArchive(NSDictionary aNSDictionary)
public com.apple.client.eointerface.EODisplayGroup controllerDisplayGroup()
public com.apple.client.eointerface.EODisplayGroup displayGroup()
public String displayGroupProviderMethodName()
protected NSArray displayGroupSortOrderings()
public void dispose()
public com.apple.client.eocontrol.EOEditingContext editingContext()
public String editingContextProviderMethodName()
public boolean endEditing()
public String entityName()
public void establishConnection()
public boolean fetchesOnConnect()
public void handleEditingContextNotification(NSNotification aNSNotification)
public boolean hasControllerDisplayGroup()
protected boolean isRootEntityController()
protected boolean loadArchive()
public com.apple.client.eocontrol.EOEditingContext nestedEditingContext()
protected com.apple.client.eocontrol.EODataSource newDataSource()
public com.apple.client.eointerface.EODisplayGroup newDisplayGroup()
public com.apple.client.eointerface.EODisplayGroup newDisplayGroupUsingOptimisticRefresh()
public com.apple.client.eocontrol.EOEditingContext newEditingContext()
public Object objectForOutletPath(
EOArchive anEOArchive,
String aString)
public void objectWillChange(Object anObject)
protected void prepareComponent()
public void prepareForNewTask(boolean aBoolean)
public boolean resetsEditingContextWhenPreparingForNewTask()
public com.apple.client.eocontrol.EOEnterpriseObject selectedObject()
public com.apple.client.eocontrol.EOGlobalID selectedObjectGlobalID()
public NSArray selectedObjects()
public NSArray selectedObjectsGlobalIDs()
public void setArchiveName(String aString)
public void setControllerDisplayGroup(com.apple.client.eointerface.EODisplayGroup anEODisplayGroup)
public void setDisplayGroup(com.apple.client.eointerface.EODisplayGroup anEODisplayGroup)
public void setDisplayGroupProviderMethodName(String aString)
public void setEditingContext(com.apple.client.eocontrol.EOEditingContext anEOEditingContext)
public void setEditingContextProviderMethodName(String aString)
public void setEntityName(String aString)
public void setFetchesOnConnect(boolean aBoolean)
public void setObjectWithGlobalID(com.apple.client.eocontrol.EOGlobalID anEOGlobalID)
public void setObjectsWithFetchSpecification(com.apple.client.eocontrol.EOFetchSpecification anEOFetchSpecification)
public void setResetsEditingContextWhenPreparingForNewTask(boolean aBoolean)
protected void startListeningToDisplayGroup()
protected void startListeningToEditingContext()
protected void stopListeningToDisplayGroup()
protected void stopListeningToEditingContext()
public void takeResposibilityForConnectionOfAssociation(com.apple.client.eointerface.EOAssociation anEOAssociation)
public String toString()
public void willChange()
DRAFT