PATH |
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
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.
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.
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. |
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)
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
public EODocumentController()
public EODocumentController(EOXMLUnarchiver unarchiver)
public boolean canPerformActionNamed(String actionName)
See Also: canPerformActionNamed (EOAction.Enabling)
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.
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.
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.
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.
protected void connectionWasEstablished()
protected NSArray defaultActions()
public void deleteSelectedObjects()
true
.
public void dispose()
public int editability()
public void handleEditingContextNotification(NSNotification notification)
public void insertObject()
true
.
public boolean isDocumentForGlobalID( com.webobjects.eocontrol.EOGlobalID globalID, String entityName)
public boolean isEditable()
public boolean isEdited()
public boolean isRootDocumentController()
true
if none of the supercontrollers are EODocuments, false
otherwise.
public void prepareForNewTask(boolean flag)
false
.
public void redo()
public boolean revert()
true
on success, false
upon failure or if the user cancels the revert.
public boolean revertAndMakeInvisible()
true
if changes are successfully reverted, false
if the receiver can't be reverted or if the revert fails.
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.
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.
public boolean save()
true
if changes are successfully saved, false
if the receiver can't save or if the save fails.
public boolean saveAndMakeInvisible()
true
if changes are successfully reverted, false
if the receiver can't be reverted or if the revert fails.
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.
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.
public boolean saveIfUserConfirms( String operationTitle, String message)
public boolean saveIfUserConfirms()
true
on success, false
upon failure or if the user cancels the save.
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.
public void setEditability(int editability)
public void setEdited(boolean flag)
public void supercontrollerEditabilityDidChange()
public void takeResponsibilityForEditabilityOfAssociation( com.webobjects.eointerface.EOAssociation association)
public String toString()
public void undo()
protected void wasEdited()
© 2001 Apple Computer, Inc. (Last Published April 14, 2001)