Está en la página 1de 6

[LARGE][LINK=/hello-world-page/32-technical-articles/oaf-beginners-guide/145search-page-without-construction-mode-and-switcher-implementation.

html]Search Page without Using Query Bean and Switcher Implementation[/LINK] [/LARGE] Aarthi Sudhakar Published on 16 April 2009 Hits: 6005 [*] [LINK=/hello-worldpage/32-technical-articles/oaf-beginners-guide/145-search-page-without-constructionmode-and-switcher-implementation.html?tmpl=component&print=1&page=] [IMG]/media/system/images/printButton.png[/IMG][/LINK] [/*] [*] [LINK=/component/mailto/? tmpl=component&template=rt_modulus&link=0cb59b4cf4e840ab9523b12d7575ae8201 39b5f5][IMG]/media/system/images/emailButton.png[/IMG][/LINK] [/*] Switchers can be used in tables to conditionally display alternate content in a column. In this tutorial we will be implementing a Search without using the construction mode. In the results table we will have a column displaying delete. In that column we have images displayed showing if delete is disabled or enabled using the switcher functionality. {StickyNote}{/StickyNote} {tab=Initial Steps} 1. Right click Workspaces and click create new OAworkspace and name it as "[B]CholaSwitcherDemo[/B]". Automatically a new OA Project is also created. Name the project as [B]SwitcherDemo[/B] and package as chola.oracle.apps.fnd.switcher. {tab=BC4J} 2. We need to create a Business component package. Right click on SwitcherDemo.jpr and click on new Business Component Package. [B]Name - chola.oracle.apps.fnd.switcher.server[/B] 3.Right click on chola.oracle.apps.fnd.demo.server and click new Application Module. [B]Name - SwitcherAM.[/B] {tab=View Object} 4. Right click on chola.oracle.apps.fnd.switcher.server and click new View Object.

[B]Name - SwitcherVO Package - chola.oracle.apps.fnd.switcher.server [/B] The VO is not based on any EO so click next and go to the query section and paste the query. select Country,county,decode(nvl(to_char(city), 'N'),'Y', 'DeleteDisabled', 'DeleteEnabled') AS DELETE_SWITCHER,city from UK_EMPLOYEES where country=:1 In this query we will display another column called Delete which will display images. If there is no city for the particular country then delete button will be disabled. If there is a city then delete button will be enabled. Attach the VO to the AM by right clicking the SwitcherAM and click Edit. Shuttle the SwitcherVO to the right hand side. {tab=Page} 5. Right click on SwitcherDemo.jpr and select new. Click on web tier and then OA Components and select Page. [B]Name - SwitcherPG Package - chola.oracle.apps.fnd.switcher.webui.[/B] 6. Select the EmployeePG and go to the strcuture pane where a default region has been created. 7. Select region1 and set the following properties: [B]ID - PageLayoutRN AM Definition - chola.oracle.apps.fnd.switcher.server.SwitcherAM Window Title - Chola Switcher and Search Demo Title - Switcher Demo[/B] 12. Right click PageLayoutRN and click new Region. [B]ID - MAinRN Region Style - messageComponentLayout[/B] Style is given as messageComponentlayout because we are going to create only message components that is messageChoice item in that region. 13. Right click on MainRN and select new ->Item. [B]Id - Country1 Item Style - messageTextInput Prompt - Country Length - 40 Max length - 40[/B]

14.Right click on MainRN and select new Region. [B]Id- ButtonLayout[/B] 15. Right click on ButtonLayout - > new - >Item. [B]ID - Go Prompt - Search Item Style - SubmitButton Search Allowed - True[/B] 16.Right click on PageLayoutRN and select new - > region Using Wizard [B]RegionID - SwitcherRN Region Style - table[/B] 17. Select the SwitcherAM and at bottom select the SwitcherVO and click Next. 18. Shuttle Country,County and City attributes to the right side.Change the style of all to messageStyledText.Click Finish. 19.Right click on SwitcherRN and click switcher.There will be a region and a case by default created.Set the view attribute as DeleteSwitcher.View Instance as SwitcherVO1 20. Right click on case and select new - > item.Set the following for the item. [B]ID - DeleteDisabled ITem Style - image Height - 24 Width- 24 Image URI - deleteicon_disabled.gif[/B] 21.Right click on case and select new - > case.Right click on case and select new - > Item.Set the following for the item. [B]ID - DeleteEnaabled ITem Style - image Height - 24 Width- 24 Image URI - deleteicon_enabled.gif Event Type - fireAction Event - delete[/B] We should write code with method name as delete after capturing the event. {tab=Controller Code} 22.Right click on PageLayoutRN and select set New Controller. [B]Name - SwitcherCO Package - chola.oracle.apps.fnd.switcher.webui.[/B]

[B]Import Statements:[/B] import java.io.Serializable; import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.common.VersionInfo; import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.webui.OAControllerImpl; import oracle.apps.fnd.framework.webui.OADialogPage; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; [B]ProcessFormRequest():[/B] if (pageContext.getParameter("Go") != null) { String Country1 = pageContext.getParameter("Country1"); // Now we want to initialize the query for our single employee // with all of its details. OAApplicationModule am = pageContext.getApplicationModule(webBean); Serializable\[] parameters = { Country1 }; am.invokeMethod("initDetails", parameters); } Here we check if it was Go button that was clicked. Then retrieve the value of country and pass the parameter and invoke the initDetails method in the AM. {tab=AM Code} [B]Import Statement:[/B] import oracle.apps.fnd.common.MessageToken; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; public void initDetails(String Country1) { SwitcherVOImpl vo = getSwitcherVO1(); if (vo == null) { MessageToken\[] errTokens = { new MessageToken("OBJECT_NAME", "SwitcherVO1")}; throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens); } vo.initQuery(Country1); } // end initDetails() In this code we will check the vo and see if its null. Then throw a exception. Else we will invoke a method initQuery in the VO Impl method. {tab=VO Code} [B]Import Statement:[/B] import oracle.apps.fnd.framework.server.OAViewObjectImpl; public void initQuery(String Country1) { if ((Country1 != null) && (! ("".equals(Country1.trim())))) { setWhereClause("Country = :1"); setWhereClauseParams(null); // Always reset setWhereClauseParam(0, Country1); executeQuery(); } } // end initQuery()

Here we are setting the where clause and assigning the variable to the country1 variable and executing the query to get the values for display. {tab= Run your Page} Save your work and run the SwitcherPG. The screen should look like this. [IMG]http://oraclearea51.com/images/stories/articleimages/runpage.jpg[/IMG] Enter US in the country and you will see the results like below: [IMG]http://oraclearea51.com/images/stories/articleimages/save%20run.jpg[/IMG]

You can see that the delete is disabled where the city is not there and delete is enabled where city is not null.

{/tabs} Hits : 6005[LINK=javascript:void(0);]Share This[/LINK] [HR] [IMG]http://oraclearea51.com/images/avatar/6f3a74902624780db262b002.jpg[/IMG] [LINK=/browse/area51community/profile/63-aarthisudhakar.html]Aarthi[/LINK] [IMG]http://oraclearea51.com/components/com_community/templates/default/images/ka rma-3-5.gif[/IMG]Points : 1417 I am an Oracle Applications Framework Consultant who works primarily on Oracle Site Hub. [LINK=javascript:void(0)]Contact Author[/LINK] Loading... [*] [*] video[/LINK] [*] file[/LINK] [/*] [*] [LINK=#]B[/LINK] [/*] [LINK=javascript:open_youtube('');]Embed [/*] [LINK=javascript:openAttachFile('');]Attach

[*] [*] [*] [*] [*] [*] [*]

[LINK=#]I[/LINK] [LINK=#]U[/LINK] [LINK=#]S[/LINK] [LINK=#]UL[/LINK] [LINK=#]Quote[/LINK] [LINK=#]Link[/LINK] [LINK=#]Img[/LINK]

[/*] [/*] [/*] [/*] [/*] [/*] [/*]

[*][LINK=#](-) CLick to Collapse[/LINK][/*] [/*]

También podría gustarte