Archive for the ‘ADF Programmatically’ Category

JDev & ADF Goodies

Recently a question on the OTN JDeveloper & ADF Space caught my interest. The question was how to initialize an af:quickQuery component with a parameter passed to a task flow on load of a page.
At first I thought that this would be a simple case of setting a property (InitialQueryOverwritten=true) as mentioned by Frank Nimphius in his article How-to query af:quickQuery on page load ?, but after a short test it turned out, that this setting only executes the query but can’t be used to initialize the criteria.

This blog is about a solution to this problem. The question can be divided into two smaller problems to solve. The first is to pass a parameter to a bounded task flow and use the passed parameter in the bounded task flow. The second problem is to initialize a default query attribute of a af:quickQuery component and execute the query.

View original post 833 more words

JDev & ADF Goodies

In the current JDeveloper version 11.1.1.9.0 and 12.1.3 the af:exportCollectionActionListener got enhanced by options to filter the data to export.
Enhanced options of exportCollectionListener Enhanced options of exportCollectionListener
The option this blog talks about is the one marked, the FilterMethod. The ducumentation for 12.12 Exporting Data from Table, Tree, or Tree Table does not reveal too much about how to use this FilterMethod.
The sample we build in this blog entry shows how the FilterMethod can be used to filter the data to be exported to excel.
In older version of JDev you hadto use a trick to filter the data which was downloaded from a table see Validate Data before Export via af:exportCollectionActionListener or af:fileDownloadActionListener. The new property of the af:exportCollectionActionListener allows to filter the data without using the trick.
The sample just load the employees table from the HR DB schema and shows it in a table on the screen. In…

View original post 352 more words

JDev & ADF Goodies

A question on the JDeveloper & ADF OTN forum about removing rows from a table which is based on a list of POJOs provides the reason for this blog post. The implementation, as simple as it is, holds a surprise.

