James, if you use Modern Look, you know there is a navigation controller (and
not a navigation manager) set by the session.
In the NavigationController class, we have this methods:
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 = "session.navController.createClientAction";
},
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 protected]> 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 protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/prabier%40me.com
>>>
>>> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]