Uploaded image for project: 'Seam Faces'
  1. Seam Faces
  2. SEAMFACES-122

Find a way to use the @ViewConfig enums to provide type-safe navigation rules

    Details

      Description

      Option 1) instead of using a @ViewPattern annotation, instead pass it to the constructor of the enum, to be stored as a property of the enum.
      Problem: the application developer would have to implement the constructor

      Option 2) require the developer to implement an interfaces, that specifies a setViewId method for an enum value, programmatically set that viewId with what is in the @ViewPattern annotation

      Feel free to provide more implementation options in the comments!

        Gliffy Diagrams

          Activity

          Hide
          bleathem Brian Leathem added a comment -

          With this enum/@ViewPattern coupling, we could have @LoginViewId refernece another enum value, rather than a string

          Show
          bleathem Brian Leathem added a comment - With this enum/@ViewPattern coupling, we could have @LoginViewId refernece another enum value, rather than a string
          Hide
          lincolnthree Lincoln Baxter III added a comment -

          This would probably be simplest using a two-part strategy for navigation. The combination of a Utility class and a JSF NavigationHandler.

          For instance:

          @Inject
          private Navigator nav;

          public String myAction()
          {
             /*
              * Redirect to (HTTP GET) the specified view. (faces-redirect=true)
              */
             return nav.redirectTo(viewEnum);
           
             /*
              * Navigate (JSF) to the specified view.
              */
             return nav.navigateTo(viewEnum);
           
             /*
              * Return a NavigationBuilder, then navigate (JSF) to the specified view.
              */
             return nav.toView(viewEnum).navigate();
           
             /*
              * Return a NavigationBuilder, add a ?query=parameter, then redirect (HTTP GET) to the specified view.
              */
             return nav.toView(viewEnum).addParameter("p", value).redirect();
           
             /*
              * Return a NavigationBuilder, add a ?query=parameter, then navigate (JSF) to the specified view.
              */
             return nav.toView(viewEnum).addParameter("p", value).navigate();
          }

          This relies on the Navigator to serialize any navigation information into String form so that it may be consumed by a custom NavigationHandlerImpl provided by Seam Faces and registered in faces-config.xml.

          Show
          lincolnthree Lincoln Baxter III added a comment - This would probably be simplest using a two-part strategy for navigation. The combination of a Utility class and a JSF NavigationHandler. For instance: @Inject private Navigator nav; public String myAction() { /* * Redirect to (HTTP GET) the specified view. (faces-redirect=true) */ return nav.redirectTo(viewEnum);   /* * Navigate (JSF) to the specified view. */ return nav.navigateTo(viewEnum);   /* * Return a NavigationBuilder, then navigate (JSF) to the specified view. */ return nav.toView(viewEnum).navigate();   /* * Return a NavigationBuilder, add a ?query=parameter, then redirect (HTTP GET) to the specified view. */ return nav.toView(viewEnum).addParameter("p", value).redirect();   /* * Return a NavigationBuilder, add a ?query=parameter, then navigate (JSF) to the specified view. */ return nav.toView(viewEnum).addParameter("p", value).navigate(); } This relies on the Navigator to serialize any navigation information into String form so that it may be consumed by a custom NavigationHandlerImpl provided by Seam Faces and registered in faces-config.xml.
          Hide
          clerum Cody Lerum added a comment -

          also add support for a endConversation() and something like continueConversation() and includes the cid

          Show
          clerum Cody Lerum added a comment - also add support for a endConversation() and something like continueConversation() and includes the cid
          Hide
          lincolnthree Lincoln Baxter III added a comment -

          This should probably support two modes of interaction:

          1. Return a faces navigation string.
          2. Actually invoke NavigationHandler and perform the navigation (for use in other artifacts that do not already have hooks into Faces navigation)

          Show
          lincolnthree Lincoln Baxter III added a comment - This should probably support two modes of interaction: 1. Return a faces navigation string. 2. Actually invoke NavigationHandler and perform the navigation (for use in other artifacts that do not already have hooks into Faces navigation)
          Hide
          bleathem Brian Leathem added a comment -

          Let's do this iteratively, and first implement the String based navigation. The custom nav handler can be added as a separate issue.

          Show
          bleathem Brian Leathem added a comment - Let's do this iteratively, and first implement the String based navigation. The custom nav handler can be added as a separate issue.
          Hide
          bleathem Brian Leathem added a comment - - edited

          Note: Conversation propagation is being addressed in WELD-919 and CDI-135.
          If Seam Faces gets to it first, we may want to prototype this functionality in a custom navigation handler, but we should stick with the syntax agreed upon in the upstream issues.

          Show
          bleathem Brian Leathem added a comment - - edited Note: Conversation propagation is being addressed in WELD-919 and CDI-135 . If Seam Faces gets to it first, we may want to prototype this functionality in a custom navigation handler, but we should stick with the syntax agreed upon in the upstream issues.
          Hide
          bleathem Brian Leathem added a comment -

          This API should align with the "http redirect" proposal in SEAMFACES-196 and SEAMSERVLET-44.

          Perhaps the navigator element could encompass the proposed FacesManager functionality from SEAMFACES-196, and delegate "http redirects" to SEAMSERVLET-44.

          Show
          bleathem Brian Leathem added a comment - This API should align with the "http redirect" proposal in SEAMFACES-196 and SEAMSERVLET-44 . Perhaps the navigator element could encompass the proposed FacesManager functionality from SEAMFACES-196 , and delegate "http redirects" to SEAMSERVLET-44 .

            People

            • Assignee:
              Unassigned
              Reporter:
              bleathem Brian Leathem
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:

                Development