com.sibvisions.rad.application
Class Application

java.lang.Object
  extended by javax.rad.genui.UIResource<C>
      extended by javax.rad.genui.UIComponent<C>
          extended by javax.rad.genui.UIContainer<IPanel>
              extended by javax.rad.genui.container.UIPanel
                  extended by javax.rad.application.genui.Content
                      extended by javax.rad.application.genui.Application
                          extended by javax.rad.application.genui.RemoteApplication
                              extended by com.sibvisions.rad.application.Application
All Implemented Interfaces:
IApplication, IConnectable, IContent, IMessageConstants, ITranslatable, IConnectionListener, IPanel, IComponent, IContainer, IResource, IExceptionListener, INamedObject

public abstract class Application
extends RemoteApplication
implements IExceptionListener, IConnectionListener

The Application is the default RemoteApplication. It shows a login screen, has an error dialog and handles the menu- and toolbar. It's the base class for user-defined applications.


Field Summary
static String PARAM_MENU_EXIT_VISIBLE
          the parameter name for showing the exit button.
 
Fields inherited from class javax.rad.application.genui.Application
PARAM_SETUP_CLASS
 
Fields inherited from class javax.rad.genui.container.UIPanel
imgBack
 
Fields inherited from class javax.rad.genui.UIContainer
components
 
Fields inherited from class javax.rad.genui.UIComponent
lLastTranslationModified, parent
 
Fields inherited from class javax.rad.genui.UIResource
uiResource
 
Fields inherited from interface javax.rad.application.IMessageConstants
MESSAGE_BUTTON_OK, MESSAGE_BUTTON_OK_CANCEL, MESSAGE_BUTTON_YES_NO, MESSAGE_ICON_ERROR, MESSAGE_ICON_INFO, MESSAGE_ICON_QUESTION, MESSAGE_ICON_WARNING
 
Constructor Summary
Application(UILauncher pLauncher)
          Creates a new instance of Main and configures the user interface.
 
Method Summary
 void actionCalled(CallEvent pEvent)
          An action was called.
protected  void afterLogin()
          Performs actions after successful login to the application.
protected  void afterLogout()
          Performs actions after successful logout from the application.
 void callError(CallErrorEvent pEvent)
          An error occured during remote communication.
protected  void configureAbout(About pAbout)
          Configures the about dialog.
protected  void configureApplicationPane(IContainer pApplicationPane)
          Configures the default behaviour of the application pane.
protected  void configureDesktopPane(UIDesktopPanel pDesktop)
          Configures the default behaviour of the content pane.
protected  void configureFrame(AbstractFrame pFrame)
          Configures an internal frame for the application.
protected  void configureLogin(Login pLogin)
          Configures the login component.
protected  void configureMenu(UIMenuBar pMenu)
          Configures the menu for the application.
protected  void configureToolBar(UIToolBar pToolBar)
          Configures the application toolbar.
 void connectionClosed(ConnectionEvent pEvent)
          A connection was closed.
 void connectionOpened(ConnectionEvent pEvent)
          A connection was opened.
 void connectionReOpened(ConnectionEvent pEvent)
          A connection was re-opened.
protected  About createAbout()
          Creates the about component.
protected abstract  IConnection createConnection()
          Creates a connection for the application.
protected  UIDesktopPanel createDesktopPane()
          Creates the content pane for the application.
protected  Error createError()
          Creates a new Error frame.
protected  Login createLogin()
          Creates the login component for entering the authentication credentials.
protected  UIMenuBar createMenu()
          Creates the menu for the application.
 UIMenuItem createMenuItem(String pAction, String pActionCommand, String pText, UIImage pImage)
          Creates a new menu item.
protected  UIToolBar createToolBar()
          Creates the toolbar for the application.
 UIButton createToolBarButton(String pAction, String pActionCommand, String pText, UIImage pImage)
          Creates a new toolbar button.
 void doAbout(UIActionEvent pEvent)
          Opens the about dialog.
 void doChangePassword(UIActionEvent pEvent)
          Change the password.
 void doErrorClosed(UIWindowEvent pEvent)
          Unsets the error dialog.
 void doExit(UIActionEvent pEvent)
          Performs the exit of the application.
 void doHelp(UIActionEvent pEvent)
          Opens the help system.
 void doHideChangePassword(UIActionEvent pEvent)
          Shows the change password screen.
 void doHideLogin(UIActionEvent pEvent)
          Hides the login screen.
 void doLogin(UIActionEvent pEvent)
          The event method for the logon button.
 void doLogout(UIActionEvent pEvent)
          Closes the opened connections.
 void doShowChangePassword(UIActionEvent pEvent)
          Shows the change password screen.
 void doShowLogin(UIActionEvent pEvent)
          Shows the login screen.
