Skip to main content

Posts

Showing posts from February, 2011

How to create ADF components on runtime?

Quite easy actually! There are two methods by which we can do it. Either we can create the component in the managed bean and add it to the children of an existing component, or we can create it in our .jspx or .jsff page directly.

1) Creating component in the Managed Bean.

In the below code we are creating a new ShowDetailItem which we will add to an existing panelTabbed item.

private UIComponent createComponent() {
UIComponent componentToAdd = null;

//Create new object of ShowDetailItem and set its properties.
RichShowDetailItem item = new RichShowDetailItem();
item.setDisclosed(true);
item.setText("new tab");
componentToAdd = item;

//Now that we are at it, I am creating a new iFrame which will be set inside the ShowDetailItem
RichInlineFrame frame = new RichInlineFrame();
frame.setSource("http://oracle.com");

//add the iFrame to the children of the ShowDetailItem
componentToAdd.getChildren().add(frame);