P
- The Presenter's type.Proxy_
- Type of the associated Proxy
.public class ProxyPlaceAbstract<P extends Presenter<?,?>,Proxy_ extends Proxy<P>> extends Object implements ProxyPlace<P>, HasHandlerContainer
Proxy
that is also a Place
.
You can usually inherit from the simpler form ProxyPlace
.
Constructor and Description |
---|
ProxyPlaceAbstract()
Creates a
ProxyPlaceAbstract . |
Modifier and Type | Method and Description |
---|---|
protected <H> void |
addRegisteredHandler(GwtEvent.Type<H> type,
H handler)
Register an event to be automatically removed when this proxy will be released.
|
protected void |
bind(PlaceManager placeManager,
EventBus eventBus)
Injects the various resources and performs other bindings.
|
boolean |
canReveal()
Checks if the associated presenter can be revealed.
|
boolean |
equals(Object o)
Places are equal if their name token matches.
|
void |
fireEvent(GwtEvent<?> event) |
EventBus |
getEventBus()
Makes it possible to access the
EventBus object associated with
that proxy. |
HandlerContainer |
getHandlerContainer() |
String |
getNameToken()
The name token is the first part of the history token, before the
parameters.
|
protected Place |
getPlace() |
protected PlaceManager |
getPlaceManager() |
protected void |
getPlaceTitle(GetPlaceTitleEvent event)
Obtains the title for this place and invoke the passed handler when the
title is available.
|
void |
getPresenter(NotifyingAsyncCallback<P> callback)
Get the associated
Presenter . |
protected Proxy_ |
getProxy() |
void |
getRawPresenter(NotifyingAsyncCallback<Presenter<?,?>> callback)
Get the associated
Presenter . |
int |
hashCode() |
void |
manualReveal(Presenter<?,?> presenter)
Manually reveals a presenter.
|
void |
manualRevealFailed()
Cancels manually revealing a presenter.
|
boolean |
matchesRequest(PlaceRequest request)
Makes sure the method matches the passed request.
|
protected void |
setPlace(Place place) |
protected void |
setPlaceManager(PlaceManager placeManager) |
protected void |
setProxy(Proxy_ proxy) |
String |
toString() |
public ProxyPlaceAbstract()
ProxyPlaceAbstract
. That is, the Proxy
of a
Presenter
attached to a Place
. This presenter can be
invoked by setting a history token that matches its name token in the URL
bar.public boolean canReveal()
Place
true
,
but subclasses should override this and check to make sure the current user
has the privileges to see the place. Make sure the places you request in
PlaceManager.revealDefaultPlace()
and
PlaceManager.revealErrorPlace(String)
can reveal themselves,
otherwise your application could get into an infinite loop.public final boolean equals(Object o)
Place
public void fireEvent(GwtEvent<?> event)
fireEvent
in interface HasHandlers
public final EventBus getEventBus()
Proxy
EventBus
object associated with
that proxy.getEventBus
in interface Proxy<P extends Presenter<?,?>>
EventBus
associated with that proxy.public String getNameToken()
Place
getNameToken
in interface Place
public void getPresenter(NotifyingAsyncCallback<P> callback)
Proxy
Presenter
. The presenter can only be obtained in
an asynchronous manner to support code splitting when needed. To access the
presenter, pass a callback.getPresenter
in interface Proxy<P extends Presenter<?,?>>
callback
- The callback in which the Presenter
will be passed
as a parameter.public void getRawPresenter(NotifyingAsyncCallback<Presenter<?,?>> callback)
ProxyRaw
Presenter
. The presenter can only be obtained in
an asynchronous manner to support code splitting when needed. To access the
presenter, pass a callback.
The difference between this method and
Proxy.getPresenter(com.gwtplatform.mvp.client.proxy.NotifyingAsyncCallback<P>)
is that the latter one gets the specific parameterised Presenter
type.getRawPresenter
in interface ProxyRaw
callback
- The callback in which the Presenter
will be passed
as a parameter.public final int hashCode()
public boolean matchesRequest(PlaceRequest request)
Place
matchesRequest
in interface Place
request
- The request to check.true
if the ID matches this place's name.public HandlerContainer getHandlerContainer()
getHandlerContainer
in interface HasHandlerContainer
public final String toString()
protected Place getPlace()
protected void setPlace(Place place)
protected PlaceManager getPlaceManager()
protected void setPlaceManager(PlaceManager placeManager)
protected Proxy_ getProxy()
protected void setProxy(Proxy_ proxy)
@Inject protected void bind(PlaceManager placeManager, EventBus eventBus)
placeManager
- The PlaceManager
.eventBus
- The EventBus
.protected void getPlaceTitle(GetPlaceTitleEvent event)
null
, but override this method to provide your own
title.event
- The GetPlaceTitleEvent
to invoke once the title is
available.protected <H> void addRegisteredHandler(GwtEvent.Type<H> type, H handler)
H
- The handler typetype
- The event typehandler
- The handler to register.public void manualReveal(Presenter<?,?> presenter)
ProxyPlace
Presenter.useManualReveal()
. This method should be
called following one or more asynchronous server calls in
Presenter.prepareFromRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest)
.
You should manually reveal your presenter exactly once, when all the data needed to use it is available.
If you failed to fetch the data or cannot reveal the presenter you must call
ProxyPlace.manualRevealFailed()
otherwise navigation will be blocked and your application
will appear to be frozen.
Also consider using ManualRevealCallback
, which will automatically call
ProxyPlace.manualReveal(Presenter)
upon success and ProxyPlace.manualRevealFailed()
upon
failure.manualReveal
in interface ProxyPlace<P extends Presenter<?,?>>
presenter
- The presenter that will be delayed revealed.Presenter.useManualReveal()
,
ProxyPlace.manualRevealFailed()
public void manualRevealFailed()
ProxyPlace
Presenter.useManualReveal()
. For more details see
ProxyPlace.manualReveal(Presenter)
.manualRevealFailed
in interface ProxyPlace<P extends Presenter<?,?>>
ProxyPlace.manualReveal(Presenter)
Copyright © 2010-2014 ArcBees. All Rights Reserved.