protected abstract  String getApplicationName()
          Gets the name for the application.
 UIContainer getContentPane()
          Gets the content pane for the application.
 UIDesktopPanel getDesktopPane()
          Gets the desktop panel for the application.
 Error getError()
          Gets the error frame.
 Login getLogin()
          Gets the login frame.
 UIMenuBar getMenuBar()
          Gets the application menu bar.
 UIToolBar getToolBar()
          Gets the application tool bar.
 void handleException(Throwable pThrowable)
          Notification for the listener to handle an exception occured in another part of the program.
protected  boolean isExitVisible()
          Gets whether the exit options are visible.
 void notifyDestroy()
          Notifies the IContent, that it will be destroyed.
 void notifyVisible()
          Notifies the IContent, that it is now positioned and showing.
 void objectCalled(CallEvent pEvent)
          An object was called.
protected  void preConfigure()
          This method will be used from subclasses to configure the UI before the UI will be created.
 void propertyChanged(PropertyEvent pEvent)
          A property was changed.
protected  void setTitle(String pName)
          Sets the application title.
 void showErrorDialog()
          Shows the error dialog.
<OP> Message
showMessage(OP pOpener, int pIconType, int pButtonType, String pMessage, String pOkAction, String pCancelAction)
          Shows a message.
 
Methods inherited from class javax.rad.application.genui.RemoteApplication
eventAfterLogin, eventAfterLogout, getConnection, isConnected, setConnection
 
Methods inherited from class javax.rad.application.genui.Application
getApplicationPane, getCursor, getLauncher, getSetup, setCursor, setLauncher, showError, showError, showInformation, showInformation, showQuestion, showQuestion
 
Methods inherited from class javax.rad.application.genui.Content
getOpener, setOpener
 
Methods inherited from class javax.rad.genui.container.UIPanel
getBackgroundImage, setBackgroundImage
 
Methods inherited from class javax.rad.genui.UIContainer
add, add, add, add, addNotify, beforeAddNotify, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, removeNotify, setLayout, setZOrder, updateTranslation
 
Methods inherited from class javax.rad.genui.UIComponent
capture, createCellFormatter, createNodeFormatter, debug, error, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getComponentUIResource, getCurrentTranslation, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getResource, getSize, getToolTipText, getTranslation, info, invokeAndWait, invokeAndWait, invokeInThread, invokeInThread, invokeLater, invokeLater, isBackgroundSet, isBeforeNotified, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isNotified, isPreferredSizeSet, isTranslationChanged, isTranslationEnabled, isVisible, requestFocus, setBackground, setBounds, setBounds, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocation, setLocationRelativeTo, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setName, setParent, setPreferredSize, setPreferredSize, setSize, setSize, setToolTipText, setTranslation, setTranslationEnabled, setVisible, translate
 
Methods inherited from class javax.rad.genui.UIResource
equals, getUIResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.application.IContent
getOpener, setOpener
 
Methods inherited from interface javax.rad.ui.IComponent
capture, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 
Methods inherited from interface javax.rad.ui.IContainer
add, add, add, add, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, setLayout
 

Field Detail

PARAM_MENU_EXIT_VISIBLE

public static final String PARAM_MENU_EXIT_VISIBLE
the parameter name for showing the exit button.

See Also:
Constant Field Values
Constructor Detail

Application

public Application(UILauncher pLauncher)
Creates a new instance of Main and configures the user interface.

Parameters:
pLauncher - the launcher
Method Detail

preConfigure

protected void preConfigure()
This method will be used from subclasses to configure the UI before the UI will be created.


getApplicationName

protected abstract String getApplicationName()
Gets the name for the application.

Returns:
the application name

createConnection

protected abstract IConnection createConnection()
                                         throws Exception
Creates a connection for the application.

Returns:
the connection implementation
Throws:
Exception - if the "connection" can not be created

