[weld-dev] [seam-dev] Replacing pages.xml

Stuart Douglas stuart at baileyroberts.com.au
Fri Feb 19 15:35:28 EST 2010


 find . | grep xhtml | wc
     392     392   21192

It's going to be a big enum... we would need to make sure that you could split it up.

The only real problem I have with this approach is that all the metadata that is availible is hard coded into the page class, which means the page class has to know about every module that wants to use page level metadata. Also, you can't really configure it via xml, which I am not too worried about but may alienate some users. 

Stuart

On 19/02/2010, at 4:40 PM, Gavin King wrote:

> You should even be able to make this work:
> 
>      @View(.....)
>      login {
>         @Inject Login loginBean;
>         public MyAppPage next(MyAppPage page, Object outcome) {
>            if ( loginBean.isLoggedIn() )
>               return main;
>            else
>               return login;
>         }
>      },
> 
> of course we would need a little infrastructure for injecting into enum values.
> 
> On Thu, Feb 18, 2010 at 11:37 PM, Gavin King <gavin.king at gmail.com> wrote:
>> Oops, this is a MUCH better way to write this code:
>> 
>> 
>>   public enum MyAppPage implements Page<MyAppPage> {
>> 
>>      @View(.....)
>>      login {
>>         public MyAppPage next(MyAppPage page, Object outcome) {
>>            if (Boolean.TRUE.equals(outcome))
>>               return main;
>>             else
>>               return login;
>>        }
>>      },
>> 
>>      @View(.....)
>>      main {
>>         public MyAppPage next(MyAppPage page, Object outcome) {
>>            return main;
>>         }
>>      },
>> 
>>      @View(.....)
>>      logout {
>>         public MyAppPage next(MyAppPage page, Object outcome) {
>>            return login;
>>         }
>>      };
>> 
>>   }
>> 
> 
> 
> 
> -- 
> Gavin King
> gavin.king at gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org




More information about the weld-dev mailing list