Tuesday 30 April 2013

How to Stretch an ADF Table to occupy maximum width

ADF Table can be stretched to occupy the maximum width available by using AFStretchWidth Style Class.
Table can be embedded inside PanelStretchLayout or PanelCollection component

For PanelStretchLayout component the Table must be embedded inside the center facet, and the Style Class of both the Table and Layout component must be set to AFStretchWidth.
        <af:panelStretchLayout id="psl1">
          <f:facet name="bottom"/>
          <f:facet name="center">
            <af:table inlineStyle="AFStretchWidth" ...>
               ....
           </af:table>
          </f:facet>
          <f:facet name="start"/>
          <f:facet name="end"/>
          <f:facet name="top"/>
        </af:panelStretchLayout>

instead of using AFStretchWidth, you can decide which column will get stretched using the attribute columnStretching for example:
columnStretching="last"

  
 <af:table ... columnStretching="columnId_that_you_want_to_stretch" ...>

Friday 19 April 2013

Problem with the taskflow invocation


If you face the following below error when rending the page, then the issue with the region with the task-flow:

java.lang.IllegalStateException: Attempt to validate an already invalid RegionSite

Solution is here:
Just set the following properties to the task-flow binding

go to bindings tab, select task-flow, then go to properties widow set
          activation: immediate,   Refresh: ifneeded

How to get Selected graph point details in ADF Graphs

To get the selected graph point information u need to set the click listener for the graph:

dvt:barGraph should have the clickListener
< dvt:barGraph id="Graph1"
value="#{bindings.View1.graphModel}"
subType="BAR_VERT_CLUST"
clickListener="#{MyBeab.clickAction}" ...>

In bean the clickListener should be implemented as follows:
 void processClick(ClickEvent event)
{
     ComponentHandle handle = event.getComponentHandle();
     if (handle instanceof DataComponentHandle)
     {
         DataComponentHandle dhandle = (DataComponentHandle)handle;
         // Get the value displayed in the series
         System.out.println("Value: " + dhandle.getValue(DataComponentHandle.UNFORMATTED_VALUE));
 
         // Get the series attributes
         Attributes [] seriesInfo = dhandle.getSeriesAttributes();
         if(seriesInfo != null)
         {
             for(Attributes attrs: seriesInfo)
             {
                 System.out.println("Series value: " + attrs.getValue(Attributes.LABEL_VALUE));
                 System.out.println("Series name: " + attrs.getValue(Attributes.LABEL_ATTRIBUTE));
                 System.out.println("Series value id: " + attrs.getValue(Attributes.ID_VALUE));
                 System.out.println("Series name id: " + attrs.getValue(Attributes.ID_ATTRIBUTE));
             }
         }
         // Get the group attributes
         Attributes [] groupInfo = dhandle.getGroupAttributes();
         if(groupInfo != null)
         {
             for(Attributes attrs: groupInfo)
             {
                 System.out.println("Group value: " + attrs.getValue(Attributes.LABEL_VALUE));
                 System.out.println("Group name: " + attrs.getValue(Attributes.LABEL_ATTRIBUTE)); 
             }
         }
     }
 }