|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.Application
public abstract class Application
A class which handles much of the heavy lifting of starting up an application. The class handles the following:
URL_ARGS
SETTINGS_URL
field to the URL of the application
settings. By default this is simply "settings.properties", but it can
also be specified by a URL parameter named "settingsUrl".isWindowScrollingEnabled()
, which can be overridden.getUncaughtExceptionHandler()
, which can be overridden.getApplicationStartRequests()
which can be
overridden.startApplication()
, which should be overridden
Nested Class Summary | |
---|---|
static class |
Application.RequestMakerResponseHandlerPair
|
Field Summary | |
---|---|
protected String |
SETTINGS_URL
The URL of the settings file. |
protected ResultCallback<String> |
settingsResponseCallback
The ResultCallback for the settings request. |
protected static Map<String,String> |
URL_ARGS
The arguments passed to us via the URL. |
Constructor Summary | |
---|---|
Application()
|
Method Summary | |
---|---|
protected RequestMaker<String> |
createSettingsRequestMaker()
Creates the request maker for the settings file. |
protected List<Application.RequestMakerResponseHandlerPair> |
getApplicationStartRequests()
Returns the list of requests that need to be made for the application to start and their handlers. |
protected String |
getSettingsUrl()
Returns the URL of the settings file. |
protected GWT.UncaughtExceptionHandler |
getUncaughtExceptionHandler()
Returns the uncaught exception handler for the application. |
protected boolean |
isWindowScrollingEnabled()
Returns whether window scrolling should be enabled for the application. |
protected void |
onErrorMakingRequest(String url,
String errorMessage)
Invoked when making one of the requests required to start the application fails (that is, RequestBuilder.sendRequest(String, RequestCallback) threw a
RequestException ). |
protected void |
onErrorRetrievingSettings(String settingsUrl,
String errorMessage)
This method is called when an error occurs while retrieving the application settings. |
protected void |
onInvalidSettings(String errorMessage)
Invoked when the settings are invalid. |
void |
onModuleLoad()
The entry point method. |
protected abstract void |
onSettingsReceived(String settingsText)
Invoked when the settings are received. |
protected void |
showError(String errorMessage)
Displays the specified error message to the user. |
protected abstract void |
startApplication()
Starts the application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Map<String,String> URL_ARGS
protected final String SETTINGS_URL
protected final ResultCallback<String> settingsResponseCallback
ResultCallback
for the settings request.
Constructor Detail |
---|
public Application()
Method Detail |
---|
public void onModuleLoad()
onModuleLoad
in interface EntryPoint
protected String getSettingsUrl()
protected List<Application.RequestMakerResponseHandlerPair> getApplicationStartRequests()
(createSettingsRequestMaker()
,
settingsResponseCallback
)
.
If your application needs to retrieve more information in order to start,
you should override this method and return additional request builders
(and corresponding callbacks).
protected RequestMaker<String> createSettingsRequestMaker()
protected boolean isWindowScrollingEnabled()
onModuleLoad()
. The default
implementation returns false.
protected GWT.UncaughtExceptionHandler getUncaughtExceptionHandler()
onModuleLoad()
. The default
implementation returns an exception handler which shows an (unlocalized)
alert describing the exception that occurred.
protected void onErrorMakingRequest(String url, String errorMessage)
RequestBuilder.sendRequest(String, RequestCallback)
threw a
RequestException
). The default implementation displays an
(unlocalized) alert describing the error that occurred.
protected void onErrorRetrievingSettings(String settingsUrl, String errorMessage)
protected abstract void onSettingsReceived(String settingsText) throws ParseException
startApplication()
is
invoked (where they will be used).
ParseException
protected void onInvalidSettings(String errorMessage)
protected void showError(String errorMessage)
protected abstract void startApplication()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |