public WOComponent newObjectForEntityName(final String entityName)
{
WOComponent nextPage = null;
try {
EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(entityName, session());
epi.setNextPage(session().context().page());
nextPage = (WOComponent) epi;
} catch (IllegalArgumentException e) {
ErrorPageInterface epf = D2W.factory().errorPage(session());
epf.setMessage(e.toString());
epf.setNextPage(session().context().page());
nextPage = (WOComponent) epf;
}
return nextPage;
}
public WOComponent createProjectAction()
{
WOComponent nextPage = newObjectForEntityName(NOProject.Keys.ENTITY_NAME);
if(session().getClient() != null)
{
if(nextPage instanceof ERD2WPage)
{
NOProject obj = (NOProject) ((ERD2WPage)nextPage).object();
if(obj != null)
{
obj.setClientRelationship((NOClient) EOUtilities.localInstanceOfObject(obj.editingContext(), session().getClient()));
}
}
}
return nextPage;
}
As you can see in the createProjectAction method, you get your object, here a Project object, so you can initialize your attributes here.
Just to be sure we are on the same page, in the navigationmenu.plist, I have that:
{
name = CreateClient;
displayName = New;
action = "";
},
Let me know if you need more help.
Philippe
On 5 nov. 2011, at 17:49, James Cicenia wrote:
I do use ModernLook
I am not quite certain how to get the attributes of the newly created entity.
Thanks
James
On Nov 5, 2011, at 11:39 AM, Philippe Rabier wrote:
Do you use Modern Look ?
Because we use the navigation manager to set relationship.
I'm away from home right now but can take a closer look later.
Philippe
Sent from my iPhone
On 5 nov. 2011, at 17:23, James Cicenia <
email@hidden> wrote:
The subject line is the question.
I use the standard factory:
public WOComponent newObjectForEntityName(String entityName) {
WOComponent nextPage = null;
try {
EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(entityName, session());
epi.setNextPage(session().context().page());
nextPage = (WOComponent) epi;
} catch (IllegalArgumentException e) {
ErrorPageInterface epf = D2W.factory().errorPage(session());
epf.setMessage(e.toString());
epf.setNextPage(session().context().page());
nextPage = (WOComponent) epf;
}
return nextPage;
}
Thanks
James
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden