Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Up and Down Arrow Key on List view in Oracle ADF

Chaitanya VarmaSep 28 2015 — edited Sep 28 2015

HI Every one,

I had a Typical Requirement in my projects, Please check below for my Requirement in Oracle ADF.

1) I had a login page which takes username and password and routes to Welcome Page which displays Menu Items in a ListView.

adfcConfig.xml--->Login.jsf routes to -->Welcome.jsf--->where MenuTaskflow is as Region in it.

Menu Taskflow contains execute with params, which executes the query and displays the result in List View in  Menu.jsff and its go on...

I am able to achieve it, but my requirements in project is there are not using it in Desktop, they are going to use this  it in Hand Held Terminal Devices.

So they are going to use   keys instead of Mouse.

My Requirement:

After Rendering the Welcome.jsf Page, (Menu list) they need to navigate the List Items using UP and Down Arrow Keys and they want to call Action Method using enter button.

But By Default ADF , I am able to use up and down arrow keys after when I select one row manually and  where enter key is not working...

So after rendering the page, How I can select the list first Item defaultly, so that I can use my Up and Down Arrow keys, or is there any way??

So what are the ways to achieve my functionality??

below are the Welcome and Menu pages,

welcome.jsf:

------------------

<?xml version='1.0' encoding='windows-1252'?>

<!DOCTYPE html>

<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">

    <af:document title="RDM" id="d1" initialFocusId="pt:r1">

        <f:facet name="metaContainer">

            <af:group id="g1">

                <meta name="viewport" content="width=device-width, initial-scale=1"/>

            </af:group>

        </f:facet>

  

        <af:resource type="javascript">

          function setWindowSize() {

              var height = document.documentElement.clientHeight, width = document.documentElement.clientWidth;

              var ratio = window.devicePixelRatio;

              comp = AdfPage.PAGE.findComponentByAbsoluteId('d1');

              AdfCustomEvent.queue(comp, "setScreenSize",

              {

                  'screenWidth' : width, 'screenHeight' : height, 'devicePixelRatio' : ratio

              },

true);

          }

        </af:resource>

        <af:clientListener method="setWindowSize" type="load"/>

        <af:serverListener type="setScreenSize" method="#{agentInfo.setWindowSize}"/>

        <af:form id="f1" clientComponent="true">

            <af:pageTemplate viewId="/com/ross/rdm/hotelpicking/view/pageTemplates/ScangunPageTemplate.jsf" id="pt"

                             value="#{bindings.ptb1}">

                <f:facet name="pageContent">

                    <af:region value="#{bindings.HhMenusSTaskFlow1.regionModel}" id="r1" clientComponent="true"/>

                </f:facet>

            </af:pageTemplate>

        </af:form>

    </af:document>

</f:view>

---------------------------------------------------------------------------

Menu.jsff

