Thread: JHS 10.1.3 "DeepLink" Create method


Permlink Replies: 2 - Pages: 1 - Last Post: Oct 23, 2006 8:07 AM Last Post By: Pistolero
Pistolero

Posts: 24
Registered: 10/04/06
JHS 10.1.3 "DeepLink" Create method
Posted: Oct 22, 2006 2:24 PM
Click to report abuse...   Click to reply to this thread Reply
Hi,

I want to use a "DeepLink" Create method when I'm on a form page for "Addresses", which page contains a child table-form group of the persons who use the particular address I'm editing. Here I would like to have a link to go to the "Employees" VO page, which is a form or table-form page that I also use for editing or searching employees, and have this page in the "create" mode. Note that there is already a "new" button on the addresses page, but the view object I use to list the employees here is reduced compared to the "full size" main view object for employees.

So this is a kind of deeplinking, but the action is neither query nor set current row, but create. As I said, this was possible with Jhs 10.1.2 by changing the event and eventValue hidden form parameters with some client-side Javascript.

I found there is a way to manually add this action, somehow based on the same model that Steven gave me for the rowKeyStr-based deeplinking.

Here are the custom lines I used :

In the EmployeePageDef I added :

<invokeAction id="setCreateEmployeeDeepLinkInvoke"
Binds="CreateEmployee"
Refresh="prepareModel"
RefreshCondition="#{jsfNavigationOutcome=='DeepLinkCreateEmployee'}"/>

And I used a custom template for the new button in the address page, based on newButtonNotInFormLayout.vm :

#if ($JHS.current.pageComponent.hasDetailsPage && $JHS.current.group.formInsertAllowed)
<af:commandButton action="${JHS.facesConfigGenerator.addNavigationCase(${JHS.page.name}, "DeepLinkCreate${JHS.current.group.property1}", ${JHS.current.group.property1})}"
textAndAccessKey="${JHS.nls(${JHS.current.group.displayTitleSingular}, "NEW_BUTTON_LABEL_${JHS.current.group.property1}", "NEW_BUTTON_LABEL" )}"
immediate="true"
#JHS_PROP("rendered" ${JHS.current.group.insertAllowedExpression})
onclick="return alertForChanges();"
id="${JHS.current.group.name}NewButton">
<f:actionListener type="oracle.jheadstart.controller.jsf.listener.DoRollbackActionListener"/>
<af:resetActionListener/>
</af:commandButton>
#end

where property1 of the Address group is set to Emplyee.

Everything works fine, except that when clicking the customized new button and arriving at the Employee page, the createModes.CreateEmployee value is not set to true, so the layout of the page is not set to create mode.

Therefore I changed the common.vm template to :

#macro (GROUP_IN_CREATE_MODE)
(createModes.Create${JHS.current.group.shortName} or jsfNavigationOutcome=='DeepLinkCreate${JHS.current.group.name}')#end

#macro (SPECIFIED_GROUP_IN_CREATE_MODE $group)
(createModes.Create${group.shortName} or jsfNavigationOutcome=='DeepLinkCreate${group.name}')#end

#macro (GROUP_NOT_IN_CREATE_MODE)
!(createModes.Create${JHS.current.group.shortName} or jsfNavigationOutcome=='DeepLinkCreate${JHS.current.group.name}')#end

My question is : why is the createModes.CreateEmployee value not set to true when invoking DeepLinkCreateEmployee ? Is there a way to manually set this value to true so that the page layout is rendered in create mode without changing the common.vm template ?

Best regards,

David
Sandra Muller

Posts: 891
Registered: 01/10/01
Re: JHS 10.1.3 "DeepLink" Create method
Posted: Oct 23, 2006 6:22 AM   in response to: Pistolero in response to: Pistolero
Click to report abuse...   Click to reply to this thread Reply
David,

Maybe you can use an af:setActionListener inside the deeplink command component. See section 17.4 of the ADF Developer's Guide at http://download-uk.oracle.com/docs/html/B25947_01/web_adv004.htm#CACFGEBH

Inside the deeplink CommandLink or CommandButton, add something like:
<af:setActionListener from="#{true}"
to="#{createModes.groupName}"/>

Hope this helps,
Sandra Muller
JHeadstart Team
Oracle Consulting
Pistolero

Posts: 24
Registered: 10/04/06
Re: JHS 10.1.3 "DeepLink" Create method
Posted: Oct 23, 2006 8:07 AM   in response to: Sandra Muller in response to: Sandra Muller
Click to report abuse...   Click to reply to this thread Reply
It works, thanks a lot !

My custom template is now :

#if ($JHS.current.pageComponent.hasDetailsPage && $JHS.current.group.formInsertAllowed)
<af:commandButton action="${JHS.facesConfigGenerator.addNavigationCase(${JHS.page.name}, "DeepLinkCreate${JHS.current.group.property1}", ${JHS.current.group.property1})}"
textAndAccessKey="${JHS.nls(${JHS.current.group.displayTitleSingular}, "NEW_BUTTON_LABEL_${JHS.current.group.property1}", "NEW_BUTTON_LABEL" )}"
immediate="true"
#JHS_PROP("rendered" ${JHS.current.group.insertAllowedExpression})
onclick="return alertForChanges();"
id="${JHS.current.group.name}NewButton">
<f:actionListener type="oracle.jheadstart.controller.jsf.listener.DoRollbackActionListener"/>
<af:setActionListener from="#{true}" to="#{createModes.Create${JHS.current.group.property1}}"/>
<af:resetActionListener/>
</af:commandButton>
#end

What I like with this solution is that when disabling "Clear page definition before generation" while keeping "overwrite page definition bindings" enabled, I can still make change in my model (add column, ...) and keep everything generated.

Cheers,

David
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums