|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nl.coderight.jazz.Controller nl.coderight.jazz.Application
public abstract class Application
Application
is the root Controller
of the Hierarchical Model-View-Controller (HMVC) layers.
The HMVC pattern decomposes an application into a hierarchy of parent-child MVC layers. For more information about HMVC article MyApp +- MyAppView +- MyAppModel | +- MyController_1 | +- MyView_1 | +- MyModel_1 | | | +- MyController_1_1 | | +- MyView_1_1 | | +- MyModel_1_1 | | | +- etc. | +- etc.
Example:
public class MyApp extends Application { private MyAppModel myModel; private MyAppView myView; public void execute() { myModel = new MyAppModel(); myView = new MyAppView(); setModel(myModel); setView(myView); showView(); } protected void onStart() { DatabaseService.getInstance().openDatabase(); } protected void onExit() { DatabaseService.getInstance().closeDatabase(); } public void init() { setCrossPlatformLookAndFeel(); } public static void main(String[] args) { new MyApp().start(); } }
Default event-handlers:
Default the following settings are used:
Model
,
View
,
Controller
Nested Class Summary |
---|
Nested classes/interfaces inherited from class nl.coderight.jazz.Controller |
---|
Controller.EventNotHandledException |
Constructor Summary | |
---|---|
Application()
Constructor (default WindowMode.SINGLE_WINDOW). |
|
Application(ViewManager.WindowMode windowMode)
Constructor for custom WindowMode . |
|
Application(ViewManager.WindowMode windowMode,
ViewManager.WindowStyle windowStyle)
Constructor for custom WindowMode and ScreenMode . |
Method Summary | |
---|---|
void |
exit()
Exit application. |
View |
getActiveView()
|
String |
getApplicationName()
Returns application name (from JazzLicense). |
String |
getApplicationVersion()
Return application version (from AppLauncher). |
List<Module> |
getInstalledModules()
Returns a list of installed modules. |
void |
handleEvent(ApplicationEvent evt)
Default handling of ApplicationEvent . |
void |
handleEvent(MessageEvent evt)
Default handling of MessageEvent . |
void |
handleEvent(ProgressEvent evt)
Default handling of ProgressEvent . |
void |
handleEvent(ViewEvent evt)
Default handling of ViewEvent . |
void |
hide()
Hides the application window. |
void |
hideSplashScreen()
Hides the SplashScreen . |
abstract void |
init()
Invoked when application is started. |
void |
installModule(Module module)
Installs a Module . |
static void |
main(String[] args)
|
protected void |
onEventNotHandled(Event event)
Invoked when an event is not handled. |
protected void |
onExit()
Invoked when the application exits. |
protected void |
onIdle()
Invoked when idle time is set. |
protected void |
onStart()
Invoked when the application starts. |
void |
setCrossPlatformLookAndFeel()
Sets cross-platform look and feel. |
void |
setIdleTime(int time)
Sets idle time in milliseconds. |
void |
setLookAndFeel(LookAndFeel laf)
Sets custom look and feel. |
void |
setLookAndFeel(String laf)
Sets custom look and feel. |
void |
setMenuBar(MenuBar menuBar)
Sets a MenuBar for this Application . |
void |
setNimbusLookAndFeel()
Sets Nimbus look and feel. |
void |
setResourceManager(ResourceManager resourceManager)
Sets the ResourceManager . |
void |
setSplashScreen(SplashScreen splashScreen)
Sets application SplashScreen . |
void |
setStatusBar(StatusBar statusBar)
Sets a StatusBar for this Application . |
void |
setSystemLookAndFeel()
Sets system look and feel. |
void |
setSystemTrayIcon(SystemTrayIcon systemTrayIcon)
Sets the SystemTrayIcon . |
void |
setToolBar(ToolBar toolBar)
Sets a ToolBar for this view. |
void |
setToolBar(ToolBar toolBar,
ToolBar.Position position)
Sets a ToolBar for this Application . |
void |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
Sets the UncaughtExceptionHandler . |
void |
show()
Shows the application window. |
void |
showMessage(String message,
MessageEvent.MessageEventType messageEventType)
Displays an alert dialog. |
void |
showSplashScreen()
Shows the SplashScreen . |
void |
start()
Start application on the Event Dispatch Thread. |
Methods inherited from class nl.coderight.jazz.Controller |
---|
closeView, execute, executeController, executeTask, getApplication, getModel, getView, handleEvent, onAfterShowView, onBeforeShowView, propagateEvent, scheduleTask, setModel, setView, showView, showView |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Application()
public Application(ViewManager.WindowMode windowMode)
WindowMode
.
public Application(ViewManager.WindowMode windowMode, ViewManager.WindowStyle windowStyle)
WindowMode
and ScreenMode
.
Method Detail |
---|
public final String getApplicationName()
public String getApplicationVersion()
public final View getActiveView()
public final void start()
Invokes the following sequence of methods:
public abstract void init()
Use this for example to open a (database) connection, set the look and feel and configure the application.
start()
public void show()
hide()
public void hide()
Use this for example with SystemTrayIcon
to run the application in the background.
show()
public final void exit()
onExit()
public final void installModule(Module module)
Module
.
public final List<Module> getInstalledModules()
public final void setSplashScreen(SplashScreen splashScreen)
SplashScreen
.
The splash screen is displayed when the application starts and closed when the first view becomes visible (if auto close true).
public final void showSplashScreen()
SplashScreen
.
setSplashScreen(SplashScreen)
public final void hideSplashScreen()
SplashScreen
.
setSplashScreen(SplashScreen)
public void setMenuBar(MenuBar menuBar)
MenuBar
for this Application
.
public void setToolBar(ToolBar toolBar)
ToolBar
for this view.
public void setToolBar(ToolBar toolBar, ToolBar.Position position)
ToolBar
for this Application
.
public void setStatusBar(StatusBar statusBar)
StatusBar
for this Application
.
public final void setSystemLookAndFeel()
public final void setCrossPlatformLookAndFeel()
public final void setNimbusLookAndFeel()
public final void setLookAndFeel(String laf)
public final void setLookAndFeel(LookAndFeel laf)
public final void setResourceManager(ResourceManager resourceManager)
ResourceManager
.
public final void setSystemTrayIcon(SystemTrayIcon systemTrayIcon)
SystemTrayIcon
.
public final void setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
UncaughtExceptionHandler
.
public void showMessage(String message, MessageEvent.MessageEventType messageEventType)
public void handleEvent(ApplicationEvent evt)
ApplicationEvent
.
public void handleEvent(ViewEvent evt)
ViewEvent
.
handleEvent
in class Controller
public void handleEvent(MessageEvent evt)
MessageEvent
.
When a StatusBar
is set and MessageEventType
is PLAIN,
the message is displayed on the status bar.
Otherwise the message is shown in an alert dialog.
StatusBar
,
Application#showMessage(String, MessageEventType)
public void handleEvent(ProgressEvent evt)
ProgressEvent
.
ProgressEventType.START -> change the mouse cursor shape toCursor.WAIT_CURSOR
ProgressEventType.STOP -> change the mouse cursor shape toCursor.DEFAULT_CURSOR
handleEvent
in class Controller
Controller.handleEvent(ProgressEvent)
,
ProgressMonitor
public final void setIdleTime(int time)
Use this for example to logout a user after a given time of inactivity.
time
- in milliseconds to wait before the onIdle method is calledonIdle()
protected void onIdle()
setIdleTime(int)
protected void onStart()
Use this for example to open a database.
start()
protected void onExit()
use this for example to close a database.
exit()
protected void onEventNotHandled(Event event)
NOTE! default implementation shows a message dialog. You should override this method for example to write not handled events to a log file.
onEventNotHandled
in class Controller
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |