Tuesday, November 23, 2010

Bit #26 - Overriding getAttributeDef() to conditionally set an attribute property

You can override ViewObjectImpl's getAttributeDef() method to update an attribute setting, control hint or a custom property. getAttributeDef() is called by the framework each time the attribute's definition needs to be accessed, for example prior to opening an af:query search dialog. In such a case, this may be the ideal place to set a conditional queryable property for example. The argument that is passed to the method indicates the index of the attribute being accessed. You modify the attribute definition by calling super.getAttributeDef() to get the AttributeDef and then call any of its set...() methods. Here is an example:


   public AttributeDef getAttributeDef(int attribIndex) {
        // check for some specific attribute

        if (attribIndex == SOME_ATTRIBUTE_INDEX) {
                //get the attribute's definition
               AttributeDef def = super.getAttributeDef(attribIndex);

               // conditionally update some attribute value

               // if (someCondition) {


               return def;

        return super.getAttributeDef(attribIndex);


View Object Implementation Class

1 comment:

  1. your providing such a valuabe information about studying..and also have some good key points to every student.


Related Posts Plugin for WordPress, Blogger...