Archive for the ‘ADF Components’ Category

JDev & ADF Goodies

This post describes how to implement an dvt:treemap which shows a af:popup when the user clicks on a detail node in the map.
The documentation of the dvt:treemap component tell us that the dvt:treemapnode supports the af:showPopupBehaviortag and reacts on the ‘click’ and ‘mouseHover’ events.
This is part of the solution and allows us to begin implementing the use case. We add an af:showPopupBehavior to the nodes we want to show detail information for.

After creating a default Fusion Web Application which uses the HR DB schema, we begin with creating the data model for the model project. For this small sample the departments and employees tables will be sufficient.

The views are named according to their usage to make it easier to understand the model. This is all we need for the model.

Let’s start with the UI which only consist of a single page. The page has…

View original post 474 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

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

Oracle ADF

Use Case – Create a custom validator to validate and To/From Date

Solution – 

JSPX – 

<?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″>
<af:form id=”f1″>
<af:panelFormLayout id=”pfl1″>
<af:inputDate label=”End Date” id=”endDate”>
<f:validator validatorId=”DateToFromValidator”/>
<f:attribute name=”startDate” value=”startDate”/>
</af:inputDate>
<af:commandButton text=”Submit” id=”cb1″/>
</af:panelFormLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>

Validator – 

package view;

import java.util.Date;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import javax.faces.validator.Validator;

import javax.faces.validator.ValidatorException;

import oracle.adf.view.rich.component.rich.input.RichInputDate;

public class DateToFromValidator implements Validator{
public void validate(FacesContext facesContext, UIComponent uIComponent,
Object object) throws ValidatorException {
String dueDateComponentId = (String)uIComponent.getAttributes().get(“startDate”);
RichInputDate richInputDate =(RichInputDate) uIComponent.findComponent(dueDateComponentId);
Date startDate = (Date)richInputDate.getValue();
Date endDate = (Date)object;
String labelStartDate = richInputDate.getLabel();
String labelEndDate = ((RichInputDate)uIComponent).getLabel();
if((startDate == null)||(endDate == null)||(endDate.compareTo(startDate)<0)){
FacesMessage facesMessage = new FacesMessage();
facesMessage.setSummary(labelStartDate + “/”+ labelEndDate + ” Validation Error!”);
facesMessage.setDetail(labelStartDate + ” should be less than ” + labelEndDate);
facesMessage.setSeverity(facesMessage.SEVERITY_ERROR);
facesContext.addMessage(uIComponent.getId(), facesMessage);
}
}
}

Config File (Adfc-Config)- 

<?xml version=”1.0″ encoding=”windows-1252″?>

View original post 16 more words

Oracle ADF

 

  1. In order for an ADF application to support High Availability in clustered environment with server fail over. The below steps must be followed in developing an ADF application.
  • All Manage Beans must implement Serializable.
  • UI component bindings must be declared in a bean with shorter scope (backing bean scope or request scope).
  • If it needs to be declared in Manage Bean with PageFlowScope (Not recommended), please ensure you declare the binding as transient.
  • Any objects that are declared as an attribute in Manage Bean must be Serialized.
  • Ensure that all managed beans with a life span longer than one request are serializable (that is, they implement the java.io.Serializable interface). Specifically, beans stored in session scope, page flow scope, and view scope must be serializable.
  • Verify that Oracle ADF is aware of changes to managed beans stored in ADF scopes (view scope and page flow scope) and enable tracking changes…

View original post 291 more words

Shay Shmeltzer's Oracle JDeveloper and ADF Blog

The map component provided by the ADF Faces DVT set of components is one that we are always ending up using in key demos – simply because it is so nice looking, but also because it is quite simple to use.

So in case you need to show some geographical data, or if you just want to impress your manager, here is a little video that shows you how to create two types of maps.

The first one is a color themed map – where you show different states with different colors based on the value of some data point there. The other is a point theme – basically showing specific locations on the map. For both cases I’m using the Oracle provided mapviewer instance at http://elocation.oracle.com/mapviewer.

You can find more information about using the map component in the Web User Interface Developer’s Guide here and in the tag doc…

View original post 39 more words

Shay Shmeltzer's Oracle JDeveloper and ADF Blog

Picking up from yesterday’s post about using the External Tools->Ant Operation to integrate third party utilities into JDeveloper, here is a quick entry that shows how to integrate the FindBugs utility in a similar way. (You should probably watch the Checkstyle video first).

First get findBugs and extract it onto your hard drive (in my case I extracted it to C: to get the folder C:/findbugs-2.0.0.

Then in that directory I created the following ant build file:

<?xml version=”1.0″ encoding=”windows-1252″ ?>
<project xmlns=”antlib:org.apache.tools.ant” default=”init”>
<taskdef name=”findbugs” classname=”edu.umd.cs.findbugs.anttask.FindBugsTask”/>
<target name=”init”>
<tstamp/>
</target>
<property name=”findbugs.home” value=”C:/findbugs-2.0.0″ />
<target name=”findbugs”>
<findbugs home=”${findbugs.home}” output=”text”>
<sourcePath path=”${basedir2}/src/java” />
<class location=”${basedir2}/classes” />
</findbugs>
</target>
</project>

When you create the External Tools -> Ant operation you’ll point to that file and choose the findbugs operation. You then define basedir2 as a property of the Ant operation and uses the ${project.dir} value in JDeveloper. And you can…

View original post 78 more words