Skip to main content

Posts

Showing posts from November, 2010

LOV enabled date field throws date format error !

While working with LOV enabled attribute date fields, you might have experienced some strange date format error on UI - "The date is not in the correct format". The reason for this error is well documented in developers guide, please refer topic 5.12.5 How to Handle Date Conversion for List Type UI Components in Fusion Developer's Guide.

In simple words, the underlying run time mechanism tries to copy the selected date from the LOV pop-up to the target field using the date format specified for the attribute. This may fail to do so if the format turns out to be null/invalid. Here, you are supposed to specify date format for LOV enabled 'date' attribute of the view object(using Control Hints editor for the attribute). Later, this 'pattern' would be used by af:convertDateTime to convert string into Date.

<af:inputListOfValues id="startDateId" popupTitle="Search and Select: #{bindings.StartDate.hints.label}" ......... shortDe…

What if you missed the Key definition for a ViewObject ?

When you create ViewObject WITHOUT choosing EntityObject as data source, there are chances that you may forget to define Key for the generated ViewObject. Actually the Key definition play a very vital role when ADFm(binding layer) comes in to picture. Many of the binding specific APIs make use of the 'Key' from the ViewObject to identify rows uniquely. Let me share a couple of issues that may arise if you miss out Key definition for a ViewObject

1. RichTable::getRowData() returns null.

Please see the below shown code snippet. This code is typically used to get the data for the selected rows for a table from the backing bean.

RowKeySet selectedRowKeys = someTable.getSelectedRowKeys(); //Store original rowKey Object oldRowKey = someTable.getRowKey(); if (selectedRowKeys != null) { Iterator iter = selectedRowKeys.iterator(); if (iter != null && iter.hasNext()) { Object rowKey = iter.next(); someTable.setRowKey(rowKey); //stamp row JUCtrlHierNodeBind…

Specifying defaultColor for <af:inputColor>

The <af:inputColor> creates a text field for entering colors and a button for picking colors from a palette. If you need to specify defaultColor for this component, you can use java.lang.String of hex color code as shown in the following sample. Please note that defaultColor value follows #RRGGBB syntax.
<af:inputColor label="Enter or select color from palette below" compact="false" defaultColor="#000000" id="id1"/>

An example of clickListener implementation for <dvt:barGraph>

In this post I'm sharing an interactive bar graph example built using <dvt:barGraph> and a clickListener for the graph component. The basic <dvt:barGraph> used in this example is built using the same approach as suggested by Frank in his ADF Code Corner sample #17. So, I'm not repeating those steps(for building graph using ViewObject) in this post.

Use Case

This example displays a bar graph of total salary for each department. Please see the following picture - Departments are plotted on X-axis and Salary on Y-axis


When user clicks on a 'Bar', he/she is presented with popup window to edit the data used for building the Bar. On closing the popup, graph gets refreshed to reflect the modified data


A glance at the implementation


The <dvt:barGraph> supports listener interface for receiving click events on the graph components. This example is built based on this concept. The clickListener gets triggered when user clicks on the bars of the graph, and the …

Triggering Navigation from a Contextual Event Handler Method

ADF task flows are key building blocks for a Fusion Web Application. You can render a bounded task flow in a page using ADF region. Often a parent page may need to trigger navigation within the embedded region while responding to specific user actions. This blog post discusses such a use case scenario and a possible solution for the same.

Consider a generic case where a JSF page contains a bounded task flow added as a region. Here the requirement is that when user selects specific option displayed on the parent page, the ADF region's content(taskflow view activity) should navigate to an a new view/page. Let me try to explain this scenario with a more realistic example. Please see the following diagram. You may notice that deptemp-task-flow-definition is added as region to a page and the this page is having two buttons to edit the department and employee details. On clicking these buttons on parent page, the 'embedded' deptemp-task-flow should navigate to the corresponding …

Layout Tips - Organizing page content using <trh:tableLayout>

ADF Faces is packaged along with rich set of layout components which can be used to arrange other components on a page. Though these components are smart enough to meet most of your requirement, sometimes you may need to look around for other layout components to realize specific UI features. This discussion is based on such a scenario where I'm using <trh:tableLayout> for building certain part of the UI. btw, this post is in (logical) continuation of my previous post on Layout Tips - Stretching components....

In this post, I'm discussing a UI centric use case implementation using ADF Faces layout components along with MyFaces Trinidad <trh:tableLayout>. Though mixing of the components from these two families are not considered as good practice, sometimes you may need to move out of the box to make your application working :)

A Case Study

Requirement is to build a web page as shown in following screen shot.


In my experience, the painful phase of UI design is pick…

Time moves so fast !

I just realized that in the last month I finished my 2 years with Oracle( well don't rise your eyebrows..this is not a short time span if you see my job history he..he..)
Yes, time moves so fast :D

Let me plan something new for coming year(s). At this stage of my journey with ADF, I'm renaming this blog as 'Decompiling ADF Binaries' with your permission. The motive behind this move is to give more focus on areas where we don't have enough documentation or samples. On a related note, If I can be of any help on ADF/JavaEE technology stack, please let me know. Feel free to write your questions/suggestions to jobinesh@gmail.com, I'll be happy to listen to you.

What you may need to know about source URI for an <af:inlineFrame>

The <af:inlineFrame> component creates an inline frame tag. The content of the inline frame is loaded through the source attribute.
e.g: <af:inlineFrame id="if1" source="/faces/someView.jspx"/>

Please note that, <af:inlineFrame> let you to define the 'relative' source URLs in two ways.

1. Relative to the current web application

<af:inlineFrame id="if1" source="/faces/someView.jspx"/>In this case the source is looked up relative to the current web application's context. This approach is useful if the page resides in the same 'war' file

2. Relative to the server root

<af:inlineFrame id="if1" source="//<app_context>/faces/someView.jspx"/>Please note that URL starts with double forward slash in this case. Here the source is looked up relative to the server root. This is very useful if the you need to load a page from another 'war' file within the same server root. Ap…

Converting user input to uppercase

Converting the user input to upper case is a very common requirement for a typical web application. In this post, I'm sharing a simple solution for this use case using Java Script. Idea is to trigger the client side Java Script method using <af:clientListener> for 'keyUp' event. The below given code snippet may give you better idea on the implementation part.
<af:resource type="javascript"> function toUpper(event) { var inputComp = event.getCurrentTarget(); inputComp.setValue(inputComp.getSubmittedValue().toUpperCase()); } </af:resource> <af:inputText value="#{bindings.CountryId.inputValue}" label="#{bindings.CountryId.hints.label}" required="#{bindings.CountryId.hints.mandatory}" columns="#{bindings.CountryId.hints.displayWidth}" maximumLength="#{bindings.CountryId.hints.precision}" shortDesc="#{bindings.CountryId.hints.tooltip}" id="it2"…