From: Anjo K. <an...@us...> - 2003-04-29 19:38:13
|
Update of /cvsroot/wonder/Wonder/Common/Frameworks/ERDirectToWeb/Sources/er/directtoweb In directory sc8-pr-cvs1:/tmp/cvs-serv28549 Modified Files: ERD2WInspectPage.java ERD2WListPage.java ERDEditButton.java Log Message: - fixed a problem when you want to edit an object that is *not* shared. - renamed and changed scope of local methods, added ERDEditButton and ERDInspectPage to use method - now uses d2w key "useNestedContext" so embedded components can be told to use nested contexts (>wo 5.21) Index: ERD2WInspectPage.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERDirectToWeb/Sources/er/directtoweb/ERD2WInspectPage.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ERD2WInspectPage.java 28 Apr 2003 06:05:53 -0000 1.21 --- ERD2WInspectPage.java 29 Apr 2003 19:38:05 -0000 1.22 *************** *** 60,64 **** if (previousPage() == null) { EditPageInterface editPage=D2W.factory().editPageForEntityNamed(object().entityName(),session()); ! editPage.setObject(object()); editPage.setNextPage(nextPage()); returnPage = (WOComponent)editPage; --- 60,64 ---- if (previousPage() == null) { EditPageInterface editPage=D2W.factory().editPageForEntityNamed(object().entityName(),session()); ! editPage.setObject(ERD2WUtilities.localInstanceFromObjectWithD2WContext(object(), d2wContext())); editPage.setNextPage(nextPage()); returnPage = (WOComponent)editPage; Index: ERD2WListPage.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERDirectToWeb/Sources/er/directtoweb/ERD2WListPage.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ERD2WListPage.java 28 Apr 2003 06:08:56 -0000 1.18 --- ERD2WListPage.java 29 Apr 2003 19:38:05 -0000 1.19 *************** *** 254,263 **** EditPageInterface epi=(EditPageInterface)D2W.factory().pageForConfigurationNamed(editConfigurationName,session()); ! epi.setObject(localInstance()); epi.setNextPage(context().page()); result = (WOComponent)epi; } else { ! EditPageInterface editpageinterface = D2W.factory().editPageForEntityNamed(localInstance().entityName(), session()); ! editpageinterface.setObject(localInstance()); editpageinterface.setNextPage(context().page()); result = (WOComponent)editpageinterface; --- 254,263 ---- EditPageInterface epi=(EditPageInterface)D2W.factory().pageForConfigurationNamed(editConfigurationName,session()); ! epi.setObject(localInstanceOfObject()); epi.setNextPage(context().page()); result = (WOComponent)epi; } else { ! EditPageInterface editpageinterface = D2W.factory().editPageForEntityNamed(object().entityName(), session()); ! editpageinterface.setObject(localInstanceOfObject()); editpageinterface.setNextPage(context().page()); result = (WOComponent)editpageinterface; *************** *** 272,281 **** if(inspectConfigurationName!=null) { InspectPageInterface ipi=(InspectPageInterface)D2W.factory().pageForConfigurationNamed(inspectConfigurationName,session()); ! ipi.setObject(localInstance()); ipi.setNextPage(context().page()); return (WOComponent)ipi; } else { ! InspectPageInterface inspectpageinterface = D2W.factory().inspectPageForEntityNamed(localInstance().entityName(), session()); ! inspectpageinterface.setObject(localInstance()); inspectpageinterface.setNextPage(context().page()); return (WOComponent)inspectpageinterface; --- 272,281 ---- if(inspectConfigurationName!=null) { InspectPageInterface ipi=(InspectPageInterface)D2W.factory().pageForConfigurationNamed(inspectConfigurationName,session()); ! ipi.setObject(object()); ipi.setNextPage(context().page()); return (WOComponent)ipi; } else { ! InspectPageInterface inspectpageinterface = D2W.factory().inspectPageForEntityNamed(object().entityName(), session()); ! inspectpageinterface.setObject(object()); inspectpageinterface.setNextPage(context().page()); return (WOComponent)inspectpageinterface; *************** *** 283,287 **** } ! private EOEnterpriseObject localInstance() { return ERD2WUtilities.localInstanceFromObjectWithD2WContext(object(), d2wContext()); } --- 283,287 ---- } ! protected EOEnterpriseObject localInstanceOfObject() { return ERD2WUtilities.localInstanceFromObjectWithD2WContext(object(), d2wContext()); } *************** *** 299,306 **** public String formTargetJavaScriptUrl() { if (_formTargetJavaScriptUrl==null) { ! _formTargetJavaScriptUrl= application().resourceManager().urlForResourceNamed("formTarget.js", ! "ERDirectToWeb", ! null, ! context().request()); } return _formTargetJavaScriptUrl; --- 299,303 ---- public String formTargetJavaScriptUrl() { if (_formTargetJavaScriptUrl==null) { ! _formTargetJavaScriptUrl= application().resourceManager().urlForResourceNamed("formTarget.js", "ERDirectToWeb", null, context().request()); } return _formTargetJavaScriptUrl; Index: ERDEditButton.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERDirectToWeb/Sources/er/directtoweb/ERDEditButton.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ERDEditButton.java 7 Mar 2003 18:48:02 -0000 1.3 --- ERDEditButton.java 29 Apr 2003 19:38:06 -0000 1.4 *************** *** 25,33 **** public D2WContext d2wContext() { return (D2WContext)valueForBinding("d2wContext"); } // Assuming that object() is the eo public WOComponent edit() { ! EOEditingContext context = er.extensions.ERXExtensions.newEditingContext(); ! EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(context, object()); String configuration = (String)d2wContext().valueForKey("editConfigurationNameForEntity"); if(log.isDebugEnabled()){ --- 25,37 ---- public D2WContext d2wContext() { return (D2WContext)valueForBinding("d2wContext"); } + + + protected EOEnterpriseObject localInstanceOfObject() { + return ERD2WUtilities.localInstanceFromObjectWithD2WContext(object(), d2wContext()); + } // Assuming that object() is the eo public WOComponent edit() { ! EOEnterpriseObject localObject = localInstanceOfObject(); String configuration = (String)d2wContext().valueForKey("editConfigurationNameForEntity"); if(log.isDebugEnabled()){ *************** *** 37,41 **** epi.setObject(localObject); epi.setNextPage(context().page()); ! context.hasChanges(); // Ensuring it survives. return (WOComponent)epi; } --- 41,45 ---- epi.setObject(localObject); epi.setNextPage(context().page()); ! localObject.editingContext().hasChanges(); // Ensuring it survives. return (WOComponent)epi; } |