Wednesday 25 May 2011

Tuesday 17 May 2011

Swing vs. ADF UI components

I am trying to build a small application to help the voting system for contests at ROMANIAN HAIKU,  a yahoo group dedicated to Japanese short-poem writers that I have recently joined.

I am planning to develop two versions of the application, at first using Swing, and then ADF UI components, in order to be able to compare them and draw some useful conclusions. (I already feel that the central point might be the fact that most of the Swing API is not thread safe.)

I hope this task I have set for myself to result in an article that I will publish here, dedicated to a friend that I have recently disappointed in a discussion over Swing. (Please forgive me...)

As a starting point I shall use this example of displaying and editing table data with JTable:
http://download.oracle.com/javase/tutorial/uiswing/components/table.html

Happy programming!

Friday 13 May 2011

Managed Beans and Backing Beans in Standard JavaServer Faces, Java EE and ADF Applications

A typical JavaServer Faces application includes one or more backing beans, each of which is a JavaServer Faces managed bean that is associated with the UI components used in a particular page.

The managed beans can be referenced in an EL expression, allowing access to the beans' properties and methods.

"Technically, a Managed Bean is a POJO that's constructed and injected by the JSF framework. It's commonly referenced by JSF pages, but it doesn't have to be. For example, it could be a Session-scope repository of data for other (non-page) resources to reference.

A Backing Bean is a bean that's referenced on JSF pages, and offhand I can't think of any way to establish that reference unless it's a ManagedBean.

So there's a difference, but for most people most of the time, it's small enough that the terms tend to get used interchangeably." (Tim Holloway, http://www.coderanch.com/t/214065/JSF/java/backing-beans-vs-managed-beans)

Managed Beans are new to the Java EE 6 platform, represent a generalization of the managed beans specified by JavaServer Faces technology and can be used anywhere in a Java EE application, not just in web modules. (http://download.oracle.com/javaee/6/tutorial/doc/bnacj.html#gjxsd)

 

Managed Beans in ADF

In a standard JSF application, managed beans are registered in the faces-config.xml configuration file. In a Fusion web application, managed beans can be registered in the faces-config.xml file, the adfc-config.xml file, or a task flow definition file.

Creating and Using Managed Beans in ADF


Deeper Study Path

"Expression Language in JavaServer Faces 1.2 does not support passing arguments to methods in a managed bean. Not a big deal though as you can pass the required information using memory attributes, managed bean properties of the ADF binding layer."

Planning the User Interface in Oracle ADF

1.Describe the Model-View-Controller design pattern
http://javing.blogspot.com/2011/02/web-programmers-most-powerful-weapon.html?spref=bl

2.Differentiate between bounded and unbounded task flows
"An ADF bounded task flow is used to encapsulate a reusable portion of an application. A bounded task flow is similar in some ways to a Java method." 
"A Fusion web application always contains an ADF unbounded task flow, which contains the entry point or points to the application."
(Bounded Task Flows)
Unbounded task flow: A set of activities, control flow rules, and managed beans that interact to allow a user to complete a task. An ADF unbounded task flow consists of all activities and control flows in an application that are not included within any bounded task flow.
Bounded task flow: A specialized form of task flow that, in contrast to an unbounded task flow, has a single entry point and zero or more exit points. It contains its own set of private control flow rules, activities, and managed beans. An ADF bounded task flow allows reuse, parameters, transaction management, and reentry.
(Introduction to ADF Task Flows )
  • There is only one unbounded task flow within an application. Even if you use multiple definition files for unbounded task flows within the application, they will be combined into a single flat namespace at runtime with the entire flow being loaded into memory at startup.
  • Any view activity in the unbounded flow is URL accessible by the user.
  • Unbounded task flows are restricted to view activities that are implemented as whole pages.
  • Bookmarking is only supported by views in an unbounded task flow and is not available in bounded task flows.  (Task Flow Design Fundamentals, An Oracle White Paper, April 2011 )
3.Create task flows to define control flow in an application
http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/taskflows.htm#ADFFD21726

4.Specify control flow rules
 When the user acts on a command component(e.g. button,link) in a JSF application, a rule is invoked to determine the next page to display. These rules are called control flow rules. They can also be invoked by tabs, breadcrumbs or train components. Control flow rules can be defined using one of the following:
  • the visual editor (Navigation Modeler)
  • the Configuration editor (XML Console)
  • the XML file directly
  • the Structure window

5.Define global navigation
A global control flow rule is a rule that applies for all pages (that is a rule that can be called from any page). Use the wildcard control flow rule element in the Component Palette of JDeveloper to define a global control flow rule.

6.Use routers to declaratively route control flow to activities based on an EL expression
http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/taskflows_activities.htm#ADFFD1673

7.Define the role of managed beans in task flows
Managed beans are registered with the application in task flow .xml files.
http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/web_getstarted.htm#CACCFIII

8.Explain the types of validation available in the user interface
  • UI component attributes for validating data (e.g. required)
  • default validation
  • custom validation

Wednesday 11 May 2011

Binding ADF Faces UI Components to Data

1. Create an empty JSF page
You create JSF JSP pages using the Create JSF Page dialog. 
If you use ADF Faces components you must have af:document enclosed within f:view.

2. Use three different ways to add ADF Faces UI components to a page  
3. Describe the types of data-bound components that can be added to a JSF page 
  • Iterator bindings
  • Value bindings
  • Action bindings
(http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcdcpal.htm#ADFFD492)

4. Describe the structure of an EL (Expression Language) expression  

     #{bindings.BindingObject.propertyName} 
(http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcdcpal.htm#ADFFD526)


    Tuesday 10 May 2011

    Java SCJP Mock Exam Engine

    This looks good practice for Java SCJP:

    http://www.ii.uib.no/~khalid/pgjc3e/engine.html

    I haven't tried it yet, Java SCJP exam still scares me :)

    I'll stick by ADF for a while...

    Monday 2 May 2011

    Training for Oracle ADF Certification

    I would like to attend in-class, group training for Oracle ADF certification. If you know of any such possibility in Bucharest, please share the information. Thank you!
    Accelebrate
    Oracle Fusion Developer's Guides