ITPub博客

首页 > 数据库 > Oracle > ADF & OAF : Add Attribute to View Object Progmatically

ADF & OAF : Add Attribute to View Object Progmatically

Oracle 作者:贾三灌汤包 时间:2014-04-03 14:30:29 0 删除 编辑

ADF & OAF : Add Attribute to View Object Progmatically

You can add transient attribute to view object progmatically at run time.
You can use this transient attribute to store any temporary data for every row in view object or create generic solution in your custom framework for general purpose.

ADF
in ?ADF you can use below code anywhere in ApplicationModuleImpl class
I will check existence of attribute XXAttr, If it is not exist I will add it to view object
 ViewObject vo = this.findViewObject("ViewObjectName");  
     if (vo != null) {  
       try {  
         String transientAttr = vo.findAttributeDef("XXAttr").toString();  
       } catch (Exception e) {  
         vo.addDynamicAttribute("XXAttr");  
       }  
     } 


OAF
Same like sample in ADF I will check existence of attribute XXAttr, If it is not exist I will add it to view object
pre.CICodeFormatter{ font-family:arial; font-size:12px; border:1px dashed #CCCCCC; width:99%; height:auto; overflow:auto; background:#f0f0f0; line-height:20px; padding:0px; color:#000000; text-align:left; } pre.CICodeFormatter code{ color:#000000; word-wrap:normal; }
 public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
        super.processRequest(pageContext, webBean);

        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        OAViewObject vo = (OAViewObject)am.findViewObject("ViewObjectName");

        if (vo != null) {
            try {
                String transientAttr = 
                    vo.findAttributeDef("XXAttr").toString();
            } catch (Exception e) {
                vo.addDynamicAttribute("XXAttr");
            }
        }
    } 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22816976/viewspace-1135407/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-11-03

  • 博文量
    128
  • 访问量
    223065