12 Replies Latest reply on Nov 4, 2008 12:49 PM by ilya_shaikovsky

    Launching a dialog using rich faces.

    java4me

      Hi

      I am creating an application using rich faces. I have used ADF and WebGalileo for applications previously.

      I have a functionality where i want to launch a dialog/popup on click of a button. I will be passing some information from the parent page.
      That popup will contain a form having some independent functionality.
      I want to achieve this from server side/java control rather than javascript. Something similar to a functionality provided by ADFContext.launchDialog() in ADF.

      Is there any way that this can be done in rich faces?
      Also is there any class providing Context in rich faces.

      Any help shall be highly appreciated.

        • 1. Re: Launching a dialog using rich faces.
          nbelaevski

          Hi,

          There's no such context. You can:

          1. Set showWhenRendered="true" in modal panel and re-render it
          2. Use the following script to show modal panel. Render it when necessary:

          <rich:modalPanel autosized="true" id="mp"><h:outputText value="text" /></rich:modalPanel>
          
           <script>
           <h:outputText value="#{rich:component('mp')}.show();" />
           </script>
          


          • 2. Re: Launching a dialog using rich faces.
            java4me

            Thanks for the reply.

            The solution mentioned by you indicates that the content that has to be shown in the popup needs to be present in the main jsp page. This way it will be predecided(hard coded) what will be shown on the click of the button.

            If i want to show a different popup and/or not show a popup on the click of same button depending on the selection of a combo box. The combo box and popup will work together. User shall select something and then click a Button.
            Will it be possible to open the modal popup from the ActionListner of the button.

            • 3. Re: Launching a dialog using rich faces.
              ahoehma

              Trinidad contains a dialogframework - richfaces should have a similiar feature.

              http://myfaces.apache.org/trinidad/devguide/dialogs.html

              • 4. Re: Launching a dialog using rich faces.
                ilya_shaikovsky

                ahoehma, just check a4j:include and rich:modal panel components, i think it both could solve such tasks.

                java4me, you could include some content to modal panel with EL binding dinamically and update the binding to include before showing modal

                • 5. Re: Launching a dialog using rich faces.
                  java4me

                  Thanks
                  ahoehma
                  I have integrated myfaces and richfaces for the dialog functionality. This is working but other rich faces components(tables etc) need to be tested.

                  ilya_shaikovsky
                  The content of modalPanel gets loaded or decided at the load of main screen. After this it just gets rendered at client side by click of a button . Will it be possible to change the contents at the time of rendering of the modal panel?


                  • 6. Re: Launching a dialog using rich faces.
                    ahoehma

                    java4me, you can put your dialogs inside a a4j:outputPanel and use ajaxRendered=true ... or trigger the refresh with reRender somewhere, e.g. from a commandButton (reRender="dialogContainerId").

                    or more dynamic ... use a4j:include inside your dialogs ... so the content will be loaded via ajax (i guess) :)

                    regards
                    andreas

                    • 7. Re: Launching a dialog using rich faces.
                      ahoehma

                       

                      "ilya_shaikovsky" wrote:
                      ahoehma, just check a4j:include and rich:modal panel components, i think it both could solve such tasks.


                      thats right. but in richfaces i'm missing a feature "starting dialogs from javacode", or "show a dialog as result of a action via navigation-rules" etc.

                      it would be nice to use trinidad's dialogframework with richfaces-modalpanel.

                      • 8. Re: Launching a dialog using rich faces.
                        nbelaevski

                        I've submitted RFC: https://jira.jboss.org/jira/browse/RF-4849

                        You can add it to wiki and vote for it: http://www.jboss.org/community/docs/DOC-11862

                        • 9. Re: Launching a dialog using rich faces.
                          ilya_shaikovsky

                           

                          but in richfaces i'm missing a feature "starting dialogs from javacode", or "show a dialog as result of a action via navigation-rules" etc.


                          Yes this not works just out-of-the-box. But it really not complex to be implemented using EL bindings for include viewId and playing with showWhenRendered attribute of modal panel.

                          • 10. Re: Launching a dialog using rich faces.
                            java4me

                            Thanks to all of you.
                            Right now i am going ahead with trinidad and rich faces combined components to get the dialog functionality. I hope it doesnot give any trouble to rich faces scrollable table and other key rich faces components.

                            I had also tried the include and modal panel component for this but the results are not suiting the requirements of the application.

                            I shall give a shot ,later, to the leads provided by ilya_shaikovsky and share the results.

                            And yes we require the LaunchDialog in rich faces also

                            • 11. Re: Launching a dialog using rich faces.
                              java4me

                              Thanks to all of you.
                              Right now i am going ahead with trinidad and rich faces combined components to get the dialog functionality. I hope it doesnot give any trouble to rich faces scrollable table and other key rich faces components.

                              I had also tried the include and modal panel component for this but the results are not suiting the requirements of the application.

                              I shall give a shot ,later, to the leads provided by ilya_shaikovsky and share the results.

                              And yes we require the LaunchDialog in rich faces also

                              • 12. Re: Launching a dialog using rich faces.
                                ilya_shaikovsky

                                if you'll able to describe your case carefully in details and give me the code you trying - I'll try to help you to modify it as you need.