net.customware.gwt.presenter.client
Class BasicPresenter<D extends Display>

java.lang.Object
  extended by net.customware.gwt.presenter.client.BasicPresenter<D>
All Implemented Interfaces:
Presenter
Direct Known Subclasses:
WidgetPresenter

public abstract class BasicPresenter<D extends Display>
extends java.lang.Object
implements Presenter


Field Summary
protected  D display
          The display for the presenter.
protected  EventBus eventBus
          The EventBus for the application.
 
Constructor Summary
BasicPresenter(D display, EventBus eventBus)
           
 
Method Summary
 void bind()
          Called then the presenter is initialised.
 D getDisplay()
          Returns the display for the presenter.
abstract  Place getPlace()
          The Place that represents this Presenter.
protected  PlaceRequest getPlaceRequest()
           
protected abstract  void onBind()
          This method is called when binding the presenter.
protected abstract  void onPlaceRequest(PlaceRequest request)
          This method is called when a PlaceRequestEvent occurs that matches with the value from getPlace().
protected abstract  void onUnbind()
          This method is called when unbinding the presenter.
protected  void registerHandler(com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
          Any HandlerRegistrations added will be removed when unbind() is called.
 void unbind()
          Called after the presenter and display have been finished with for the moment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.customware.gwt.presenter.client.Presenter
refreshDisplay, revealDisplay
 

Field Detail

display

protected final D extends Display display
The display for the presenter.


eventBus

protected final EventBus eventBus
The EventBus for the application.

Constructor Detail

BasicPresenter

public BasicPresenter(D display,
                      EventBus eventBus)
Method Detail

bind

public void bind()
Description copied from interface: Presenter
Called then the presenter is initialised. This is called before any other methods. Any event handlers and other setup should be done here rather than in the constructor.

Specified by:
bind in interface Presenter

registerHandler

protected void registerHandler(com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
Any HandlerRegistrations added will be removed when unbind() is called. This provides a handy way to track event handler registrations when binding and unbinding.

Parameters:
handlerRegistration - The registration.

unbind

public void unbind()
Description copied from interface: Presenter
Called after the presenter and display have been finished with for the moment.

Specified by:
unbind in interface Presenter

onBind

protected abstract void onBind()
This method is called when binding the presenter. Any additional bindings should be done here.


onUnbind

protected abstract void onUnbind()
This method is called when unbinding the presenter. Any handler registrations recorded with registerHandler(HandlerRegistration) will have already been removed at this point.


getDisplay

public D getDisplay()
Returns the display for the presenter.

Specified by:
getDisplay in interface Presenter
Returns:
The display.

getPlaceRequest

protected PlaceRequest getPlaceRequest()

getPlace

public abstract Place getPlace()
The Place that represents this Presenter.

Returns:
The presenter's place.

onPlaceRequest

protected abstract void onPlaceRequest(PlaceRequest request)
This method is called when a PlaceRequestEvent occurs that matches with the value from getPlace().

Parameters:
request - The request.


Copyright © 2009 customware.net. All Rights Reserved.