PATH |
EODocumentController
Inherits from: EOEntityController : EOComponentController : EOController
Implements: EODocument EOEditable EOAssociationConnector (Inherited from EOEntityController) EOComponentController.EndEditing (Inherited from EOEntityController) EOObserving (Inherited from EOEntityController) EOObjectDisplay (Inherited from EOEntityController) 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.webobjects.eoapplication
Class Description
The EODocumentController class provides behavior for displaying and editing enterprise objects in a user interface. EODocumentController's API is mostly specified by the interfaces EODocument and EOEditable. Additionally, much of the way that EODocumentController works is set up by its superclass, EOEntityController. Since EOEntityControllers use EOEditingContexts and EODisplayGroups to manage and display a set of enterprise objects; EODocumentControllers use them as well. However, in addition to displaying enterprise objects, document controllers can also edit their objects. You can insert, update, and delete enterprise objects; undo and redo unsaved changes; and save and revert.
EODocumentController provides several methods that interact with a user. For example, the methods revert and saveIfUserConfirms open dialogs to confirm that a user wants to revert or save before performing the action. Also, many of the methods open dialogs when an error occurs, telling the user what happened.
Root Document Controller Responsibilities
EODocumentController defines the concept of a root document controller. A document controller is the root if none of its ancestors are EODocuments. A root document controller usually provides the editing context for all its descendent document controllers-they typically don't have their own. Consequently, the root document controller has responsibilities that non-root document controllers don't have. For example, only the root document controller provides save and revert behavior.
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 |
DOCUMENTCONTROLLER |
XML Attribute | Value | Description |
editability |
string | One of "Never", "Always", or "IfSupercontroller". See the EOEditable interface specification for more information on these settings. |
Interfaces Implemented
EODocument isDocumentForGlobalID isEdited save saveIfUserConfirms setEdited EOEditable editability isEditable setEditability supercontrollerEditabilityDidChange takeResponsibilityForEditabilityOfAssociation EOAssociationConnector (Inherited from EOEntityController) EOComponentController.EndEditing (Inherited from EOEntityController) EOObserving (Inherited from EOEntityController) EOObjectDisplay (Inherited from EOEntityController) NSInlineObservable (Inherited from EOController) NSDisposable (Inherited from EOController) dispose EOKeyValueCodingAdditions (Inherited from EOController) EOAction.Enabling (Inherited from EOController) canPerformActionNamed EOKeyValueCoding (Inherited from EOKeyValueCodingAdditions) NSKeyValueCoding (Inherited from EOKeyValueCoding)
Method Types
Constructors EODocumentController Inserting, updating, and deleting insertObject deleteSelectedObjects wasEdited Saving canSave saveChanges saveAndMakeInvisible saveIfUserConfirms saveIfUserConfirmsAndMakeInvisible saveIfUserConfirmsAndMakeInvisible saveFailed Reverting canRevert revert revertAndMakeInvisible revertChanges revertFailed Undoing and Redoing canUndo undo canRedo redo Determining the root document controller isRootDocumentController Methods inherited from EOEntityController handleEditingContextNotification Methods inherited from EOController connectionWasEstablished defaultActions prepareForNewTask Methods inherited from Object toString
Constructors
EODocumentController
public EODocumentController()
public EODocumentController(EOXMLUnarchiver unarchiver)
Instance Methods
canPerformActionNamed
public boolean canPerformActionNamed(String actionName)
See Also: canPerformActionNamed (EOAction.Enabling)
canRedo
public boolean canRedo()
true
if the receiver can redo, false
otherwise. A document controller can redo as long as its editing context's undo manager can redo and as long as it (or one of its subcontrollers) is editable.
canRevert
public boolean canRevert()
true
if the receiver can revert, false
otherwise. A document controller can revert only if it's been edited and only if it's the root document controller.
canSave
public boolean canSave()
true
if the receiver can save, false
otherwise. A document controller can save only if it's been edited and only if it's the root document controller.
canUndo
public boolean canUndo()
true
if the receiver can undo, false
otherwise. A document controller can undo as long as its editing context's undo manager can undo and as long as it (or one of its subcontrollers) is editable.
connectionWasEstablished
protected void connectionWasEstablished()
defaultActions
protected NSArray defaultActions()
deleteSelectedObjects
public void deleteSelectedObjects()
true
.
dispose
public void dispose()
editability
public int editability()
handleEditingContextNotification
public void handleEditingContextNotification(NSNotification notification)
insertObject
public void insertObject()
true
.
isDocumentForGlobalID
public boolean isDocumentForGlobalID( com.webobjects.eocontrol.EOGlobalID globalID, String entityName)
isEditable
public boolean isEditable()
isEdited
public boolean isEdited()
isRootDocumentController
public boolean isRootDocumentController()
true
if none of the supercontrollers are EODocuments, false
otherwise.
prepareForNewTask
public void prepareForNewTask(boolean flag)
false
.
redo
public void redo()
revert
public boolean revert()
true
on success, false
upon failure or if the user cancels the revert.
revertAndMakeInvisible
public boolean revertAndMakeInvisible()
true
if changes are successfully reverted, false
if the receiver can't be reverted or if the revert fails.
revertChanges
public boolean revertChanges(boolean showErrorDialog)
false
. If the revert fails, catches the exception and, if showErrorDialog is true, invokes revertFailed to show the reason for failure. Returns true
if the revert succeeds, false
otherwise.
revertFailed
protected void revertFailed( Exception exception, boolean showErrorDialog)
true
, brings the receiver's user interface to the front and opens a dialog displaying exception's class name and exception message. Invoked from revertChanges.
save
public boolean save()
true
if changes are successfully saved, false
if the receiver can't save or if the save fails.
saveAndMakeInvisible
public boolean saveAndMakeInvisible()
true
if changes are successfully reverted, false
if the receiver can't be reverted or if the revert fails.
saveChanges
public boolean saveChanges( boolean showErrorDialog, String saveOperationTitle)
false
. If the save fails, catches the exception and, if showErrorDialog is true, invokes saveFailed to show the reason for failure. Returns true
if the save succeeds, false
otherwise.
saveFailed
protected void saveFailed( Exception showErrorDialog, boolean showErrorDialog, String saveOperationTitle)
true
, brings the receiver's user interface to the front and opens a dialog displaying exception's class name and exception message. Invoked from saveChanges.
saveIfUserConfirms
public boolean saveIfUserConfirms( String operationTitle, String message)
public boolean saveIfUserConfirms()
true
on success, false
upon failure or if the user cancels the save.
saveIfUserConfirmsAndMakeInvisible
public boolean saveIfUserConfirmsAndMakeInvisible( String operationTitle, String message)
public boolean saveIfUserConfirmsAndMakeInvisible()
null
. If the no-argument form of this method is invoked, then the title of the confirmation dialog is "Close" and the dialog has no message. Returns true
if changes are successfully saved, false
if the receiver can't be saved or if the save fails.
setEditability
public void setEditability(int editability)
setEdited
public void setEdited(boolean flag)
supercontrollerEditabilityDidChange
public void supercontrollerEditabilityDidChange()
takeResponsibilityForEditabilityOfAssociation
public void takeResponsibilityForEditabilityOfAssociation( com.webobjects.eointerface.EOAssociation association)
toString
public String toString()
undo
public void undo()
wasEdited
protected void wasEdited()
© 2001 Apple Computer, Inc. (Last Published April 14, 2001)