Dyanmically setting ADF Table height in ADF

Requirment- Setting up the height of table dynamically by no of row.

We have AutoHeightRows property for ADF Table component, this will allow to shrink rendered table height, if number of records will be less comparing to defined by AutoHeightRows. and if no of row will be more than what we defined than it will row all the rows.You also need to make one of the property
to immediate i.e setContenttype= immediate

See the below example

You can also set AutoHeightRows to equal to fetchSize of the table.

Navigating from calendar activity by clicking in Oracle ADF – Techartifact

af:calendar component in ADF is widely used.It is same as Google calendar we used. In calendar we are having different activities .We are having different calendar facet inside the calendar component i. e activitydetail, activityDelete, activityHover, activityContextMenu, create , contextMenu.

If you look down the property of calendar component inside property pallet. you will not find action or actionListener property instead of you will get
calendarActivity, calendarListener etc.

Now my requirment is to clicking on the calendar component , it should navigate to diffrent page in same taskflow. How to do that.Little tricky
According to calendar component we can have this navigation easily by the child component or from the calendar facet. We can have a show a popup
in the activityHover facet. In the popup window we can have the button ,inside the button action property we can define the control flow case or some string which we defined in the taskflow diagram for navigation. If you do like this when you hover over the calendar activity a pop up window will come and you will get button with some other detail , when you click the button you will be navigated to new page. look easy…….

But my requirment is navigate after clicking the acitivity . Then i made that button visible property to false .I created a managed bean and inside the activityListener of calendar component i wrote a method and invoke the button action programmatic and queue the action event as i described in my old post

 
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, "buttonId");
        }
        
        
        // UIViewRoot root = facesContext.getViewRoot();
        //cb1 is the fully qualified name of the button
        RichCommandButton button = (RichCommandButton)component;
        ActionEvent actionEvent = new ActionEvent(button);
        actionEvent.queue();


Queue an action event or invoking the button action in programmatic way in JSF /ADF – Techartifact

Sometimes our requirement is to invoke the button’s action in programmatic way without needing a user to click a button,. For example we want navigation happening automatically without clicking the button by user i.e implementing navigation in programmatic way using Java.We can queue an action event . In this case the developer may drag and drop a button in the page and binds its action property to some static action outcome or to a method that returns a String, and set Visible property for the button to false. At some point the developer can invoke this button’s action by using this code.

 

FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();   
//cb1 is the fully qualified name of the button
RichCommandButton button = (RichCommandButton) root.findComponent(“cb1″); // cb1 will be id of invisible button
ActionEvent actionEvent = new ActionEvent(button);
actionEvent.queue();        // we are queuing the all action programmaticly

an another code snippet which will work in this scenario

 

        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, "button_id");  // button_id will be id of invisible button
        }
        
        RichCommandButton button = (RichCommandButton)component;
        ActionEvent actionEvent = new ActionEvent(button);
        actionEvent.queue();   // we are queuing the all action programmaticly