|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.Application
eu.livotov.tpt.TPTApplication
public abstract class TPTApplication
This is the abstract class to be used instead of regular Vaadin Application in order to get some extended features, that TPT provides. Use this class absolutely the same way as you use plain Application class, the only difference is that instead of init() method you need to use applicationInit(). However, you may still init(), just do not forget to put super.init() at the beginning (as the first line of your overridden method body).
Nested Class Summary | |
---|---|
private class |
TPTApplication.TPTRunnable
|
Nested classes/interfaces inherited from class com.vaadin.Application |
---|
com.vaadin.Application.ApplicationError, com.vaadin.Application.CustomizedSystemMessages, com.vaadin.Application.SystemMessages, com.vaadin.Application.UserChangeEvent, com.vaadin.Application.UserChangeListener, com.vaadin.Application.WindowAttachEvent, com.vaadin.Application.WindowAttachListener, com.vaadin.Application.WindowDetachEvent, com.vaadin.Application.WindowDetachListener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.URIHandler |
---|
com.vaadin.terminal.URIHandler.ErrorEvent |
Field Summary | |
---|---|
(package private) static java.lang.ThreadLocal<TPTApplication> |
currentApplication
|
private static java.util.concurrent.atomic.AtomicBoolean |
firstInstanceCreated
|
private Dictionary |
internationalizationDictionary
|
Constructor Summary | |
---|---|
TPTApplication()
Default application constructor. |
Method Summary | |
---|---|
abstract void |
applicationInit()
This method must be implemented by a final application, exactly the same way as init() method had to be implemented in a regular Vaadin Application. |
private void |
cleanupPreviousResources()
This method cleanups resources from previous app instance. |
void |
close()
Overrides ITMill Toolkit close() method to add some resources cleanup (in the future), related to TPT. |
abstract void |
firstApplicationStartup()
Another application initialization callback. |
static TPTApplication |
getCurrentApplication()
Provides an instance to the current application. |
void |
init()
Standard ITMill Toolkit abstract init() method is implemented here for automatic registration of our application as a TransactionListener. |
private void |
initializeInternationalizationFramework()
Performs initialization of i18n part of TPT. |
java.lang.Thread |
invokeLater(java.lang.Runnable task)
Creates and starts a new thread. |
private void |
loadInternationalizationFiles()
Loads property files with translations from the theme-name/i18n folder (if exists) |
void |
setTheme(java.lang.String themeName)
This method is overridden as we want to reload theme-specific internationalization translation files from the theme's i18n folder once theme is changed. |
void |
transactionEnd(com.vaadin.Application application,
java.lang.Object o)
Once thread finishes, removes the application instance reference from it. |
void |
transactionStart(com.vaadin.Application application,
java.lang.Object o)
Adds a reference to the application instance into the current thread. |
Methods inherited from class com.vaadin.Application |
---|
addListener, addListener, addListener, addResource, addWindow, getContext, getErrorHandler, getLocale, getLogoutURL, getMainWindow, getProperty, getPropertyNames, getRelativeLocation, getSystemMessages, getTheme, getURL, getUser, getVersion, getWindow, getWindows, handleURI, isRunning, removeListener, removeListener, removeListener, removeResource, removeWindow, setErrorHandler, setLocale, setLogoutURL, setMainWindow, setUser, start, terminalError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static java.lang.ThreadLocal<TPTApplication> currentApplication
private Dictionary internationalizationDictionary
private static java.util.concurrent.atomic.AtomicBoolean firstInstanceCreated
Constructor Detail |
---|
public TPTApplication()
Method Detail |
---|
public void init()
init
in class com.vaadin.Application
private void initializeInternationalizationFramework()
private void loadInternationalizationFiles()
public void setTheme(java.lang.String themeName)
setTheme
in class com.vaadin.Application
themeName
- new theme namepublic abstract void applicationInit()
public abstract void firstApplicationStartup()
Another application initialization callback. It is called after init() / applicationInit() but only once per application class - e.g. this method is called when the first application instance is started. All subsequent instances of the same application (until the web contaner restart) will not cause this method to be called. You can place any shared or static resources initialization here, that are common to all application sessions and should be initialized only once.
Please note, that if you're running your application on a cluster, this method will be called in every cluster instance, so you have to care on this yourself.
public void close()
close
in class com.vaadin.Application
public void transactionStart(com.vaadin.Application application, java.lang.Object o)
transactionStart
in interface com.vaadin.service.ApplicationContext.TransactionListener
application
- o
- public void transactionEnd(com.vaadin.Application application, java.lang.Object o)
transactionEnd
in interface com.vaadin.service.ApplicationContext.TransactionListener
application
- o
- public java.lang.Thread invokeLater(java.lang.Runnable task)
new
Thread(...)
construction when starting server threads if you wish to access toolkit UI
data, i18n and be able to get the current application instance.
task
- Runnable task to execute in a separate thread
public static TPTApplication getCurrentApplication()
private void cleanupPreviousResources()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |