8 Replies Latest reply: Apr 29, 2013 7:05 AM by Timo Hahn RSS

    How to set field's render property on a panelSplitter facet?

    BAO.SZ
      Hi,experts,
      In jdev 11.1.2.3,
      How to set field's render property on a panelSplitter facet?
      --if the panelSplitter is collapsed then render some fields in the second facet. otherwise do not render these fields.

      It's not a easy work for me to set the EL expression.
      Thanks.
        • 1. Re: How to set field's render property on a panelSplitter facet?
          vinaykumar2
          bind that panelspillter into managedbean

          then write like

          #{pageFlowScope.myManagedBean.panelSplitter.collapsed} = if it is collasped then it will give true
          • 2. Re: How to set field's render property on a panelSplitter facet?
            BAO.SZ
            Hi,Vinay,
            Thanks for your posts.

            But how to bind panelspillter into managedbean?
            In the Bindings and Executables, there is no panelsplitter.

            bao
            • 3. Re: How to set field's render property on a panelSplitter facet?
              BAO.SZ
              Hi,Vinay
              I'm not familar with beans, and I tried like this:
              --In the af:panelSplitter property set Advanced->Binding :
              Managed Bean :renderRemark,
              Property: panelsplitter;
              --and in the field(#{row.bindings.Remark.inputValue}) which will be/not be rendered, set Rendered property to:
              #{pageFlowScope.renderRemark.panelsplitter.collapsed}

              but it does not work.
              How to fix it?
              Thanks
              • 4. Re: How to set field's render property on a panelSplitter facet?
                Timo Hahn
                You can use the EL "#{pageFlowScope.myManagedBean.panelSplitter.collapsed}" and set it to the visible property of the fields. Don't use the rendered property as you can't show them again without a full page refresh. The visible property hides or unhides the field. You only need to add the id of the panelSplitter to the partialTrigger property of the field to toggle its visibility.

                Timo
                • 5. Re: How to set field's render property on a panelSplitter facet?
                  BAO.SZ
                  Thank you Timo!
                  I have retried:

                  1. edit panelSplitter's Binding property to:#{pageFlowScope.renderRemark.panelsplitter}
                  --renderRemark is the Managed Bean name newly created and named;
                  (*I donot know what's the naming convention for the Managed bean?*)
                  --panelsplitter is the Property name for the panelSplitter to bind to above Managed Bean;
                  (*I donot know what is the meanning or function for this property? Is it a mapping of the panelSplitter's id after binding in the Managed bean?*)
                  --#{pageFlowScope.renderRemark.panelsplitter} is the result after edit Binding property;
                  (Is the EL caps sensitive? "renderRemark.panelsplitter" is different from "renderremark.panelSplitter"?)

                  2. set partialTrigger property of fields(here is remark) to toggle visibility to the id of the panelSplitter;

                  3. set visible property of fields(here is remark) to toggle visibility to a EL: #{pageFlowScope.renderRemark.panelsplitter.collapsed} ,
                  --The panelsplitter.collapsed is selected from the Expression Builder.
                  (otherwise I donnot know how to composer/build this EL.)

                  and restart the program.
                  but it didnot work.
                  Can anyone give furthur help?
                  Thanks.
                  • 6. Re: How to set field's render property on a panelSplitter facet?
                    Timo Hahn
                    OK, just made a small test case. It turns out that the difficulty is to automatically update the fields when the splitter discloses. For this you have to add a client/server listener pair. This sends the disclose event to the bean to allow to update the fields.
                    Page code:
                    <?xml version='1.0' encoding='UTF-8'?>
                    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
                              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
                      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
                      <f:view>
                        <af:document id="d1">
                          <af:resource type="javascript">
                            function disclosePanelSplitter( event) {
                                var inputComp = event.getSource();
                                AdfCustomEvent.queue(inputComp, "myDiscloseEvent",
                                {}, true); 
                            }
                          </af:resource>
                          <af:form id="f1">
                            <af:panelStretchLayout topHeight="50px" id="psl1">
                              <f:facet name="top">
                                <af:panelGroupLayout layout="scroll" xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="pgl1">
                                  <af:outputText value="PanelSplitter Test" id="ot1" inlineStyle="font-size:large;"/>
                                </af:panelGroupLayout>
                              </f:facet>
                              <f:facet name="center">
                                <af:panelSplitter id="ps1" splitterPosition="257" binding="#{PanelSplitterBean.panelSplitter}">
                                  <f:facet name="first">
                                    <af:panelStretchLayout id="psl3">
                                      <f:facet name="bottom"/>
                                      <f:facet name="center">
                                        <af:outputText value="first facet" id="ot2"/>
                                      </f:facet>
                                      <f:facet name="start"/>
                                      <f:facet name="end"/>
                                      <f:facet name="top"/>
                                    </af:panelStretchLayout>
                                  </f:facet>
                                  <f:facet name="second">
                                    <af:panelStretchLayout id="psl2">
                                      <f:facet name="bottom"/>
                                      <f:facet name="center">
                                        <af:panelGroupLayout layout="scroll" xmlns:af="http://xmlns.oracle.com/adf/faces/rich" id="pgl2">
                                          <af:outputText value="second facet" id="ot3"/>
                                          <af:outputText value="only visible is splitter collapsed" id="ot4" visible="#{requestScope.PanelSplitterBean.panelSplitter.collapsed}"
                                                         partialTriggers="ps1"/>
                                          <af:inputText label="Label 1" id="it1"/>
                                          <af:inputText label="Only allow enter if splitter collapsed" id="it2" visible="#{requestScope.PanelSplitterBean.panelSplitter.collapsed}"
                                                        partialTriggers="ps1"/>
                                          <af:commandButton text="commandButton 1" id="cb1"/>
                                        </af:panelGroupLayout>
                                      </f:facet>
                                      <f:facet name="start"/>
                                      <f:facet name="end"/>
                                      <f:facet name="top"/>
                                    </af:panelStretchLayout>
                                  </f:facet>
                                  <af:clientListener method="disclosePanelSplitter" type="propertyChange"/>
                                </af:panelSplitter>
                                <!-- id="af_one_column_header_stretched"  -->
                              </f:facet>
                            </af:panelStretchLayout>
                          </af:form>
                        </af:document>
                      </f:view>
                    </jsp:root>
                    and the corresponding bean in request scope
                    package de.hahn.xyzxyz.view.panelsplitter;
                    
                    import oracle.adf.view.rich.component.rich.layout.RichPanelSplitter;
                    import oracle.adf.view.rich.context.AdfFacesContext;
                    import oracle.adf.view.rich.render.ClientEvent;
                    
                    public class PanelSplitterBean {
                        private RichPanelSplitter panelSplitter;
                    
                        public PanelSplitterBean() {
                        }
                    
                        public void setPanelSplitter(RichPanelSplitter panelSplitter) {
                            this.panelSplitter = panelSplitter;
                        }
                    
                        public RichPanelSplitter getPanelSplitter() {
                            return panelSplitter;
                        }
                    
                        public void doCustomEvent(ClientEvent event)
                        {
                            AdfFacesContext.getCurrentInstance().addPartialTarget(panelSplitter);
                        }
                    
                    }
                    Timo
                    • 7. Re: How to set field's render property on a panelSplitter facet?
                      BAO.SZ
                      Hi, Timo
                      It works now after tried the code you gave. Thank you very much!
                      and now I begin to move on even on JS code.

                      Also I have found it works even after deleted the following lines in the managed bean java code:
                      public void doCustomEvent(ClientEvent event)
                      {
                      AdfFacesContext.getCurrentInstance().addPartialTarget(panelSplitter);
                      }

                      -----
                      (Does it mean we neednot write code in java for this field display toggle function? )

                      I have to say I donot understand these JS and JAVA codes you post. Since i have no experience on JAVA/JS and i am learning now.
                      I read the stuff in this link for some time this afternoon, but got not enough idea yet:
                      18.4 Using a Managed Bean in a Fusion Web Application
                      http://docs.oracle.com/cd/E15051_01/web.1111/b31974/web_getstarted.htm#CACCFIII

                      Can you give some sugestion on this topic?
                      Thanks again!

                      Edited by: BAO.SZ on 2013-4-29 上午4:12
                      • 8. Re: How to set field's render property on a panelSplitter facet?
                        Timo Hahn
                        >
                        public void doCustomEvent(ClientEvent event)
                        {
                        AdfFacesContext.getCurrentInstance().addPartialTarget(panelSplitter);
                        }

                        (Does it mean we neednot write code in java for this field display toggle function? )
                        >
                        No, is you remove the whole bean you don't have access to the expression language "#{requestScope.PanelSplitterBean.panelSplitter.collapsed}" which you need to trigger decide if the button is visible or not.

                        The document you read is OK. However to understand it fully you might want to read it from the beginning as it gives you some inside in the framework. There are some good videos out
                        http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html

                        Timo