Friday, 3 June 2016

Dependent LOV's on required fields in ADF

Very often it happened to implement dependent LOV's on required attributes in ADF. In this post i will show you how we can implements such use case. Implementing  dependent on non required attributes is quite easy.
Lets take Employees table from HR schema and create ADF BC on employees table. Am using jdev 12.2.1.

Step1. Create dependent LOV's on DepartmentId and LastName attribute and add the partial trigger on last name and auto submit = true on DepartmentId and run the page. Try to change the departmentId value from list and then the problem comes 


Issue: In some departments there is no employees Example 170 - Manufacturing then you will see some required validation message.



To fix such issues follow the below steps 

Step2: Create valueChange event on department id and place the below code 


Run the page.




Cheers :) Happy Learning :)


Saturday, 5 March 2016

Oracle MAF Pull to Refresh component

The new MAF 2.2 Version have various new components one of the them is Refresh component.
Instead of displaying a refresh button to a user, you can use this component to expose the concept of refreshing as a gesture. Use listView inside of this container. When the user drags their finger down anywhere within this container, a determination will be made to see whether any component between the container and the finger is not scrolled to its top. 

For more information about amx:refreshContainer follow oracle doc here

Step1: create a list view as shown below



Step2: surround list view component with amx:refreshContainer


Setp3: provide the required attributes to refresh container component



Output: Pull down the list view



Thanks :) Happy Learning :)





Wednesday, 24 June 2015

Access client machine printer using PrinterJob in Oracle ADF

Hi Folks this post is about accessing client machine printer using java PrinterJob in ADF application. Sometimes we may get requirement to handle windows printer like "Direct printing without print dialog box". You cannot customize the windows printer.
By using the Java PrinterJob you can completely handle print dialog and its properties from java. For more information on java PritnerJob check this
This can be achieved using Applet integration in ADF page.  For applet integration in ADF page go through my previous post Get Client machine MAC address in ADF using applet

Follow same steps given in my previous post.
In Messageapplet class add the following java code



Build the jar file and integrate in adf  project. Below is java script call the applet method on button click.


Run the jspx page. Print dialog is of java not windows print dialog.


Download here
Cheers :) Happy Learning :)


Monday, 22 June 2015

Get Client machine MAC address in ADF using applet

Hi folks in this post i will show you how to get client machine MAC address in ADF page using applet.
Step1: Create Generic application. and create java class which extends JApplet.

Step2:  Add the below shown java code. This code use to read the client machine MAC address.




Step 3: Create JAR file for this project and sign the jar file. This link will hep you to sign the jar

Step 4: Create Fusion Web application and add the jar file in public_html folder as shown below




Step 5: Now create jspx page with one button. When you click on button the MAC address displays in POP up. Using javascript will call the applet code and get the mac address.



Step6: Run the jspx page and click on get client mac address button



You can download the code using the link Download

Thanks:) Happy learning:)





Saturday, 30 May 2015

Display Remote Server Images in OracleMAF

Hi folks in this post i will show you how to display remote server image in Oracle MAF application.
Recently i have got requirement to display the images of remote servers in MAF application.
Generally in ADF web application if we add URL to Source attribute it will display image in page. But same will not work with MAF application.


Now Follow the below steps

Step 1:

I'll take google image here. Using below URL you can access the image
http://www.google.co.in/images/srpr/logo11w.png

Now we will display the same image in Oracle MAF application

Step 2:

Create MAF application and add amx page in maf-feature.xml

Step 3:

Add image tag with URL as shown below

 <amx:image id="i1" source="http://www.google.co.in/images/srpr/logo11w.png" inlineStyle="height:20%; width:30%;"/>

Step 4:

Open maf-application.xml file and go to security tab and add the domian in URL whitelist as shown below


Output:











Thursday, 12 February 2015

Insert new row at end of ADF table

Hi All, In today's post i will explain you how to insert new row at the end of table. By default when we click on CreateInsert button it creates a new row at first index of table. But some times we may get requirement to create row at last index of table.

Default CreateInsert at first index in ADF table



Now to add the row at last index as shown below.

We need to override the insertRow(Row row) method of ViewObjectImpl class.


Now run the jspx page and click on CreateInsert button. It creates the row at last index.

Thanks :) Happy Learning :)

Thursday, 6 November 2014

Disable Past dates and future dates in ADF Input Date

Hi all, In today's post i am going to explain you how to disable past date and future date for Input Date component. Sometime you get requiment to disable the past dates and future date also. This post can help you.

My requirement is to show only today and tomorrow's date and rest all need to disable. User should not select othere then these dates.
There are two attributes in inputDate component MinValue and MaxValue.

1. MinValue attribute is used to disable the back dates.

2. MaxValue attribute is used to disable the forward dates.

I have create one bean and two methods as show below

  private Date minDate = new Date();

    public Date getMaxDateVal() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.DATE, 1); 
        return cal.getTime();

    }

cal.add(Calendar.DATE, 1);  // how many forwarding dates need to enable, In my requirement i should show tomorrow date, sho i have mentioned "1".


    public Date getMinDate() {
    try {
                Calendar cal = Calendar.getInstance();
    java.util.Date date = cal.getTime();
    DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
                String currentDate = formatter.format(date);
    minDate = formatter.parse(currentDate);
  
    return formatter.parse(currentDate);
            } catch (Exception e) {
    return null;
            }
        }


jspx page code is  below.

 <af:inputDate label="Label 1" id="id1"
                      binding="#{viewScope.DateBean.testdate}"
                      maxValue="#{viewScope.DateBean.maxDateVal}"
                      minValue="#{viewScope.DateBean.minDate}"/>

 Run the page.


Thanks :)  Happy Learning :)