net.customware.gwt.presenter.client.widget
Class WidgetContainerPresenter<T extends WidgetContainerDisplay>

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

public abstract class WidgetContainerPresenter<T extends WidgetContainerDisplay>
extends WidgetPresenter<T>

This class provides support for widgets that contain other widgets. It will listen for PresenterRevealedEvents and reveal itself if the source was a direct child of this presenter.

Author:
David Peterson

Field Summary
 
Fields inherited from class net.customware.gwt.presenter.client.BasicPresenter
display, eventBus
 
Constructor Summary
WidgetContainerPresenter(T display, EventBus eventBus, WidgetPresenter<?>... presenters)
           
 
Method Summary
protected  boolean addPresenter(WidgetPresenter<?> presenter)
          Adds the presenter, if the current presenter is unbound.
protected  boolean addPresenters(WidgetPresenter<?>... presenters)
          Adds the list of presenters, if they are unbound.
protected  WidgetPresenter<?> getCurrentPresenter()
           
protected  int indexOf(WidgetPresenter<?> presenter)
           
protected  void onBind()
          This method is called when binding the presenter.
protected  void onRevealDisplay()
          Called before firing a PresenterRevealedEvent.
protected  void onUnbind()
          This method is called when unbinding the presenter.
protected  boolean setCurrentPresenter(WidgetPresenter<?> presenter)
          Sets the specified presenter to the be currently displaying presenter.
 
Methods inherited from class net.customware.gwt.presenter.client.BasicPresenter
bind, firePresenterChangedEvent, firePresenterRevealedEvent, getDisplay, isBound, registerHandler, revealDisplay, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetContainerPresenter

public WidgetContainerPresenter(T display,
                                EventBus eventBus,
                                WidgetPresenter<?>... presenters)
Method Detail

addPresenters

protected boolean addPresenters(WidgetPresenter<?>... presenters)
Adds the list of presenters, if they are unbound. Bound presenters will simply be ignored, and false will be returned if any were ignored.

Parameters:
presenters - The list of presenters.
Returns:
false if any of the presenters were bound, and therefor not added.

addPresenter

protected boolean addPresenter(WidgetPresenter<?> presenter)
Adds the presenter, if the current presenter is unbound.

Parameters:
presenter - The presenter to add.
Returns:
If added, returns true.

onBind

protected void onBind()
Description copied from class: BasicPresenter
This method is called when binding the presenter. Any additional bindings should be done here.

Specified by:
onBind in class BasicPresenter<T extends WidgetContainerDisplay>

onUnbind

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

Specified by:
onUnbind in class BasicPresenter<T extends WidgetContainerDisplay>

getCurrentPresenter

protected WidgetPresenter<?> getCurrentPresenter()
Returns:
The currently displaying presenter.

setCurrentPresenter

protected boolean setCurrentPresenter(WidgetPresenter<?> presenter)
Sets the specified presenter to the be currently displaying presenter. If the presenter has not been added (addPresenter(WidgetPresenter)), it will not be set as the current presenter.

Parameters:
presenter - The presenter.
Returns:
true if the presenter was successfully set as the current presenter.

indexOf

protected int indexOf(WidgetPresenter<?> presenter)

onRevealDisplay

protected void onRevealDisplay()
Description copied from class: BasicPresenter
Called before firing a PresenterRevealedEvent.

Specified by:
onRevealDisplay in class BasicPresenter<T extends WidgetContainerDisplay>


Copyright © 2010 customware.net. All Rights Reserved.