Client side code snipets

Posted by raghu.yadav on Oracle Blogs See other posts from Oracle Blogs or by raghu.yadav
Published on Wed, 26 May 2010 03:43:21 -0800 Indexed on 2010/05/26 12:03 UTC
Read the original article Hit count: 502

Filed under:
<af:document>
      <f:facet name="metaContainer">
      <af:group>
        <!--[CDATA[
            <script>
                function clientMethodCall(event) {                  
                    component = event.getSource();
                    AdfCustomEvent.queue(component, "customEvent",{payload:component.getSubmittedValue()}, true);                                
                    event.cancel();                   
                }      
          </script> ]]-->
      </af:group>
    </f:facet>
      <af:form>
        <af:panelformlayout>
          <f:facet name="footer">
          <af:inputtext label="Let me spy on you: Please enter your mail password">
            <af:clientlistener method="clientMethodCall" type="keyUp">
            <af:serverlistener type="customEvent" method="#{customBean.handleRequest}">
          </af:serverlistener>


bean code

    public void handleRequest(ClientEvent event){
       
        System.out.println("---"+event.getParameters().get("payload"));
       
    }


tree

<af:tree id="tree1" value="#{bindings.DepartmentsView11.treeModel}" var="node" selectionlistener="#{bindings.DepartmentsView11.treeModel.makeCurrent}" rowselection="single">
    <f:facet name="nodeStamp">
      <af:outputtext value="#{node}">
    </af:outputtext>
    <af:clientlistener method="expandNode" type="selection">
  </af:clientlistener>

</f:facet>
  <f:facet name="metaContainer">
        <af:group>
          <!--[CDATA[
            <script>
                function expandNode(event){
                    var _tree = event.getSource();
                    rwKeySet = event.getAddedSet();
                    var firstRowKey;
                    for(rowKey in rwKeySet){
                       firstRowKey  = rowKey;
                        // we are interested in the first hit, so break out here
                        break;
                    }
                    if (_tree.isPathExpanded(firstRowKey)){
                         _tree.setDisclosedRowKey(firstRowKey,false);
                    }
                    else{
                        _tree.setDisclosedRowKey(firstRowKey,true);
                    }
               }
        </script> ]]-->
        </af:group>
      </f:facet>
   </af:tree>
</af:clientlistener></af:inputtext></f:facet></af:panelformlayout></af:form></af:document>

bean code public void handleRequest(ClientEvent event){ System.out.println("---"+event.getParameters().get("payload")); } tree

© Oracle Blogs or respective owner