Sunday, 17 August 2014

Call Data Control method from managed bean in MAF

If you have requirement to call the Data Control method from managed bean, Use AdfmfJavaUtilities.invokeDataControlMethod(). Below is complete code




Data Control method name is calculateDays with three argument of String type. In below method "iHCMWSClient" (name of the data control).

        List pnames1 = new ArrayList();
        List params1 = new ArrayList();
        List ptypes1 = new ArrayList();

        pnames1.add("arg0"); //start date
        ptypes1.add(String.class);
        params1.add(TimeShift.convertStringToDate(startDate));

        pnames1.add("arg1"); //endDate
        ptypes1.add(String.class);
        params1.add(TimeShift.convertStringToDate(endDate));

        pnames1.add("arg2"); //personID
        ptypes1.add(String.class);
        params1.add(new AbsenceRequest().getpID());

        System.out.println("%%%%% result" + noOfDays);
        try {
            noOfDays =
                    (String)AdfmfJavaUtilities.invokeDataControlMethod("iHCMWSClient", null, "calculateDays", pnames1, params1, ptypes1);

    System.out.println("%%%%% result" + noOfDays);
     
        } catch (AdfInvocationException e) {
            throw new AdfException("error ", AdfException.ERROR);
        }



Calling Java Script function from java bean class in MAF

Hi

Sometimes you may get requirement to call javascript function from bean class, Use below invokeContainerJavaScriptFunction() to call the Javascript function.

doAlert() is JS function with one argument.

                AdfmfContainerUtilities.invokeContainerJavaScriptFunction("com.ihcmMobile.Absence", "doAlert",
                                                                          new Object[] { " Absence Record Already Exist " });



JS Function:

doAlert = function () {
        var args = arguments;
        var str = ""+ args[0];
        alert(str);  //Absence Record Already Exist  gets printed

    };



Error while deploying MAF app to android - Cannot run program "\sdk\tools\zipalign"

Hi

If you are getting the below error while deploying the application to android. Here is the solution

[11:11:31 AM] Cannot run program "\sdk\tools\zipalign"": CreateProcess error=2, The system cannot find the file specified
[11:11:31 AM] CreateProcess error=2, The system cannot find the file specified

During the deployment jdeveloper creates .apk file using zipalign.exe file. But zipaling.exe is not exist in this location C:\Program Files\Android\sdk\tools\zipalign.

Solution is copy the zipaling.exe from   \build-tools\19.1.0  to \sdk\tools folder.




Getting Started With Oracle MAF

Oracle MAF:


Oracle MAF (Mobile Application Framework) is a hybrid-mobile framework that enables developers to rapidly develop single-source applications and deploy to both the Apple iOS and Google Android platforms. Oracle MAF provides a complete MVC development framework - that leverage Java, HTML5 and JavaScript - with declarative user interface definition, device services integration and built-in security. Oracle MAF maximizes code reuse and results in faster development of compelling mobile applications.




Features and Benefits


  • Develop once, deploy to multiple mobile devices and platforms including iOS and Android
  • Choose your preferred development language Java or JavaScript
  • Leverage Over 80 components for simpler development of richer user interfaces
  • Accelerate development through visual & declarative application development
  • Choose your preferred IDE - Oracle JDeveloper or Eclipse
  • Access native device services, such as phone, SMS, camera, GPS and more
  • Integrate both on-device and browser-based mobile interfaces into the same applications

For More information on Oracle MAF go through the link Oracle MAF


Tuesday, 17 June 2014

Book Review: Oracle ADF Faces Cookbook by Amr Gawish



The book contains10 chapters:
  1. Building Your ADF Faces Environment From the Ground Up

  2. Getting Started with ADF Faces and JDeveloper

  3. Presenting Data Using ADF Faces

  4. Using Common ADF Faces Components

  5. Beautifying the Application Layout for Great User Experience

  6. Enriching User Experience with Visualization Components

  7. Handling Events and Partial Page Rendering

  8. Validating and Converting Inputs

  9. Building Your Application for Reuse

  10. Scaling your ADF Faces Application
This book makes you more expertise in Oracle ADF faces, Novice developers feels little bit difficult to understand the concepts because the book uses its own DB schema and it will be difficult to understand the ADF Business components layer its pre-built.

The book is good for the experience developers, who can aware of more adf faces components in Jdeveloper 12.1.2.0.0 .
Interesting part is the book tells about the skins, layouts and other components exist in jdev 12c. It also proved the sample applications to practice. Some of the chapters are really interesting like event handling, Active data services etc.

You can purchase the book from the below site

Thursday, 22 May 2014

Add CSS to af:table column header in ADF page

Hi, In this post i am going to show you how to add the css to column header of af:table

Step1: Create the ADF Skin file (.css file)

Step2: Create the css class as shown below

.head{
font-size: 20.0pt;
font-weight: bold;
color: Red;

}

Step3: Call the css class on af:column  (headerClass="head")

Step4: Run the page.


Thanks :) happy learning :)

Wednesday, 21 May 2014

Convert input text Content to Upper Case or Lower Case

In this post i am going to talk about converting lower case data to upper case (or Upper Case data to Lower Case). There are multiple solutions to achieve this but i am showing there different methods.

1. you can use contentStyle="text-transform:uppercase;" on input text field.
        --text-transform:lowercase;
   
       
2. Using java script code

<af:resource type="javascript">
      function convertToUpperCase(evt){
        var field = evt.getCurrentTarget();
        var fieldVal= field .getSubmittedValue();
        field .setValue(fieldVal.toUpperCase());        
    }
    </af:resource>


 <af:inputText label="Label 1" id="it1">
                <af:clientListener method="convertToUpperCase" type="valueChange"/>
              </af:inputText>


3. You can create ViewRowImpl.java class with accessors and use toUpperCase() of String class

    public void setFirstName(String value) {
        setAttributeInternal(FIRSTNAME, value.toUpperCase());
    }


Thanks :) Happy Learning :)