getContentPane

public UIContainer getContentPane()
Gets the content pane for the application. The content pane will be used for the application UI.

Specified by:
getContentPane in interface IApplication
Returns:
the content pane

notifyVisible

public void notifyVisible()
Notifies the IContent, that it is now positioned and showing.

Specified by:
notifyVisible in interface IContent
Overrides:
notifyVisible in class Content

notifyDestroy

public void notifyDestroy()
Notifies the IContent, that it will be destroyed.

Specified by:
notifyDestroy in interface IContent
Overrides:
notifyDestroy in class Content

showMessage

public <OP> Message showMessage(OP pOpener,
                                int pIconType,
                                int pButtonType,
                                String pMessage,
                                String pOkAction,
                                String pCancelAction)
                    throws Throwable
Shows a message.

Specified by:
showMessage in interface IApplication
Type Parameters:
OP - the opener type
Parameters:
pOpener - the opener/parent component which wants to display the message
pIconType - the icon type IMessageConstants.MESSAGE_BUTTON_OK_CANCEL, IMessageConstants.MESSAGE_BUTTON_YES_NO, IMessageConstants.MESSAGE_BUTTON_OK
pButtonType - the button type IMessageConstants.MESSAGE_ICON_INFO, IMessageConstants.MESSAGE_ICON_WARNING, IMessageConstants.MESSAGE_ICON_ERROR
pMessage - the message
pOkAction - the action name to call when ok or yes was clicked
pCancelAction - the action name to call when cancel or close was clicked
Returns:
the message content or null if the message has no content
Throws:
Throwable - if the message could not be initialized

handleException

public void handleException(Throwable pThrowable)
Notification for the listener to handle an exception occured in another part of the program.

Specified by:
handleException in interface IExceptionListener
Parameters:
pThrowable - the occured exception

callError

public void callError(CallErrorEvent pEvent)
An error occured during remote communication.

Specified by:
callError in interface IConnectionListener
Parameters:
pEvent - the error information

connectionOpened

public void connectionOpened(ConnectionEvent pEvent)
A connection was opened.

Specified by:
connectionOpened in interface IConnectionListener
Parameters:
pEvent - the connection information

connectionReOpened

public void connectionReOpened(ConnectionEvent pEvent)
A connection was re-opened.

Specified by:
connectionReOpened in interface IConnectionListener
Parameters:
pEvent - the connection information

connectionClosed

public void connectionClosed(ConnectionEvent pEvent)
A connection was closed.

Specified by:
connectionClosed in interface IConnectionListener
Parameters:
pEvent - the connection information

actionCalled

public void actionCalled(CallEvent pEvent)
An action was called.

Specified by:
actionCalled in interface IConnectionListener
Parameters:
pEvent - the call information

objectCalled

public void objectCalled(CallEvent pEvent)
An object was called.

Specified by:
objectCalled in interface IConnectionListener
Parameters:
pEvent - the call information

propertyChanged

public void propertyChanged(PropertyEvent pEvent)
A property was changed.

Specified by:
propertyChanged in interface IConnectionListener
Parameters:
pEvent - the property information

afterLogout

protected void afterLogout()
Performs actions after successful logout from the application.

Overrides:
afterLogout in class RemoteApplication

afterLogin

protected void afterLogin()
Performs actions after successful login to the application.

Overrides:
afterLogin in class RemoteApplication

configureApplicationPane

protected void configureApplicationPane(IContainer pApplicationPane)
Configures the default behaviour of the application pane.

Parameters:
pApplicationPane - the application pane

createDesktopPane

protected UIDesktopPanel createDesktopPane()
Creates the content pane for the application.

Returns:
the content panel

configureDesktopPane

protected void configureDesktopPane(UIDesktopPanel pDesktop)
Configures the default behaviour of the content pane.

Parameters:
pDesktop - the content pane (= the desktop)

getDesktopPane

public UIDesktopPanel getDesktopPane()
Gets the desktop panel for the application.

Returns:
the desktop panel

createMenu

protected UIMenuBar createMenu()
Creates the menu for the application.

Returns:
the menu

configureMenu

protected void configureMenu(UIMenuBar pMenu)
Configures the menu for the application.

Parameters:
pMenu - the menu

createToolBar

protected UIToolBar createToolBar()
Creates the toolbar for the application.

