This discussion is archived
1 2 Previous Next 16 Replies Latest reply: Nov 20, 2003 11:22 AM by 178710 RSS

UIX choice component event handling

405015 Newbie
Currently Being Moderated
Hi, I am using UIX in JDEV 10G. My page has a few dependent uix choice components on it. The first choice populates the second choice box and so on. I am using primaryClientActions to handle firing the event of populating the choice box. Below is the EventHandler for the fired event. I have a viewObject and AppModule. I set the where clause on the viewobject with the parameters from the previous choice selection. My question is: How do I get my query results back to my UIX choice component. I thought if I called executequery() it would update the view Objects query and update my page, but I think I am missing a step.

public static EventResult fminstEventHandler(BajaContext context,Page page,PageEvent event) throws Throwable
{
result = new EventResult();
fmInst = event.getParameter("FmName");

DeptAppModuleImpl dam = new DeptAppModuleImpl();
ViewObject deptView = dam.getDeptView1();
deptView.setWhereClause("where inst ='" + fmInstNum +"' and dept != '*****' and guide_yr ='"+guideyr +"' union select 'ALL', '0' from dual");
deptView.executeQuery();


return result; //result is nothing right now.
}

Thanks for your help.
McKell
  • 1. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    REPOST
  • 2. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    If you have any suggestions at all your input would be greatly appreciated. Thanks!!
  • 3. Re: UIX choice component event handling
    404001 Newbie
    Currently Being Moderated
    I think the following statement is wrong:
    DeptAppModuleImpl dam = new DeptAppModuleImpl();

    Could you list your uix file?

    thanks.
  • 4. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Sure. Thanks for responding to my question. Below is the UIX file:

    <?xml version = '1.0' encoding = 'windows-1252'?>
    <page xmlns="http://xmlns.oracle.com/uix/controller"
    xmlns:ui="http://xmlns.oracle.com/uix/ui"
    xmlns:data="http://xmlns.oracle.com/uix/ui"
    xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
    xmlns:html="http://www.w3.org/TR/REC-html40" expressionLanguage="el"
    xmlns:myTemplate="CourseTransferTemplate">
    <templates xmlns="http://xmlns.oracle.com/uix/ui">
    <templateImport source="CrsTranTemplate.uit"/>
    </templates>
    <content>
    <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
    <provider>
    <!-- Add DataProviders (<data> elements) here -->
    </provider>
    <contents>
    <document xlmns="http://xmlns.oracle.com/uix/ui">
    <metaContainer>
    <!-- Set the page title -->
    <head title="Course Transfer Search"/>
    </metaContainer>
    <contents>
    <body>
    <contents>
    <form name="form0">

    <contents>
    <!-- <formParameter name="event"/> -->
    <myTemplate:CourseTransferTemplate selectedTab="0"
    title="Course Transfer Search"
    xmlns:myTemplate="CourseTransferTemplate">
    <contents>
    <rawText
    text="<p>Welcome to the Utah System of Higher Education (USHE) Course Transfer Guide on the Web!
    <p>The USHE Course Transfer Guide provides course-by-course articulation and transfer information. It shows how a course at the institution you are transferring from (the 'from' school) articulates with a course at the institution to which you plan to transfer (the 'to' school). The USHE Course Transfer Guide has been developed by the Utah Transfer Articulation Committee and the ">
    <contents>
    <link text="Utah System of Higher Education"
    destination="http://www.utahsbr.edu"/>
    <rawText text="(USHE). It is updated every year by participating institutions and a new guide is published in the fall.<p>"/>
    </contents>
    </rawText>
    <!-- GuideYR -->
    <rawText text="Guide Year ">
    <contents>
    <choice model="${data.TransferGuideUIModel.GuideYr2}" name="GuideYr2" prompt="GuideYr2" >
    <primaryClientAction>
    <firePartialAction event="guideyrEvent"
    formSubmitted="true"
    />
    </primaryClientAction>
    <contents childData="${data.TransferGuideUIModel.GuideYr2.displayData}">
    <option model="${uix.current}" text="${uix.current.prompt}"
    value="${uix.current.prompt}" />
    </contents>
    </choice>
    </contents>
    </rawText>
    <!-- FmName -->
    <rawText text="From Institution ">
    <contents>
    <choice model="${data.TransferGuideUIModel.Name}"
    name="FmName" prompt="FmName">
    <primaryClientAction>
    <firePartialAction event="FmInstEvent"
    formSubmitted="true"
    targets="Department"/>
    </primaryClientAction>
    <contents
    childData="${data.TransferGuideUIModel.Name.displayData}">
    <option model="${uix.current}"
    text="${uix.current.prompt}"
    value="${uix.current.prompt}"/>
    </contents>
    </choice>
    </contents>
    </rawText>
    <!-- Dept -->
    <rawText text="From Department ">
    <contents>
    <choice model="${data.TransferGuideUIModel.Dept}" name="Dept" prompt="Dept">
    <primaryClientAction>
    <firePartialAction event="DepartmentEvent"
    formSubmitted="true"
    targets="Course"/>
    </primaryClientAction>
    <contents childData="${data.TransferGuideUIModel.Dept.displayData}">
    <option model="${uix.current}"/>
    </contents>
    </choice>
    </contents>
    </rawText>
    <!-- Crs -->
    <rawText text="From Course ">
    <contents>
    <choice id="Course" name="Crs" nodeID="Course">
    <primaryClientAction>
    <firePartialAction event="CourseEvent"
    formSubmitted="true"
    />
    </primaryClientAction>
    </choice>
    </contents>
    </rawText>
    <!-- ToName -->
    <rawText text="To Institution ">
    <contents>
    <choice model="${data.TransferGuideUIModel.Name}"
    name="ToName" prompt="ToName">
    <primaryClientAction>
    <firePartialAction event="ToInstEvent"
    formSubmitted="true"
    />
    </primaryClientAction>
    <contents
    childData="${data.TransferGuideUIModel.Name.displayData}">
    <option model="${uix.current}"
    text="${uix.current.prompt}"
    value="${uix.current.prompt}"/>
    </contents>
    </choice>
    </contents>
    </rawText>
    <button text="Find Articulations"/>
    <rawText text="<p>Choose the academic year you want to search for articulations. Then choose the institution you are transferring from. After you make your selection, a list of departments will be created for you to choose from. Once you choose your department, a list of courses will be created for you to refine your selection. You will then choose which institution you would like to transfer to (you may choose all institutions) and click on 'find articulations'. "/>
    </contents>
    <tabs/>
    <pageButtons/>
    <globalButtons/>
    <pageHeader/>
    <start/>
    <end/>
    <about/>
    <copyright/>
    <privacy/>
    <corporateBranding/>
    <productBranding/>
    </myTemplate:CourseTransferTemplate>
    </contents>
    </form>
    </contents>
    </body>
    </contents>
    </document>
    </contents>
    </dataScope>
    </content>
    <handlers>
    <!-- Add EventHandlers (<event> elements) here -->
    <event name="*" source="FmName">
    <method class="mypackage1.EventHandlers" method="fminstEventHandler"/>
    </event>
    <event name="*" source="Department">
    <method class="mypackage1.EventHandlers" method="deptEventHandler"/>
    </event>
    <event name="*" source="GuideYr2">
    <method class="mypackage1.EventHandlers" method="guideyrEventHandler"/>
    </event>
    <event name="*" source="Course">
    <method class="mypackage1.EventHandlers" method="courseEventHandler"/>
    </event>
    <event name="*" source="ToName">
    <method class="mypackage1.EventHandlers" method="toinstEventHandler"/>
    </event>
    </handlers>
    </page>

    HERE IS THE EVENT HANDLER:

    public static EventResult fminstEventHandler(BajaContext context,Page page,PageEvent event) throws Throwable
    {
    try
    {
    con = new DBConnection();
    }
    catch (SQLException e)
    {
    System.out.println(e);
    }
    fmInst = event.getParameter("FmName");

    ResultSet rset = con.query(namesql); //Here con connects to my database and preforms a query.
    while(rset.next())
    {
    fmInstNum = rset.getString(1);
    }
    System.out.println(fmInstNum);
    //DeptAppModule and DeptView are an Application Module and View Object I created from the JDeveloper wizards
    DeptAppModuleImpl dam = new DeptAppModuleImpl();
    ViewObject DeptView = dam.getDeptView1();
    DeptView.setWhereClause("where inst ='" + fmInstNum +"' and dept != '*****' and guide_yr ='"+guideyr +"' union select 'ALL', '0' from dual");
    DeptView.executeQuery();

    //This is where I don't know how to return the result from the query back to the uix choice component named "Dept"

    return new EventResult(page);
    }


    Thanks you so much for your assistance. I might be approaching this completely wrong. I am new to JDeveloper and the UIX framework. Thank you again.

    McKell
  • 5. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Did you need any other files?
  • 6. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Hi Qinghua,

    Could you see any other issues once you received my UIX file?

    Thanks for your assistance. I am a newbie so any suggestions you have is greatly appreciated.

    Thanks, McKell


  • 7. Re: UIX choice component event handling
    178710 Newbie
    Currently Being Moderated

    Hi McKell,

    I spent some time mocking up an example of using a choice populated from BC4J that results in executing a where clause that filters what is popuplated into a second choice. I'll try and post some information later today.
  • 8. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Jeffery,

    Thank you so much for taking the time to help me out. Your examples would help so much. I look forward to your next post.

    Thanks again,
    McKell
  • 9. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Jeffery, Do you still have the examples you where talking about in your last post? Would you mind sharing them with me?

    Thank you.
    McKell
  • 10. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Jeffery, please share the examples you where talking about in your last post with me.
  • 11. Re: UIX choice component event handling
    178710 Newbie
    Currently Being Moderated
    Hi McKell,

    Sorry I couldn't get back to this sooner, I had to concentrate on my own work for a while. I will send a JDeveloper project created with the 10g Preview release that demonstrates this kind of UI to the e-mail address you used when you registered with OTN.

    Without looking at the source for your model, it is hard to know exactly, but I'd guess that what is tripping you up is the source/target dialog you have to use to set up the ADF binding for the UIX choice component. You can see this by double clicking on the binding in the Structure Pane for the UIModel.xml file for your page. You want the source to be populated from the database (available years, available departments, etc) but the target (what the model attribute is bound to) must be a temporary holder (in my example I will use a field on a JavaBean). If the model attribute is bound to an attribute on one of your View objects, then the user selected value will actually update the current row in the database.

    Based on my understanding, that is not what you want, you just want access to the selected value on the server so that you can use it in a where clause to narrow the results from another View. So, you need to store the submitted value (in other words bind the model attribute of the choice) to a temporary field (like on a JavaBean).

    - Jeff
  • 12. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Thanks Jeffery. I appreciate your help and hard work. I haven't yet received the content you where going to email me, but I will check my email often.

    Thank you again.

    McKell
  • 13. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Hi Jeff,

    I haven't received the email you said you would send in your last post. I appreciate your help with this subject. I know you are busy, but I am really looking forward to receiving your email with the examples you created.

    Thanks again,

    McKell
  • 14. Re: UIX choice component event handling
    405015 Newbie
    Currently Being Moderated
    Jeff, I appreciate the time you have spent on developing the examples, and I'm really not trying to be a pest. Could you please email me the examples you where talking about in your last post.

    Thank you,

    McKell
1 2 Previous Next