Updating Standard Attributes of ADF Components

public void reorder(ActionEvent actionEvent) {

try {

// getting RichTable Object

RichTable richTable = getCorrTable();

// getting children of RichTable

List<UIComponent> uiComponentList = richTable.getChildren();

//iterating over childrens

if (uiComponentList != null) {

for (UIComponent uiComponent : uiComponentList) {

//checking instance of children

if (uiComponent instanceof RichColumn &&

uiComponent.isRendered()) {

// setting display index

((RichColumn)uiComponent).setDisplayIndex(-1);

adjustColumnDisplay((RichColumn)uiComponent,false);

}

}

AdfFacesContext.getCurrentInstance().addPartialTarget(panelCol);

}

} catch (Exception ex) {

ex.printStackTrace();

}

}

 

Private void adjustColumnDisplay(RichColumn uic, Boolean visibleFlag){

FacesContext fc = FacesContext.getCurrentInstance();

ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();

ComponentChange cc = new AttributeComponentChange(“visible”, visibleFlag);

cm.addComponentChange(fc, uic, cc);

}

In this sample, we are taking all columns of a table in reorder method and changing visible=false. Similiarly it could be applied for any UIComponent and any attributes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s