The sample application build for this sample shows the POJO and the list of POJOs built from it. The list is lazy initialized at the time it’s first accessed (see https://tompeez.wordpress.com/2014/10/18/lazy-initalizing-beans/ for more info on this technique). On the only page a table build from this list.

In the last column we add a button which should remove the row.

As the table is build on a list, we can’t use the default selection listener to get the selected row. Instead we use a setPropertyListener to pass the selected row index to a viewScope variable.

The actionListener we use for the remove button picks up the row index and users…

View original post 274 more words

JDev & ADF Goodies

The new JDeveloper version 12.2.1 is just out and has a lot of new features to investigate. In this post we see how remote task flows work. Yes, they are finally here and they are working. At least if you install a patch available from support.oracle.com.
The downloadable version on JDev 12.2.1 has a small bug which prevents you from running remote task flows (refer to https://community.oracle.com/thread/3816032). Support and the dev team quickly delivered a patch for this. To get the patch, open a service request and ask for a patch for bug 22132843.

Let’s start. We need two applications to show how remote task flows are implmented. One is the remote task flow producer, one consumes the remote task flow. An application can be both, producer and consumer. For this sample we keep it simple and define one app as producer and one as consumer.

Producer Application
This application…

View original post 543 more words

JDev & ADF Goodies

A question on the JDeveloper and ADF OTN forum asked about how to navigate to a specific page of an af:table in pagination mode. As of JDeveloper 11.1.1.7.0 adf tables can be rendered in scroll mode or in pagination mode where only a specific number of rows are visible in the table.

af:table in pagination mode

To navigate the pages there is a small navigation toolbar below the table which allows to enter a page number or to navigate to the previous, next, first or last page.

The problem to solve is how to navigate the paginated table from within a java bean?

The table doesn’t offer any navigation listeners or methods you can bind bean methods to. Luckily there is the RangeChangeEvent one of the FacesEvents which can e used to notify a component that change in the range has taken place.

All we have to do to navigate the table in pagination…

View original post 440 more words

JDev & ADF Goodies

I almost missed that Developer Cloud Service has been updated to 12.2.1. Great news as we now can use JDeveloper 12.2.1 to access the agile capabilities like

  • Interact with Tasks/Issues in JDeveloper
  • Leverage the Team view in JDeveloper (tasks, builds, and code repositories)
  • Connect to DevCS and its projects from inside JDeveloper
  • Create Agile boards and manage sprints in Developer Cloud Service
  • Associate code commits with specific tasks
  • Monitor team activity in the Team Dashboard
  • Handle Git transactions

For more information about how JDeveloper and the DCS are integrated watch this video ‘Agile development with Oracle JDeveloper and Oracle Developer Cloud Service’.

This was possible since last year. So, what’s new?

New is that the JCS is also available in 12.2.1 and that we can use the whole continuous integration scenario. For this we have to configure a 12.2.1 JCS instance which then can be used for deployment. When…

View original post 199 more words

JDev & ADF Goodies

Since JDeveloper 12.1.3 the invoke action used in earlier version has been deprecated. Users still using the old invoke action to load data on page load should migrate their code to using the default activity in a bounded task flow instead. This article describes how to use the executeWithParams method as a default activity in a bounded task flow (btf) to load data to be shown in a region. For this we implement a common

Use Case:
in a text field the user enters a string which should be used to look-up data in the DB and show the data as a table in a region.
For this we use the HR schema and build a look-up for locations after the name of the city of the location. In a page the user can insert the name or part of a cities name into a text field. This input is…

View original post 634 more words

Oracle ADF

Use Case – There is a use case where User wants to display blank as selected when page loads. But he doesn’t want blank to remain there once user select any value.

Solution – This is a workaround.

Step 1, Create one JSPX with foloowing contents,

<?xml version=’1.0′ encoding=’UTF-8′?>
<jsp:root xmlns:jsp=”http://java.sun.com/JSP/Page” version=”2.1″
xmlns:f=”http://java.sun.com/jsf/core”
xmlns:h=”http://java.sun.com/jsf/html”
xmlns:af=”http://xmlns.oracle.com/adf/faces/rich”>
<jsp:directive.page contentType=”text/html;charset=UTF-8″/>
<f:view>
<af:document id=”d1″ title=”doc1″>
<af:form id=”f1″>
<af:commandButton text=”commandButton 1″ id=”cb1″
action=”#{ForwardBean.process}” partialSubmit=”true”/>
<af:selectOneChoice label=”Label 1″
id=”soc1″ required=”true” binding=”#{ForwardBean.dropdown1}” showRequired=”false”>
<af:selectItem label=”Item1″ value=”one” id=”si1″/>
<af:selectItem label=”Item2″ value=”two” id=”si2″/>
<af:selectItem label=”Item3″ value=”three” id=”si3″/>
</af:selectOneChoice>
<af:outputLabel value=”outputLabel1″ id=”ol1″
binding=”#{ForwardBean.updateState}” visible=”false”/>
</af:form>
</af:document>
</f:view>
</jsp:root>

Step 2. Create one MBean with following contents.

package com.test;

import javax.faces.event.PhaseEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
import oracle.adf.view.rich.component.rich.output.RichOutputLabel;
import oracle.adf.view.rich.context.AdfFacesContext;

public class ForwardBean {
private RichSelectOneChoice dropdown1;
private RichOutputLabel updateState;

public ForwardBean() {
}

public String process() {
// Add event code here…
return “success”;
}

public void pushSelectedItem(ValueChangeEvent valueChangeEvent)…

View original post 51 more words

Shay Shmeltzer's Oracle JDeveloper and ADF Blog

Ever wondered how to notify users of your ADF Faces application that they have uncommitted changes on their ADF page before they go off and check their facebook page (or just close the browser’s tab)?

Well there is a little nifty feature in ADF Faces that makes this trivial – the uncommittedDataWarning property of your af:document tag.

I don’t remember at which specific version of JDeveloper this feature was added, but a quick google for “unsaved changes in ADF” brought up some older solutions and I figured I’ll raise the awareness of this relatively newer feature with a little video.

By the way there is a longer explanation of this un-saved changes feature in relation to bounded taskflows here.

Another thing I show in the video is something that often causes newbies to stumble – and that’s the reason why commit/rollback are not enabled on your page. This is…

View original post 86 more words

Environment (JDeveloper 11.1.1.5.0, ADF BC, hr schema)

Most of us know how we can add a validation rule using methodValidator on an attribute. However, this is not the only way that we can add a business rule for an attribute, we can add our business rule in the setter method for that attribute.

In this post I will explain how to add business rule in the setter method of an attribute and describe the difference if we add a business rule using methodValidator. This example based on hr schema, mainly on Employees table, and supposed that you already have built your BC. Our business rule is that the PHONE_NUMBER column should be at least 9 digits.

First Part.

The first part of this example is to add a business rule using  validatePhoneNumber method as shown below.

/**
     * Validation method for PhoneNumber.
     */
public boolean validatePhoneNumber(String phonenumber) {

View original post 460 more words