Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EOEntityController


Inherits from:
EOComponentController : EOController : Object
Implements:
EOObserving
EOObjectDisplay
EOAssociationConnector
EOComponentController.EndEditing
Package:
com.webobjects.eoapplication


Class Description


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.


User Interface Archive

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).


Managing the Editing Context

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.


Managing the Display Group

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" (page 182).

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.


Rule System and XML Description

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" (page 8) 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.




Constants



Constant Description
NestedEditingContextProviderMethodName Description forthcoming.
NewDisplayGroupProviderMethodName Description forthcoming.
NewEditingContextProviderMethodName Description forthcoming.



Interfaces Implemented


EOObserving
objectWillChange
EOObjectDisplay
controllerDisplayGroup
displayGroup
editingContext
entityName
EOAssociationConnector
takeResposibilityForConnectionOfAssociation
EOComponentController.EndEditing
endEditing
NSDisposable (Inherited from EOController)
dispose
EOKeyValueCodingAdditions (Inherited from EOController)
EOAction.Enabling (Inherited from EOController)
EOKeyValueCoding (Inherited from EOKeyValueCodingAdditions)
NSKeyValueCoding (Inherited from EOKeyValueCoding)


Method Types


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


Constructors



EOEntityController

public EOEntityController(EOXMLUnarchiver unarchiver)

Description forthcoming.

public EOEntityController()

Description forthcoming.


Instance Methods



archiveName

public String archiveName()

Description forthcoming.

connectionWasBroken

protected void connectionWasBroken()

Description forthcoming.

connectionWasEstablished

protected void connectionWasEstablished()

Description forthcoming.

controllerDidLoadArchive

protected void controllerDidLoadArchive(NSDictionary aNSDictionary)

Description forthcoming.

controllerDisplayGroup

public com.webobjects.eointerface.EODisplayGroup controllerDisplayGroup()

Description forthcoming.

displayGroup

public com.webobjects.eointerface.EODisplayGroup displayGroup()

Description forthcoming.

displayGroupProviderMethodName

public String displayGroupProviderMethodName()

Description forthcoming.

displayGroupSortOrderings

protected NSArray displayGroupSortOrderings()

Description forthcoming.

dispose

public void dispose()

Description forthcoming.

editingContext

public com.webobjects.eocontrol.EOEditingContext editingContext()

Description forthcoming.

editingContextProviderMethodName

public String editingContextProviderMethodName()

Description forthcoming.

endEditing

public boolean endEditing()

Description forthcoming.

entityName

public String entityName()

Description forthcoming.

establishConnection

public void establishConnection()

Description forthcoming.

fetchesOnConnect

public boolean fetchesOnConnect()

Description forthcoming.

handleEditingContextNotification

public void handleEditingContextNotification(NSNotification aNSNotification)

Description forthcoming.

hasControllerDisplayGroup

public boolean hasControllerDisplayGroup()

Description forthcoming.

isRootEntityController

public boolean isRootEntityController()

Description forthcoming.

loadArchive

protected boolean loadArchive()

Description forthcoming.

nestedEditingContext

public com.webobjects.eocontrol.EOEditingContext nestedEditingContext()

Description forthcoming.

newDataSource

protected com.webobjects.eocontrol.EODataSource newDataSource()

Description forthcoming.

newDisplayGroup

public com.webobjects.eointerface.EODisplayGroup newDisplayGroup()

Description forthcoming.

newDisplayGroupUsingOptimisticRefresh

public com.webobjects.eointerface.EODisplayGroup newDisplayGroupUsingOptimisticRefresh()

Description forthcoming.

newEditingContext

public com.webobjects.eocontrol.EOEditingContext newEditingContext()

Description forthcoming.

objectForOutletPath

public Object objectForOutletPath( EOArchive anEOArchive, String aString)

Description forthcoming.

objectWillChange

public void objectWillChange(Object anObject)

Description forthcoming.

prepareComponent

protected void prepareComponent()

Description forthcoming.

prepareForNewTask

public void prepareForNewTask(boolean aBoolean)

Description forthcoming.

resetsEditingContextWhenPreparingForNewTask

public boolean resetsEditingContextWhenPreparingForNewTask()

Description forthcoming.

selectedObject

public com.webobjects.eocontrol.EOEnterpriseObject selectedObject()

Description forthcoming.

selectedObjectGlobalID

public com.webobjects.eocontrol.EOGlobalID selectedObjectGlobalID()

Description forthcoming.

selectedObjects

public NSArray selectedObjects()

Description forthcoming.

selectedObjectsGlobalIDs

public NSArray selectedObjectsGlobalIDs()

Description forthcoming.

setArchiveName

public void setArchiveName(String aString)

Description forthcoming.

setControllerDisplayGroup

public void setControllerDisplayGroup(com.webobjects.eointerface.EODisplayGroup anEODisplayGroup)

Description forthcoming.

setDisplayGroup

public void setDisplayGroup(com.webobjects.eointerface.EODisplayGroup anEODisplayGroup)

Description forthcoming.

setDisplayGroupProviderMethodName

public void setDisplayGroupProviderMethodName(String aString)

Description forthcoming.

setEditingContext

public void setEditingContext(com.webobjects.eocontrol.EOEditingContext anEOEditingContext)

Description forthcoming.

setEditingContextProviderMethodName

public void setEditingContextProviderMethodName(String aString)

Description forthcoming.

setEntityName

public void setEntityName(String aString)

Description forthcoming.

setFetchesOnConnect

public void setFetchesOnConnect(boolean aBoolean)

Description forthcoming.

setObjectWithGlobalID

public void setObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID anEOGlobalID)

Description forthcoming.

setObjectsWithFetchSpecification

public void setObjectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification anEOFetchSpecification)

Description forthcoming.

setResetsEditingContextWhenPreparingForNewTask

public void setResetsEditingContextWhenPreparingForNewTask(boolean aBoolean)

Description forthcoming.

startListeningToDisplayGroup

protected void startListeningToDisplayGroup()

Description forthcoming.

startListeningToEditingContext

protected void startListeningToEditingContext()

Description forthcoming.

stopListeningToDisplayGroup

protected void stopListeningToDisplayGroup()

Description forthcoming.

stopListeningToEditingContext

protected void stopListeningToEditingContext()

Description forthcoming.

takeResposibilityForConnectionOfAssociation

public void takeResposibilityForConnectionOfAssociation(com.webobjects.eointerface.EOAssociation anEOAssociation)

Description forthcoming.

toString

public String toString()

Description forthcoming.

willChange

public void willChange()

Description forthcoming.

© 2001 Apple Computer, Inc. (Last Published April 14, 2001)


Table of Contents