Returns:
the application toolbar

configureToolBar

protected void configureToolBar(UIToolBar pToolBar)
Configures the application toolbar.

Parameters:
pToolBar - the application toolbar

createLogin

protected Login createLogin()
Creates the login component for entering the authentication credentials.

Returns:
the login component

createAbout

protected About createAbout()
Creates the about component.

Returns:
the about component

configureLogin

protected void configureLogin(Login pLogin)
Configures the login component.

Parameters:
pLogin - the login component

setTitle

protected void setTitle(String pName)
Sets the application title. It's a wrapper method getLauncher().setTitle(...) and necessary for inherited classes, to avoid title flickr.

Parameters:
pName - the application title

showErrorDialog

public void showErrorDialog()
Shows the error dialog.


configureFrame

protected void configureFrame(AbstractFrame pFrame)
Configures an internal frame for the application.

Parameters:
pFrame - the internal frame

createMenuItem

public UIMenuItem createMenuItem(String pAction,
                                 String pActionCommand,
                                 String pText,
                                 UIImage pImage)
Creates a new menu item.

Parameters:
pAction - the action method
pActionCommand - the action command when the menu gets selected
pText - the menu label
pImage - the image for the menu item
Returns:
the menu item

createToolBarButton

public UIButton createToolBarButton(String pAction,
                                    String pActionCommand,
                                    String pText,
                                    UIImage pImage)
Creates a new toolbar button.

Parameters:
pAction - the action method
pActionCommand - the action command
pText - the button text or null if the button has no text
pImage - the button image or null if the button has no image
Returns:
a technology dependent button

configureAbout

protected void configureAbout(About pAbout)
Configures the about dialog.

Parameters:
pAbout - the About

getMenuBar

public UIMenuBar getMenuBar()
Gets the application menu bar.

Returns:
the menu bar

getToolBar

public UIToolBar getToolBar()
Gets the application tool bar.

Returns:
the tool bar

getLogin

public Login getLogin()
Gets the login frame.

Returns:
the login frame

createError

protected Error createError()
                     throws Throwable
Creates a new Error frame.

Returns:
an error frame
Throws:
Throwable - if the error instance can not be created

getError

public Error getError()
Gets the error frame.

Returns:
the frame or null if no error frame is open

doErrorClosed

public void doErrorClosed(UIWindowEvent pEvent)
Unsets the error dialog.

Parameters:
pEvent - the frame close event

doLogin

public void doLogin(UIActionEvent pEvent)
             throws Throwable
The event method for the logon button. It tries to logon the user with provided credentials.

Parameters:
pEvent - the event information from the button
Throws:
Throwable - if the connection could not be established

doChangePassword

public void doChangePassword(UIActionEvent pEvent)
                      throws Throwable
Change the password.

Parameters:
pEvent - the event information from the button
Throws:
Throwable - if the password info message causes an error

doShowLogin

public void doShowLogin(UIActionEvent pEvent)
Shows the login screen.

Parameters:
pEvent - the event information from the button

doHideLogin

public void doHideLogin(UIActionEvent pEvent)
Hides the login screen.

Parameters:
pEvent - the event information from the button

doShowChangePassword

public void doShowChangePassword(UIActionEvent pEvent)
Shows the change password screen.

Parameters:
pEvent - the event information from the button

doHideChangePassword

public void doHideChangePassword(UIActionEvent pEvent)
Shows the change password screen.

Parameters:
pEvent - the event information from the button

doExit

public void doExit(UIActionEvent pEvent)
Performs the exit of the application. It closes the opened connections and the application itself.

Parameters:
pEvent - the event information from the button

doLogout

public void doLogout(UIActionEvent pEvent)
Closes the opened connections.

Parameters:
pEvent - the event information from the button

doAbout

public void doAbout(UIActionEvent pEvent)
             throws Throwable
Opens the about dialog.

Parameters:
pEvent - the triggering event
Throws:
Throwable - if the about content could not be initalized

doHelp

public void doHelp(UIActionEvent pEvent)
            throws Throwable
Opens the help system.

Parameters:
pEvent - the event from the menu
Throws:
Throwable - if the help is not available

isExitVisible

protected boolean isExitVisible()
Gets whether the exit options are visible.

Returns:
true if the exit options are visible, false otherwise


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.