org.viewaframework.core
Class AbstractApplication

java.lang.Object
  extended by org.viewaframework.core.AbstractApplication
All Implemented Interfaces:
ViewControllerDispatcherAware, Application, ApplicationContextAware, ApplicationListenerAware, ViewModelManagerAware
Direct Known Subclasses:
DefaultApplication

public abstract class AbstractApplication
extends Object
implements Application

This is a default implementation of an Application which has a ViewControllerDispatcher as well as a ViewManager.

Since:
1.0
Author:
Mario Garcia

Constructor Summary
AbstractApplication()
           
AbstractApplication(String name, ViewContainerFrame mainView)
           
AbstractApplication(ViewContainerFrame mainView)
          This constructor sets the default root view
 
Method Summary
 void addApplicationListener(ApplicationListener listener)
           
 void close()
           
 void fireClose(ApplicationEvent event)
           
 void fireinitUI(ApplicationEvent event)
           
 void firePrepare(ApplicationEvent event)
           
 void firePrepareUI(ApplicationEvent event)
           
 ApplicationContext getApplicationContext()
          This method returns the current available ApplicationContext
 List<ApplicationListener> getApplicationListeners()
           
 ViewControllerDispatcher getControllerDispatcher()
          This method returns the controller dispatcher.
 Locale getLocale()
          This method returns the current locale
 String getName()
          The name of the application is not very important, but its used as default title name if the application is frame based.
 ViewContainerFrame getRootView()
           
 ViewManager getViewManager()
          Returns the object responsible for arranging and ordering the views.
 ViewModelManager getViewModelManager()
           
 boolean hideOrRestore()
          This method hides or restores the application depending on its actual state.
 void initUI()
          This method is responsible for creating and launching the application UI.
 boolean isVisible()
          Returns whether the application is visible or not
 void prepare()
          This method is called before the UI has been shown.
 void prepareUI()
          This method is right before the UI has been shown.
 void removeApplicationListener(ApplicationListener listener)
           
 void setApplicationContext(ApplicationContext applicationContext)
          This method sets up the ApplicationContext.
 void setApplicationListeners(List<ApplicationListener> applicationListeners)
           
 void setControllerDispatcher(ViewControllerDispatcher dispatcher)
          This method sets the application controller dispatcher.
 void setLocale(Locale locale)
          Sets the locale for the application.
 void setName(String name)
          Establish the name of the application
 void setRootView(ViewContainerFrame rootView)
          Establish the root view of the application
 void setViewManager(ViewManager viewManager)
          Sets the ViewManager
 void setViewModelManager(ViewModelManager viewModelManager)
           
 void setVisible(boolean visible)
          This method sets the visibility of the root view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractApplication

public AbstractApplication()

AbstractApplication

public AbstractApplication(String name,
                           ViewContainerFrame mainView)
Parameters:
name -
mainView -

AbstractApplication

public AbstractApplication(ViewContainerFrame mainView)
This constructor sets the default root view

Parameters:
mainView -
Method Detail

addApplicationListener

public void addApplicationListener(ApplicationListener listener)
Specified by:
addApplicationListener in interface ApplicationListenerAware

close

public void close()
Specified by:
close in interface Application

fireClose

public void fireClose(ApplicationEvent event)
Specified by:
fireClose in interface ApplicationListenerAware

fireinitUI

public void fireinitUI(ApplicationEvent event)
Specified by:
fireinitUI in interface ApplicationListenerAware

firePrepare

public void firePrepare(ApplicationEvent event)
Specified by:
firePrepare in interface ApplicationListenerAware

firePrepareUI

public void firePrepareUI(ApplicationEvent event)
Specified by:
firePrepareUI in interface ApplicationListenerAware

getApplicationContext

public ApplicationContext getApplicationContext()
Description copied from interface: ApplicationContextAware
This method returns the current available ApplicationContext

Specified by:
getApplicationContext in interface ApplicationContextAware
Returns:

getApplicationListeners

public List<ApplicationListener> getApplicationListeners()
Specified by:
getApplicationListeners in interface ApplicationListenerAware
Returns:

getControllerDispatcher

public ViewControllerDispatcher getControllerDispatcher()
Description copied from interface: ViewControllerDispatcherAware
This method returns the controller dispatcher. The controller dispatcher knows about what action should be called depending on what component has launched the event.