<?xml version='1.0' encoding='windows-1252'?>

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"

                xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core">

    <c:set var="rdmhotelpickingviewcontrollerBundle"

           value="#{adfBundle['com.ross.rdm.hotelpicking.view.RDMHotelPickingViewControllerBundle']}"/>

    <af:resource type="css" source="/resources/css/HotelPicking.css"/>

    <af:resource type="javascript" source="/resources/js/ebapi-modules.js"/>

    <af:panelGroupLayout id="pgl22">

        <af:panelGridLayout id="mainRoot" styleClass="headerPanel">

            <af:gridRow id="mainRootGr" height="#{agentInfo.smartPhone?'100%':'auto'}">

                <af:gridCell id="mainRootGc" halign="start" width="100%" valign="bottom">

                    <af:outputText value="#{bindings.UserName.inputValue}" id="ot2"/>

                </af:gridCell>

                <af:gridCell id="gc4" halign="center" width="100%">

                    <af:outputText value="#{bindings.MenuTitle.inputValue}" inlineStyle="font-size:large;" id="it11"/>

                </af:gridCell>

                <af:gridCell id="gc5" halign="end" width="100%">

                    <af:panelGroupLayout id="pgl6" layout="horizontal">

                        <af:link id="l1" icon="/resources/images/logOut.png"

                                 shortDesc="#{rdmhotelpickingviewcontrollerBundle.COMMON_LOGOUT}" action="logOut"

                                 immediate="true"/>

                        <af:link id="l2" icon="/resources/images/menu.png"

                                 shortDesc="#{rdmhotelpickingviewcontrollerBundle.COMMON_HOME}" action="backGlobalHome"

                                 immediate="true"/>

                        <af:link id="l3" icon="/resources/images/help.png"

                                 shortDesc="#{rdmhotelpickingviewcontrollerBundle.COMMON_HELP}"/>

                    </af:panelGroupLayout>

                </af:gridCell>

            </af:gridRow>

        </af:panelGridLayout>

        <af:spacer height="5" id="s2"/>

        <af:panelGridLayout id="pgl5">

            <af:gridRow id="gr1">

                <af:gridCell id="gc1" width="100%">

                    <af:panelGroupLayout id="pgl3" layout="scroll">

                        <af:listView value="#{bindings.MenuView.collectionModel}" var="item"

                                     emptyText="#{bindings.MenuView.viewable ? 'No data to display.' : 'Access Denied.'}"

                                     fetchSize="#{bindings.MenuView.rangeSize}" id="lv1" selection="single"

                                     inlineStyle="height:200px; width:200px;"

                                     selectionListener="#{bindings.MenuView.treeModel.makeCurrent}">

                            <af:listItem id="li1">

                                <af:panelGroupLayout id="pgl1" layout="horizontal">

                                    <af:panelGroupLayout id="plam1" inlineStyle="min-width:150px;" layout="vertical">

                                        <af:link text="#{item.bindings.OptionText.inputValue}" id="l12" action="SubMenu"

                                                 rendered="#{item.bindings.RecordType.inputValue eq 'M'}"

                                                 partialSubmit="true"/>

                                        <af:link text="#{item.bindings.OptionText.inputValue}" id="of1"

                                                 rendered="#{item.bindings.RecordType.inputValue != 'M'}"

                                                 partialSubmit="true" action="App"/>

                                    </af:panelGroupLayout>

                                    <af:image source="/resources/images/menu_indicator.png" shortDesc="Menu" id="i1"

                                              rendered="#{item.bindings.RecordType.inputValue eq 'M'}"/>

                                </af:panelGroupLayout>

                            </af:listItem>

                        </af:listView>

                    </af:panelGroupLayout>

                </af:gridCell>

            </af:gridRow>

            <af:gridRow id="gr12">

                <af:gridCell id="gc21" width="100%">

                    <af:spacer height="5" id="s6"/>

                    <af:panelGroupLayout id="pgl7" layout="vertical" valign="top" halign="left" visible="true"

                                         styleClass="errorPanel">

                        <af:panelGroupLayout id="pgl9" layout="horizontal" styleClass="AFStretchWidth">

                            <af:spacer height="15" id="s12"/>

                        </af:panelGroupLayout>

                    </af:panelGroupLayout>

                    <af:spacer height="5" id="s22"/>

                    <af:panelGroupLayout id="pgl2" layout="horizontal">

                        <af:link text="#{rdmhotelpickingviewcontrollerBundle.F2_PREVIOUS}" id="b2" action="menuPage"

                                 styleClass="keyLinks"/>

                        <af:link text="#{rdmhotelpickingviewcontrollerBundle.F3_LOGOUT}" id="b3" styleClass="keyLinks"

                                 action="logOut"/>

                        <f:facet name="separator">

                            <af:spacer width="5" id="s4"/>

                        </f:facet>

                    </af:panelGroupLayout>

                </af:gridCell>

            </af:gridRow>

        </af:panelGridLayout>

    </af:panelGroupLayout>

</ui:composition>

Thanks In Advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2015
Added on Sep 28 2015
0 comments
983 views