|
WebObjects 5.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.webobjects.eoapplication.EOController
|
+--com.webobjects.eoapplication.EOComponentController
|
+--com.webobjects.eoapplication.EOEntityController
|
+--com.webobjects.eoapplication.EODocumentController
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 also edit the displayed objects. You can insert, update, and delete enterprise objects; undo and redo unsaved changes; and save and revert.
EODocumentController provides several action methods to 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 document controller if none of its supercontrollers conform to EODocument. A root document controller usually provides the editing context for all its descendent document controllers -- the subcontrollers typically don't create 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.
| Inner classes inherited from class com.webobjects.eoapplication.EOComponentController |
EOComponentController.ActionCollector, EOComponentController.Activation, EOComponentController.EndEditing, EOComponentController.Modal, EOComponentController.ResetUserInterface |
| Inner classes inherited from class com.webobjects.eoapplication.EOController |
EOController.Enumeration |
| Inner classes inherited from class com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor |
| Inner classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility |
| Fields inherited from class com.webobjects.eoapplication.EOEntityController |
NestedEditingContextProviderMethodName, NewDisplayGroupProviderMethodName, NewDisplayGroupUsingOptimisticRefreshProviderMethodName, NewEditingContextProviderMethodName |
| Fields inherited from class com.webobjects.eoapplication.EOComponentController |
Bottom, BottomLeft, BottomRight, Center, Left, Right, Top, TopLeft, TopRight |
| Fields inherited from class com.webobjects.eoapplication.EOController |
ControllerAndSubcontrollersEnumeration, SubcontrollersEnumeration, SupercontrollersEnumeration |
| Fields inherited from interface com.webobjects.eoapplication.EOEditable |
AlwaysEditable, IfSupercontrollerEditable, NeverEditable |
| Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
| Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
KeyPathSeparator |
| Constructor Summary | |
EODocumentController()
Creates a new document controller. |
|
EODocumentController(EOXMLUnarchiver unarchiver)
Creates a new document controller from an EOXMLUnarchiver. |
|
| Method Summary | |
boolean |
canPerformActionNamed(String actionName)
Overridden to handle editing-related action enabling and disabling. |
boolean |
canRedo()
Returns whether the receiver can redo. |
boolean |
canRevert()
Returns whether the receiver can revert. |
boolean |
canSave()
Returns whether the receiver can save. |
boolean |
canUndo()
Returns whether the receiver can undo. |
protected void |
connectionWasEstablished()
Reacts to the connection for the receiver being established, taking care of editability issues in addition to the superclass implementation. |
protected NSArray |
defaultActions()
Adds actions for handling editing (like save, revert) the default actions defined by the superclass, EOEntityController (but only if the receiver is a root document controller and if it's not used in a modal dialog. |
void |
deleteSelectedObjects()
Deletes the objects selected in the receiver's display group and updates the edited status to true. |
void |
dispose()
Prepares the receiver so it is disposed when Java performs garbage collection. |
int |
editability()
Conformance to EOEditable. |
void |
handleEditingContextNotification(NSNotification notification)
In addition to the superclass implementation, updates the edited state of the receiver based on changes that happened in the receiver's editing context. |
void |
insertObject()
Creates a new enterprise object, inserts it into the receiver's display group and updates the edited status to true. |
boolean |
isDocumentForGlobalID(EOGlobalID globalID,
String entityName)
Conformance to EODocument. |
boolean |
isEditable()
Conformance to EOEditable. |
boolean |
isEdited()
Conformance to EODocument. |
boolean |
isRootDocumentController()
Returns whether the receiver is a root document controller (which is the case if none of the supercontrollers conform to EODocument). |
void |
prepareForNewTask(boolean prepareSubcontrollersForNewTask)
Prepares the receiver for performing a new task by resetting any data and resetting it's edited state. |
void |
redo()
Tells the receiver's editing context to redo the last editing state. |
boolean |
revert()
Reverts the receiver's editing context changes by invoking revertChanges,
requesting an error dialog upon failure. |
boolean |
revertAndMakeInvisible()
Attempts to revert the receiver's editing context changes and makes the receiver's user interface invisible if the revert succeeded (which usually results in a window closing). |
boolean |
revertChanges(boolean showErrorDialog)
Tells the receiver's editing context to revert changes and updates the receiver's editing state on success. |
protected void |
revertFailed(Exception exception,
boolean showErrorDialog)
Invoked from revertChanges if the revert failed. |
boolean |
save()
Saves the receiver's editing context changes by invoking saveChanges,
requesting an error dialog upon failure. |
boolean |
saveAndMakeInvisible()
Attempts to save the receiver's editing context changes and makes the receiver's user interface invisible if the save succeeded (which usually results in a window closing). |
boolean |
saveChanges(boolean showErrorDialog,
String saveOperationTitle)
Tells the receiver's editing context to save changes and updates the receiver's editing state on success. |
protected void |
saveFailed(Exception exception,
boolean showErrorDialog,
String saveOperationTitle)
Invoked from saveChanges if the save failed. |
boolean |
saveIfUserConfirms()
Invokes saveIfUserConfirms(boolean, String) with default
values for a normal save operation. |
boolean |
saveIfUserConfirms(String operationTitle,
String message)
Presents an alert panel asking the user whether the receiver's editing context changes should be saved or not ( operationTitle is used as a description
of the operation, message as the question displayed in the alert panel). |
boolean |
saveIfUserConfirmsAndMakeInvisible()
Invokes saveIfUserConfirmsAndMakeInvisible(String, String) with default
values for a normal save & close operation. |
boolean |
saveIfUserConfirmsAndMakeInvisible(String operationTitle,
String message)
Invokes saveIfUserConfirms(boolean, String) and makes
the receiver's user interface invisible if the save succeeded (which
usually results in a window closing). |
void |
setEditability(int editability)
Conformance to EOEditable. |
void |
setEdited(boolean flag)
Conformance to EODocument. |
void |
supercontrollerEditabilityDidChange()
Conformance to EOEditable. |
void |
takeResponsibilityForEditabilityOfAssociation(EOAssociation association)
Conformance to EOEditable. |
String |
toString()
Returns the receiver as a String describing the state of the controller. |
void |
undo()
Tells the receiver's editing context to undo the last editing state. |
protected void |
wasEdited()
Invoked from setEdited to notify the receiver that edited status
has changed, giving the receiver the opportunity to react. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.webobjects.eoapplication.EOObjectDisplay |
controllerDisplayGroup, displayGroup, editingContext, entityName |
| Constructor Detail |
public EODocumentController()
public EODocumentController(EOXMLUnarchiver unarchiver)
unarchiver - the unarchiver providing XML attributes| Method Detail |
public boolean canPerformActionNamed(String actionName)
canPerformActionNamed in class EOControlleractionName - the action method nametrue if the action should be enabled; false otherwiseEOAction.Enablingpublic boolean canRedo()
true if the controller can undo; false otherwisepublic boolean canRevert()
true if the controller can revert; false otherwisepublic boolean canSave()
true if the controller can save; false otherwisepublic boolean canUndo()
true if the controller can undo; false otherwiseprotected void connectionWasEstablished()
connectionWasEstablished in class EOEntityControllercom.webobjects.eoapplication.EOControllerEOController.establishConnection()protected NSArray defaultActions()
defaultActions in class EOControllercom.webobjects.eoapplication.EOControllerEOController.actions(),
EOController.resetActions()public void deleteSelectedObjects()
true.public void dispose()
dispose in class EOEntityControllerpublic int editability()
editability in the
interface specification for EOEditable.editability in interface EOEditableEOEditable.NeverEditable,
EOEditable.AlwaysEditable, or EOEditable.IfSupercontrollerEditableEOEditable.editability()public void handleEditingContextNotification(NSNotification notification)
handleEditingContextNotification in class EOEntityControllernotification - the editing context notificationpublic void insertObject()
true.
public boolean isDocumentForGlobalID(EOGlobalID globalID,
String entityName)
globalID and entityName.
See the method description of isDocumentForGlobalID in the interface
specification for EODocument. EODocumentController's default implementation returns
true if the receiver is a root document controller and receiver's display
group displays only the specified object. Subclasses might have to override this
method to return false, for example list controllers can't really
be documents for a single object and should return false.isDocumentForGlobalID in interface EODocumentglobalID - the EOGlobalID of the enterprise objectentityName - the name of the entity of the enterprise objecttrue if the receiver is a root document controller and its display group
is displaying only the specified enteprise object; false otherwiseEODocument.isDocumentForGlobalID(EOGlobalID, String)public boolean isEditable()
isEditable in the
interface specification for EOEditable.isEditable in interface EOEditabletrue if the controller is currently editable; false otherwiseEOEditable.isEditable()public boolean isEdited()
isEdited in the interface specification
for EODocument.isEdited in interface EODocumenttrue if the controller is edited; false otherwiseEODocument.isEdited()public boolean isRootDocumentController()
true if the controller is a root document controller; false otherwisepublic void prepareForNewTask(boolean prepareSubcontrollersForNewTask)
prepareForNewTask in class EOEntityControllerprepareSubcontrollersForNewTask - true if the method should be forwarded
to all subcontrollers; false otherwisepublic void redo()
public boolean revert()
revertChanges,
requesting an error dialog upon failure. Returns whether the revert succeeded.true if the revert succeeded; false otherwiserevertChanges(boolean)public boolean revertAndMakeInvisible()
true if the save succeeded; false if the save failed or the user chose to not savepublic boolean revertChanges(boolean showErrorDialog)
revertFailed to show the reason
for failure. Returns whether the revert succeeded.showErrorDialog - true if the controller should show a dialog if the revert fails;
false otherwisetrue if the revert succeeded; false otherwiserevertFailed(Exception, boolean)
protected void revertFailed(Exception exception,
boolean showErrorDialog)
revertChanges if the revert failed.
If showErrorDialog is true, brings the receiver's
user interface to the front and opens a dialog displaying
exception's class name and exception message. This method can
be overridden by subclasses to handle revert errors in a
special way.exception - the exception causing the save errorshowErrorDialog - true if the controller should show an error dialog; false otherwiserevertChanges(boolean)public boolean save()
saveChanges,
requesting an error dialog upon failure. Returns whether the save succeeded.save in interface EODocumenttrue if the save succeeded; false otherwisesaveChanges(boolean, String)public boolean saveAndMakeInvisible()
true if the save succeeded; false if the save failed or the user chose to not save
public boolean saveChanges(boolean showErrorDialog,
String saveOperationTitle)
Tells the receiver's editing context to save changes and updates
the receiver's editing state on success. If the save fails, catches
the exception and invokes saveFailed to show the reason
for failure. Returns whether the save succeeded.
Some applications need to disable undo operations after a save. You can override this method to do so, for example:
public boolean saveChanges(boolean showErrorDialog, String saveOperationTitle) {
if (super.saveChanges(showErrorDialog, saveOperationTitle)) {
editingContext().undoManager().removeAllActions();
}
}
showErrorDialog - true if the controller should show a dialog if the save fails;
false otherwisesaveOperationTitle - a description of the operation causing the savetrue if the save succeeded; false otherwisesaveFailed(Exception, boolean, String)
protected void saveFailed(Exception exception,
boolean showErrorDialog,
String saveOperationTitle)
saveChanges if the save failed.
If showErrorDialog is true, brings the receiver's
user interface to the front and opens a dialog displaying
exception's class name and exception message. This method can
be overridden by subclasses to handle save errors in a
special way.exception - the exception causing the save errorshowErrorDialog - true if the controller should show an error dialog; false otherwisesaveOperationTitle - a description of the operation causing the savesaveChanges(boolean, String)
public boolean saveIfUserConfirms(String operationTitle,
String message)
operationTitle is used as a description
of the operation, message as the question displayed in the alert panel).
The user can choose to save or not to save. Returns whether the changes were
saved successfully.saveIfUserConfirms in interface EODocumentoperationTitle - a description of the operationmessage - a message to be displayed to the usertrue if the save succeeded; false if the save failed or the user chose to not savesaveChanges(boolean, String)public boolean saveIfUserConfirms()
saveIfUserConfirms(boolean, String) with default
values for a normal save operation.true if the save succeeded; false if the save failed or the user chose to not savesaveIfUserConfirms(String, String)
public boolean saveIfUserConfirmsAndMakeInvisible(String operationTitle,
String message)
saveIfUserConfirms(boolean, String) and makes
the receiver's user interface invisible if the save succeeded (which
usually results in a window closing).operationTitle - a description of the operationmessage - a message to be displayed to the usertrue if the save succeeded; false if the save failed or the user chose to not savesaveIfUserConfirms(String, String),
EOComponentController.makeInvisible()public boolean saveIfUserConfirmsAndMakeInvisible()
saveIfUserConfirmsAndMakeInvisible(String, String) with default
values for a normal save & close operation.true if the save succeeded; false if the save failed or the user chose to not savesaveIfUserConfirmsAndMakeInvisible(String, String)public void setEditability(int editability)
setEditability in the
interface specification for EOEditable.setEditability in interface EOEditableeditability - the editability, one of EOEditable.NeverEditable,
EOEditable.AlwaysEditable, or EOEditable.IfSupercontrollerEditableEOEditable.setEditability(int)public void setEdited(boolean flag)
setEdited in the interface specification
for EODocument. EODocumentController's default implementation only updates
the edited state of the receiver if it's a root document controller,
otherwise it asks the root document controller to handle the edited state.setEdited in interface EODocumentEODocument.setEdited(boolean)public void supercontrollerEditabilityDidChange()
supercontrollerEditabilityDidChange
in the interface specification for EOEditable.supercontrollerEditabilityDidChange in interface EOEditableEOEditable.supercontrollerEditabilityDidChange()public void takeResponsibilityForEditabilityOfAssociation(EOAssociation association)
association. See the method description of
takeResponsibilityForEditabilityOfAssociation
in the interface specification for EOEditable.takeResponsibilityForEditabilityOfAssociation in interface EOEditableassociation - the association to manage the editability forEOEditable.takeResponsibilityForEditabilityOfAssociation(EOAssociation)public String toString()
toString in class EOEntityControllerpublic void undo()
protected void wasEdited()
setEdited to notify the receiver that edited status
has changed, giving the receiver the opportunity to react.setEdited(boolean)
|
Last updated Thu Jan 10 18:10:21 PST 2002. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||