My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
MultipleViewsForOnePresenter  
Design of the multiview implementation
Updated Jul 7, 2011 by gal.dol...@gmail.com

This document is only a design, not yet implemented

Introduction

In some cases we need to customize some of the views for different group of users or different devices. This new feature will let you write a new ui.xml file while keeping the presenter intact.

Details

Presenter example

@GwtPresenter
@ViewProperties(prefix={"Mobile", "Tablet"}) 
public class Home extends HomePresenter {
}

Views:

Home.ui.xml
MobileHome.ui.xml
TabletHome.ui.xml

Validation

The apt validation of the presenter will be made agains all its views. In case of an error, the error message will specify with what view the error was found

TabletHome.ui.xml: The field 'tabe' is not declared in the view. Valid fields: style, table, header, dock, modeLabel

Use cases

The two use cases defined on the introduction require a really different implementation.

If you need to targeting a new device you will probable need an extra permutation

<define-property name="ui.xml.prefix" values="default, mobile, tablet" /> 
<set-property name="ui.xml.prefix" value="default">
   <none> 
      <when-property-is name="user.agent" value="safari" />
    </none>
</set-property>

For a better understanding read http://code.google.com/p/google-web-toolkit/wiki/ConditionalProperties

This way we are adding two permutations -> safari+tablet, safari+mobile.

Any ui.xml file with the "Tablet" or "Mobile" prefix will be used instead of the default for those permutations.

The "default" value is required.

The prefix should be specified lowercase on the gwt module, but it wont be case sensitive. i.e "tabletandroid" will match with -> TabletAndroidHome.ui.xml

if you are targeting a "different user" you may only need to create a new gwt module

This use case can also be solved with the first approach.

<extend-configuration-property name="ui.xml.prefix" value="manager" />

In this case the app will compile normally, but when a presenter have a view with the prefix "manager", it will be used instead of the default

Powered by Google Project Hosting