Assume the following task flow:
And now assume that we need to show the navigation available from the present view activity in a choice list, as shown below:
The question is how to do this?
Solution:
We need to use Capabilities API available in java to populate the choice list as shown below:
public SelectItem[] getSelectItems(){
RegionModel rm = getRegion().getRegionModel();
Set<String> capabilities = rm.getCapabilities();
SelectItem[] si = new SelectItem[capabilities.size()];
Object[] s = capabilities.toArray();
for ( int i = 0; i < s.length; i++ ){
option = s[i].toString();
si[i] = new SelectItem(option);
}
return si;
}
You can refer that from the SelectOneChoice component as shown below:
<af:selectOneChoice label="Navigations Available" id="soc1" ...>
<f:selectItems value="#{Bean.selectItems}"
id="si1"/>
</af:selectOneChoice>
Note:
The EL equivalent to use the capabilities is shown as below:
"#{bindings.EmpDeptTaskFlow1.regionModel.capabilities['Department']}"
The above EL expression figures out if the region is having Department as an available navigation capability from the current view activity.
That's it.
JDev Release 11.1.1.4
No comments:
Post a Comment