Friday, November 18, 2011

Adding multiple times set of adf components from backing bean

This is an requirement I had in my project, I would like to share this.
This requirement I solved with help of Frank. The requirement is as follows,

There are five fields say, Input text, InputDate and so on. And an ADD button.
Initially I am not showing any the components in the page. When I click on ADD button I have to show the pages. Similarly I have to add one more set of pages when I click ADD button. Like this I will add as many as I need.

Let me tell you the steps

1. Create a managed bean that exposes a HashMap property. The HashMap is of type e.g. Map

2. To create a new set of fields, add a new entry to the HashMap and refresh the af:formLayout. The af:formLayout contains and af:forEach that you use
to iterate as often as you have entries in the HashMap. Each text field you bind to #{bean.HashMapProperty['key'].attribute}, for example
#{bean.HashMapProperty['key'].FirstName}
#{bean.HashMapProperty['key'].LastName}
#{bean.HashMapProperty['key'].EmployeeId}


3. When the user updates a field, the HashMap is updated based on the "key"

4. The managed bean should be in viewScope and referenced from the field's value property

5. Finally, like this




Monday, June 13, 2011

How to remove the null at the bottom of the af:carousel item ?

In IE browser, at the bottom of the component the null is displayed, that is in build item will displayed by the weblogic server on page rendering, So you can make it disappear using the script on the page load.






document.getElementById(‘c1:it’).style.visibility=’hidden’;

c1:it – is the id of the carousel component. If the carousel appears inside some page template say the page template id pt1, then the carousel id will be pt1:c1:it. If you don’t know to find the proper id, you can find it in the html source in the browser view->source.

download source here





How to make the current row item on spinning the carousel ?

On Spinning of the carousel component, the row will not points to the currently visible item, to make the current row on spinning write the code like this in the carousel spinListener,
download source here



How to set the new record to current visible item inside the carousel ?

Usually, while adding the new record in the carousel, the record will insert in the beginning. Even though you are at the middle of the carousel, the new record will be added at the beginning. To make the new record to the current visible item set the current row key to the currentItemKey.

This is the default behavior while adding the new row

After setting the currentItemKey,

Key key = currentRow.getKey();
ArrayList alist = new ArrayList();
alist.add(key);
// adding the current row key to the carousel tiem key
corouselcomp.setCurrentItemKey(alist);

contrlArea attribute if set to small, the slider looks like this

controlArea attribute if set to compact, the slider looks like this


For more about af:carousel

http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_carousel.html