Skip to main content

Referring ViewAttributeDefImpl properties from the dynamic UI tag

I have blogged on generating dynamic UI some time back. In case you missed them, here are the links
Model driven approach for building Dynamic UI
Enabling LOVs for Dynamic ViewObject attributes
Long living Dynamic Business Components

Here is a tip for you to refer the ViewAttributeDefImpl properties such as label and other custom properties  from the dynamic UI such as dynamic table.
For example if you have set label for an attribute as given below, it can be referred from UI through
#{defXXX.propertyMap.label} 

Code snippet for setting propertu for attribute definition in a dynamic view object(if you are not following this code snippet read Model driven approach for building Dynamic UI  and come back)

ViewAttributeDefImpl attrdef= getDynamicAttrdef();
attrdef.setAliasName(col.getName());
attrdef.setProperty("label", getSomeNiceLabel());

UI tag snippet referring the property that we set in the above code.

<af:table rows="#{bindings.DynamicVO.rangeSize}"
                        fetchSize="#{bindings.DynamicVO.rangeSize}"
                        emptyText="#{bindings.DynamicVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                        var="row" rowBandingInterval="0"
                        columnStretching="column:clmn2"
                        value="#{bindings.DynamicVO.collectionModel}"
                        selectedRowKeys="#{bindings.DynamicVO.collectionModel.selectedRow}"
                        selectionListener="#{bindings.DynamicVO.collectionModel.makeCurrent}"
                        rowSelection="single" id="t1"
                        styleClass="AFStretchWidth">
 <af:forEach items="#{bindings.DynamicVOIterator.attributeDefs}"
    var="def" varStatus="vs">
   <af:column headerText="#{def.propertyMap.label}" sortable="true" 
     sortProperty="#{def.name}"
     id="clmn${vs.index}">
  <af:inputText value="#{row.bindings[def.name].inputValue}"
       maximumLength="#{row.bindings[def.name].hints[def.name].precision}"
       id="fld1"/>
   </af:column>
 </af:forEach>
</af:table>

Comments

Samuel Anderson said…
there is no ADF faces core component palette in Jdev 11g, as coponents are purely JSF components with AJax, These are entirely new components and need to be used as per the tutorials given By Oracle. I will advice to download Oracle's sample for 11g preview 3, it would give u a better idea.More info at this web site.

Popular posts from this blog

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…