[seam-issues] [JBoss JIRA] Commented: (SEAMFACES-122) Find a way to use the @ViewConfig enums to provide type-safe navigation rules

Lincoln Baxter III (JIRA) jira-events at lists.jboss.org
Wed Sep 7 12:51:26 EDT 2011


    [ https://issues.jboss.org/browse/SEAMFACES-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12626896#comment-12626896 ] 

Lincoln Baxter III commented on SEAMFACES-122:
----------------------------------------------

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

For instance:

{code}@Inject
private Navigator nav;{code}

{code}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();
}{code}

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.

> Find a way to use the @ViewConfig enums to provide type-safe navigation rules
> -----------------------------------------------------------------------------
>
>                 Key: SEAMFACES-122
>                 URL: https://issues.jboss.org/browse/SEAMFACES-122
>             Project: Seam Faces
>          Issue Type: Feature Request
>          Components: View Configuration
>            Reporter: Brian Leathem
>             Fix For: 3.1.0.Tracking
>
>
> 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!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list