Specified by:
getControllerDispatcher in interface ViewControllerDispatcherAware
Returns:
The ViewControllerDispatcher

getLocale

public Locale getLocale()
Description copied from interface: Application
This method returns the current locale

Specified by:
getLocale in interface Application
Returns:
java.util.Locale

getName

public String getName()
Description copied from interface: Application
The name of the application is not very important, but its used as default title name if the application is frame based.

Specified by:
getName in interface Application
Returns:
the name of the application

getRootView

public ViewContainerFrame getRootView()
Returns:

getViewManager

public ViewManager getViewManager()
Description copied from interface: Application
Returns the object responsible for arranging and ordering the views.

Specified by:
getViewManager in interface Application
Returns:
The view manager.
See Also:
ViewManager}

getViewModelManager

public ViewModelManager getViewModelManager()
Specified by:
getViewModelManager in interface ViewModelManagerAware
Returns:

hideOrRestore

public boolean hideOrRestore()
Description copied from interface: Application
This method hides or restores the application depending on its actual state.

Specified by:
hideOrRestore in interface Application
Returns:
The state after executing the method

initUI

public void initUI()
            throws ApplicationException
Description copied from interface: Application
This method is responsible for creating and launching the application UI. It should create the UI within the EventDispatchThread.

Specified by:
initUI in interface Application
Throws:
ApplicationException

isVisible

public boolean isVisible()
Description copied from interface: Application
Returns whether the application is visible or not

Specified by:
isVisible in interface Application
Returns:

prepare

public void prepare()
             throws ApplicationException
Description copied from interface: Application
This method is called before the UI has been shown. This method shouldn't be used for configuring the UI, use configUI() instead.

Specified by:
prepare in interface Application
Throws:
ApplicationException

prepareUI

public void prepareUI()
               throws ApplicationException
Description copied from interface: Application
This method is right before the UI has been shown. It should be used for configuring the application UI.

Specified by:
prepareUI in interface Application
Throws:
ApplicationException

removeApplicationListener

public void removeApplicationListener(ApplicationListener listener)
Specified by:
removeApplicationListener in interface ApplicationListenerAware

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws ApplicationContextException
Description copied from interface: ApplicationContextAware
This method sets up the ApplicationContext. If there's already an available applicationContext it will throw an ApplicationContextException.

Specified by:
setApplicationContext in interface ApplicationContextAware
Parameters:
applicationContext - The ApplicationContext
Throws:
ApplicationContextException - If there's a previous ApplicationContext

setApplicationListeners

public void setApplicationListeners(List<ApplicationListener> applicationListeners)
Specified by:
setApplicationListeners in interface ApplicationListenerAware

setControllerDispatcher

public void setControllerDispatcher(ViewControllerDispatcher dispatcher)
                             throws ViewControllerDispatcherException
Description copied from interface: ViewControllerDispatcherAware
This method sets the application controller dispatcher. There is only one ViewControllerDispatcher by application.

Specified by:
setControllerDispatcher in interface ViewControllerDispatcherAware
Parameters:
dispatcher - Sets the ViewControllerDispatcher. If a controller dispatcher has been already set then an exception should be thrown.
Throws:
ViewControllerDispatcherException

setLocale

public void setLocale(Locale locale)
Description copied from interface: Application
Sets the locale for the application. All ResourceBundle messages could be i18n

Specified by:
setLocale in interface Application

setName

public void setName(String name)
Description copied from interface: Application
Establish the name of the application

Specified by:
setName in interface Application
Parameters:
name - the name to set

setRootView

public void setRootView(ViewContainerFrame rootView)
Description copied from interface: Application
Establish the root view of the application

Specified by:
setRootView in interface Application
Parameters:
rootView -

setViewManager

public void setViewManager(ViewManager viewManager)
                    throws ViewManagerException
Description copied from interface: Application
Sets the ViewManager

Specified by:
setViewManager in interface Application
Throws:
ViewManagerException
See Also:
ViewManager}

setViewModelManager

public void setViewModelManager(ViewModelManager viewModelManager)
Specified by:
setViewModelManager in interface ViewModelManagerAware

setVisible

public void setVisible(boolean visible)
Description copied from interface: Application
This method sets the visibility of the root view

Specified by:
setVisible in interface Application


Copyright © 2010. All Rights Reserved.