/** * Action performed by edit button if in-line editing is disabled */ public WOComponent editObjectInPageAction() { EOEnterpriseObject localObject = localInstanceOfObject(); String configuration = (String)valueForBinding(Keys.editConfigurationName); log.debug("configuration = {}", configuration); EditPageInterface epi = (EditPageInterface)D2W.factory().pageForConfigurationNamed(configuration, session()); epi.setObject(localObject); epi.setNextPage(context().page()); localObject.editingContext().hasChanges(); // Ensuring it survives. return (WOComponent)epi; }
public WOComponent editHelpText() { EditPageInterface page = D2W.factory().editPageForEntityNamed(ERCHelpText.ENTITY, session()); EOEnterpriseObject eo = ERXEOControlUtilities.editableInstanceOfObject(helpText(), false); page.setObject(eo); page.setNextPage(context().page()); return (WOComponent) page; }
public WOComponent edit() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { ERCHelpText text = ERCHelpText.clazz.helpTextForKey(ec, key); if(text == null) { text = ERCHelpText.clazz.createAndInsertObject(ec); text.setKey(key); } EditPageInterface page = D2W.factory().editPageForEntityNamed(ERCHelpText.ENTITY, session()); page.setObject(text); page.setNextPage(context().page()); return (WOComponent)page; } finally { ec.unlock(); } }
/** * Perform the returnAction. Called when the page is a non embedded page is returning to the originating * edit page. */ public WOComponent returnAction() { masterObject().editingContext().saveChanges(); WOComponent result = (nextPageDelegate() != null) ? nextPageDelegate().nextPage(this) : super.nextPage(); if (result != null) { return result; } result = (WOComponent)D2W.factory().editPageForEntityNamed(masterObject().entityName(), session()); ((EditPageInterface)result).setObject(masterObject()); // support for ERMDAjaxNotificationCenter postChangeNotification(); return result; }
/** * Action called when user clicks the Add button */ public WOActionResults addObject() { String currentPageConfiguration = stringValueForBinding(Keys.pageConfiguration); NSDictionary<String, String> extraValues = currentPageConfiguration != null ? new NSDictionary<String, String>(currentPageConfiguration, Keys.pageConfiguration) : null; String createPageConfigurationName = (String)ERDirectToWeb.d2wContextValueForKey(Keys.createConfigurationName, destinationEntityName(), extraValues); EditPageInterface epi = (EditPageInterface)D2W.factory().pageForConfigurationNamed(createPageConfigurationName, session()); EOEditingContext newEc = ERXEC.newEditingContext(object().editingContext()); EOEnterpriseObject relatedObject = EOUtilities.createAndInsertInstance(newEc, destinationEntityName()); EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(relatedObject.editingContext(), object()); if (localObj instanceof ERXGenericRecord) { ((ERXGenericRecord)localObj).setValidatedWhenNested(false); } localObj.addObjectToBothSidesOfRelationshipWithKey(relatedObject, propertyKey()); epi.setNextPage(context().page()); epi.setObject(relatedObject); // Null out the current searchValue so when we come back, it regenerates _searchValue = null; return (WOActionResults) epi; }