PeteGashek / puzzlebazar

Automatically exported from code.google.com/p/puzzlebazar
0 stars 0 forks source link

Use GWT generators for proxys #71

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Right now, proxys are mostly made up of boilerplate, with only a few user-
driven decisions. It should be possible to use GWT generators and Java 
annotations to automatically write most of the boilerplate, making the use 
of proxy a very light-weight overhead on top of Presenters.

Here is are some examples:

In UserSettingsGeneralPresenter:

@ProviderMechanism(AsyncProvider<?>.class)
@NameToken(NameTokens.getUserSettingsGeneral())  // Is this valid code?
@TabInfo(
  requestEvent = UserSettingsTabPresenter.TYPE_RequestTabs,
  priority = 0,
  // Note: instead of the following we could just use tabName
  tabNameProvider = Translations.class,
  tabNameMethod = "tabGeneral" )
public interface MyProxy extends 
TabContentProxy<UserSettingsGeneralPresenter>, Place {}

In SplitMainPresenter:

public static final Type<RevealContentHandler<?>> 
    TYPE_RevealSideBarContent = new Type<RevealContentHandler<?>>();
public static final Type<RevealContentHandler<?>> 
    TYPE_RevealCenterContent = new Type<RevealContentHandler<?>>();

@ProviderMechanism(Provider<?>.class)
public interface MyProxy extends Proxy<SplitMainPresenter> {
  @RevealEventType( TYPE_RevealSideBarContent )
  public setSideBarContent();
  @RevealEventType( TYPE_RevealCenterContent )
  public setCenterContent();
}

In LinkColumnPresenter:

@ProviderMechanism(Provider<?>.class)
public interface MyProxy extends Proxy<LinkColumnPresenter> {
  @CustomEventType( RevealDefaultLinkColumnEvent.class );
  public reveal();
}

Original issue reported on code.google.com by philippe.beaudoin on 20 Mar 2010 at 6:12

GoogleCodeExporter commented 8 years ago
That would be awesome ! Great use of Annotation ! Seem pretty simple too. 

Original comment by goudreau...@gmail.com on 20 Mar 2010 at 7:22

GoogleCodeExporter commented 8 years ago
For the moment, I didn't do the fancier generators. For example, 
LinkColumnProxy is 
still a custom user-made class, this was added as Issue 83. 

Also, I need to implement generators for nested tab presenters (Issue 81).

Original comment by philippe.beaudoin on 22 Mar 2010 at 8:25