Saturday, 11 June 2016

ADF Equivalents of Common Oracle Forms Triggers : Pre-Query (Query Processing)

Hello all  ,
today i have in my office have an use case , in which i have apply the "Oracle Forms Triggers in adf "
, i have done it by simply some tricky way ,

so then i decide to write blogs about the
"Equivalents Of Common Oracle forms Triggers", 
in which i will describe how can we achieve the oracle forms like behavior in ADF,

Today's Discussion:
                                  For this time i have select the Pre-query trigger from the category of Query Processing.

first of all let us know the functionality of Pre-Query trigger ,

Pre-Query Trigger:
                                      as we know the trigger is   
"a special kind of stored procedure that automatically executes when an event occurs in the database server"
so a Pre-Query trigger is :
Execute logic before executing a query in a data block.
know let us look how can we do it in ADF.

i will use the HR schema , and for the sake of simplicity just show the some sop in log window to ensure the result 

Solution :

here are simple steps you have to follow to achieve this , 

step1:
           first of all create simple application and create the entities and viewobjects of Departments And employees tables , 

step2
          Now double click on one of your view object say
DepartmentsView --> overview ---->Java --> click on pencil button on right top as in figure


Step3:
this will open a window in front of you , check the GenerateViewObject class and under this check the "Include Custome Java data Source Methodes"
as in figure


Thursday, 9 June 2016

Oracle Forms Functionality in Oracle ADF : Using 'Enter' key Instead of 'Tab' in af:form

hello all ,

inspiration from the use case which  have encountered in last days , i decide to share my learning


Today's Discussion :

the use case is pretty simple that
 "How can we use Enter key instead of Tab key in af:form in ADF application just like in Oracle forms "

so here is the simple and brief solution about this use case 
i will use java script function and client listener for this 
i am using jdeveloper Studio Edition Version 11.1.2.3.0 11gR2

step 1:

first of all create the simple application base on HR Schema and cretae the Employees view object and based on employees entity and then drag it as Form on page just like below

step 2:

now go to page source and paste this javascript code :

<af:resource type="javascript">
function myonkeypressbookdate(componentEvent)
{
    var evt = componentEvent.getNativeEvent();
    var keyCode = AdfAgent.AGENT.getKeyCode(evt);  

    if (AdfAgent.AGENT.getKeyCode(evt) == 13) // 13 is ENTER
    {
        AdfFocusUtils.focusNextTabStop(componentEvent.getNativeEventTarget());
    }
    
}
 </af:resource>



step 3 

now back to the design mode of page and select one of inputtext from form and then drag 
af:clientlistener from component pallet set the properties as below:
for example i have seleted firstName and set the property as 


<af:inputText value="#{bindings.FirstName.inputValue}" label="#{bindings.FirstName.hints.label}"
                              required="#{bindings.FirstName.hints.mandatory}"
                              columns="#{bindings.FirstName.hints.displayWidth}"
                              maximumLength="#{bindings.FirstName.hints.precision}"
                              shortDesc="#{bindings.FirstName.hints.tooltip}" id="it2">
                    <f:validator binding="#{bindings.FirstName.validator}"/>
                    <af:clientListener method="myonkeypressbookdate" type="keyPress"/>
                </af:inputText>

or as in figure:


now run the page press CreateInsert , the focus will be on FirstName , 
 Press Enter key insted of tab , you will see the focus navigate to next Inputtext for example Last Name
 :) 

Note: 

             but for using Enter Key for all input text we have to write the class which cretae client listener to all inputtext present on page 

just a 2 step more ,