Inserting blank row in table in ADF

Hi All,

Requirment – To create 5 or 10 blank row in adf table.User can enter value in all row and able to perform bulk save or other action.How to do that.

Well for that you need to write a custom method in AMImpl.java as below..

 
    public void insertDefaultRows(){
          ViewObjectImpl ioOrderLines = this.getViewObject1();
          ioOrderLines.executeEmptyRowSet();
          int noOfRows=5;
          oracle.jbo.server.ViewRowImpl emptyRow;
          for (int i=0; i < noOfRows;i++){
              emptyRow = (oracle.jbo.server.ViewRowImpl)ioOrderLines.createRow();
              emptyRow.setNewRowState(oracle.jbo.Row.STATUS_INITIALIZED);
              ioOrderLines.insertRow(emptyRow);
          }
      } 

After add to client interface of application module so that it can visible in data control.Go to application module –>go to java tab–>go to client
interface–>select your method from left to right.Open data control you will able to see your method.

Now you can call your method in two ways.

1. call in page binding using invoke action- Right click the jspx or jsff and go to page defintion .go to executable –insert inside the executable
–>invoke action. Provide the ID and select your method from drop down.Make refresh condition as always.

2. Open the jsff .drag drop the custom method from data control and paste as button on the page.When you click the button it will show the blank row.

happy coding with Techartifact.

Setting the value in Different scope in ADF in programmatic way

Sometime in ADF application we want to set the value in different scope programmatic .How to do that.
Use below code to do that.You can create a variable in any scope and put value in it

 
  ADFContext adfCtx = ADFContext.getCurrent();
       Map appScope = adfCtx.getApplicationScope();
       appScope.put("vinay", "true");

Similarly you can get the value of any variable stored in any variable

 
  ADFContext adfCtx = ADFContext.getCurrent();
       Map appScope = adfCtx.getApplicationScope();
    String appScopeValue=  (String)appScope.get("vinay");

getting binding of component from one managed bean to another

Today i got one of the requirment to get the binding of some component which is binding in another managed bean.
This is something tedious requirment i have.. Well in JSF 2.0 you can get very easily by using below code

 
        FacesContext context = FacesContext.getCurrentInstance();
        BEAN bean = (RegionNavigationListener)context.getApplication().evaluateExpressionGet(context, "#{BEAN}", BEAN.class);


You can write above code as below as well

FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ExpressionFactory expressionFactory = application.getExpressionFactory();
ELContext context = fctx.getELContext();
ValueExpression createValueExpression = expressionFactory.createValueExpression(context, "#{pageFlowScope.PageFlowScopeBean}",PageFlowScopeClass.class);
PageFlowScopeClass pageFlowScopeInstance =(PageFlowScopeClass) createValueExpression.getValue(context);