at.spardat.xma.appshell
Class AppShell

java.lang.Object
  extended byat.spardat.xma.page.Page
      extended byat.spardat.xma.page.PageClient
          extended byat.spardat.xma.page.DialogPage
              extended byat.spardat.xma.appshell.AppShell
All Implemented Interfaces:
Descriptive, IAppShell, at.spardat.xma.boot.component.IDialog, IDialogPage, IEmbeddable, at.spardat.xma.boot.component.IXMAControl, Synchronization, Transactional
Direct Known Subclasses:
ContextAppShell

public abstract class AppShell
extends DialogPage
implements IAppShell

Base class for application shells in XMA. An application shell is the window opened at startup of the client side application. It stays open during the whole user session. It typically contains a header area showing some context information, a menu area containing the menu tree of the application and a client area showing the currently active component.

Since:
1.4.0

Field Summary
protected  MenuItem rootMenu
          The root of the menu tree.
protected  ITask rootTask
          The task at the very bottom of the call stack.
 
Fields inherited from class at.spardat.xma.page.DialogPage
statusBar, statusBarComposite
 
Fields inherited from class at.spardat.xma.page.PageClient
composite
 
Constructor Summary
AppShell(ComponentClient component, boolean stateless, int style)
          Initializes the application shell.
 
Method Summary
abstract  void attachMenu(IMenuItem item)
          Attach the given MenuItem to its viusal representation.
 void callMenu(IMenuItem item)
          Calls the action associated which the given MenuItem.
 void callMenu(java.lang.String menuId)
          Calls the action associated which the named MenuItem.
 void clearClientArea()
          Removes the embedded page or componet form the client area.
protected  boolean close()
          This method will be called every time the Shell is tried to be closed.
 void closeCancel()
          Closes the component or page on top of the call stack.
 void closeOK()
          Closes the component or page on top of the call stack.
protected  boolean closeTasks(IMenuItem item)
          Closes all tasks on the call stack which are outside the given MenuItem.
abstract  ITask createRootTask(IMenuItem rootMenu)
          Create the MenuItem which will serve as root of all other MenuItems.
 ITask createTask(java.lang.String name)
          Creates the Task with the given name.
abstract  void detachMenu(IMenuItem item)
          Detach the MenuItem from its visual representation.
 void exit()
          Closes the AppShell.
abstract  org.eclipse.swt.widgets.Composite getClientComposite()
          Get the SWT-composite where client pages or composites can be embedded.
 IMenuItem getMenu(java.lang.String menuId)
          Get the MenuItem registered under the given menuId.
protected abstract  java.util.ResourceBundle getMenuResource()
          Get the ResourceBundle containing the labels for all menu items.
 ITask getTopTask()
          Get the task on top of the call stack.
 boolean hasWidgets()
          Determine if the AppShell still contains widgets.
 boolean invoke()
          Method called to start the AppShell.
 void leaveBase()
          Notify the AppShell, all Tasks and all Subpages, that the Page no longer is visible.
 void lockMenu()
          Locks and disables the menu.
abstract  void markMenu(java.lang.String menuId)
          Visibly marks the named MenuItem as selected.
 void pushClientComponent(at.spardat.xma.boot.component.IXMAControl newClient, boolean modal)
          Pushes the given Component or Page on top of the call stack.
 void registerMenu(IMenuItem item)
          Register the given MenuItem at the AppShell.
abstract  void selectMenu(java.lang.String menuId)
          Selects the named MenuItem.
 void setClientArea(at.spardat.xma.boot.component.IXMAControl newClient)
          Replaces the embedded page or component in the client area.
protected abstract  void setMenuEnabled(boolean enabled)
          Completely enable/disable the menu.
 void unlockMenu()
          Unlocks the menu.
 void unregisterMenu(IMenuItem item)
          Unregister the given MenuItem fromt the AppShell.
 
Methods inherited from class at.spardat.xma.page.DialogPage
clearError, clearInfo, clearValidationErrorImpl, clearWarning, createComposite, getDialog, getErrorCount, getExitstatus, getFocusControl, getShell, hasValidationError, initGUI, isVisible, overrideErrorsFromModel, removeWidgetsBase, setError, setFocus, setFocusControl, setInfo, setRerunStateChanched, setValidationErrorImpl, setWarning, stateChangedBase, updateErrorStatus
 
Methods inherited from class at.spardat.xma.page.PageClient
activatePage, addChild, attachUI, attachUIImpl, clientEvent, clientEventBase, createModels, createWidgets, detachUI, determineState, determineStateBase, enter, enterBase, getComponent, getComposite, getContextString, getCurrentEvent, getDialogPage, getExtend, getHelpUri, getHelpUriBase, getParent, getWidgets, hasModels, helpEvent, insertLangInFilename, isEventsEnabled, isNew, isUIAttached, launch, launchExtern, launchRelative, leave, newRemoteCall, removeChild, removeModel, removeWidgetModels, removeWidgets, rpcFinished, serverEvent, setContextString, setDialog, setEditable, setError, setEventsEnabled, setExtend, setId, setNew, setValidationErrorImpl, showException, showMessage, stateChanged, stateChangedBaseImpl, stateChangedExtend, toLocalizedHelpUri
 
Methods inherited from class at.spardat.xma.page.Page
changed, commit, describe, display, equalsCS, externalize, getId, getNumWModels, getTypeId, getWModel, getWModels, internalize, isAtServer, isStateless, randomlyChange, rollback, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface at.spardat.xma.appshell.IAppShell
contextStringChanged, showContextStack
 
Methods inherited from interface at.spardat.xma.page.IDialogPage
clearInfo, clearValidationErrorImpl, clearWarning, hasValidationError, overrideErrorsFromModel, setFocus, setInfo, setValidationErrorImpl, setWarning
 
Methods inherited from interface at.spardat.xma.boot.component.IDialog
clearError, getErrorCount, getFocusControl, getShell, setError, setFocusControl, updateErrorStatus
 
Methods inherited from interface at.spardat.xma.boot.component.IXMAControl
createComposite, enterBase, getComposite, initGUI, removeModel, removeWidgetsBase, stateChangedBase
 
Methods inherited from interface at.spardat.xma.page.IEmbeddable
determineStateBase, getContextString, getDialog, setDialog, setEventsEnabled, stateChangedBaseImpl, stateChangedExtend
 

Field Detail

rootMenu

protected MenuItem rootMenu
The root of the menu tree. It is not shown itself, but contains all the MenuItems which are shown at top level.


rootTask

protected ITask rootTask
The task at the very bottom of the call stack. This task is called automaticaly at application startup. All furter tasks are called from this task.

Constructor Detail

AppShell

public AppShell(ComponentClient component,
                boolean stateless,
                int style)
Initializes the application shell.

Parameters:
component - the Component containing the DialogPage.
stateless - indicating if this page is stateless on the server.
style - The SWT-Style for the Shell of the DialogPage.
Throws:
java.lang.IllegalArgumentException - if comonent is null.
Method Detail

setClientArea

public void setClientArea(at.spardat.xma.boot.component.IXMAControl newClient)
Replaces the embedded page or component in the client area. The currently embedded page or component is removed from this AppShell and the new one is shown in the client area.

Specified by:
setClientArea in interface IAppShell
Parameters:
newClient - the new page or component to embedd.

clearClientArea

public void clearClientArea()
Removes the embedded page or componet form the client area. Nothing is embedded afterwards.

Specified by:
clearClientArea in interface IAppShell

getClientComposite

public abstract org.eclipse.swt.widgets.Composite getClientComposite()
Get the SWT-composite where client pages or composites can be embedded.

Returns:
the composite representing the client area.

createRootTask

public abstract ITask createRootTask(IMenuItem rootMenu)
Create the MenuItem which will serve as root of all other MenuItems.

Returns:
the newly created root of the menu tree.

createTask

public ITask createTask(java.lang.String name)
Creates the Task with the given name. The default implementation takes the name as the fully qualified classname of the Task.

Specified by:
createTask in interface IAppShell
Parameters:
name - unique name for the task within the client side application.

lockMenu

public void lockMenu()
Locks and disables the menu. Internaly increments a lock counter. To unlock the menu again unlockMenu() must be called as often as lockMenu().

Specified by:
lockMenu in interface IAppShell

unlockMenu

public void unlockMenu()
Unlocks the menu. Internaly decrements a lock counter. To unlock the menu unlockMenu() must be called as often as lockMenu() before.

Specified by:
unlockMenu in interface IAppShell

setMenuEnabled

protected abstract void setMenuEnabled(boolean enabled)
Completely enable/disable the menu.

Parameters:
enabled - true: enable, false: disable.

attachMenu

public abstract void attachMenu(IMenuItem item)
Attach the given MenuItem to its viusal representation. The visual representation can be implemented by a Widget Model or directly by a Widget. The change must be propagated to the GUI.

Parameters:
item - to attach

detachMenu

public abstract void detachMenu(IMenuItem item)
Detach the MenuItem from its visual representation. The change must be propagated to the GUI.

Parameters:
item - to remove

registerMenu

public void registerMenu(IMenuItem item)
Register the given MenuItem at the AppShell. After this, the MenuItem will be attached to its visual representation. It will be visible and events will be delivered.

Specified by:
registerMenu in interface IAppShell
Parameters:
item - to register

unregisterMenu

public void unregisterMenu(IMenuItem item)
Unregister the given MenuItem fromt the AppShell. After this, the MenuItem will no longer be attached to its visual representation. It will not be visible and no events will be delivered any more.

Specified by:
unregisterMenu in interface IAppShell
Parameters:
item - to remove

callMenu

public void callMenu(IMenuItem item)
Calls the action associated which the given MenuItem. Before it is actually called, all currently open Tasks outside the given MenuItem are closed. If there is no Task attached to the given MenuItem, nothing happens.

Specified by:
callMenu in interface IAppShell
Parameters:
item - the MenuItem to call.

callMenu

public void callMenu(java.lang.String menuId)
Calls the action associated which the named MenuItem. Before it is actually called, all currently open Tasks outside the named MenuItem are closed. If there is no Task attached to the named MenuItem, nothing happens.

Specified by:
callMenu in interface IAppShell
Parameters:
menuId - the name of the MenuItem to call.

getMenu

public IMenuItem getMenu(java.lang.String menuId)
Get the MenuItem registered under the given menuId. If there are more than one MenuItem registered under the same name, the one registerd last is returned.

Parameters:
menuId - the name of the MenuItem you want.
Returns:
the MenuItem with the given name or null if not found.

selectMenu

public abstract void selectMenu(java.lang.String menuId)
Selects the named MenuItem. This method behaves like the user has selected the MenuItem via the GUI.

Specified by:
selectMenu in interface IAppShell
Parameters:
menuId - the name of the MenuItem to select.

markMenu

public abstract void markMenu(java.lang.String menuId)
Visibly marks the named MenuItem as selected.

Specified by:
markMenu in interface IAppShell
Parameters:
menuId - the name of the MenuItem to mark as selected.

getMenuResource

protected abstract java.util.ResourceBundle getMenuResource()
Get the ResourceBundle containing the labels for all menu items.

Returns:
the ResourceBundle for the menu.

invoke

public boolean invoke()
Method called to start the AppShell. The AppShell will be shown and executed. It blocks until the AppShell is closed.

Overrides:
invoke in class DialogPage
Returns:
true

getTopTask

public ITask getTopTask()
Get the task on top of the call stack. This is the currently active Task.

Specified by:
getTopTask in interface IAppShell

pushClientComponent

public void pushClientComponent(at.spardat.xma.boot.component.IXMAControl newClient,
                                boolean modal)
Pushes the given Component or Page on top of the call stack. It is shown embedded in the client area. If modal is true, this method blocks until the Component or Page is closed.

Specified by:
pushClientComponent in interface IAppShell
Parameters:
newClient - the component or page to embedd.
modal - if modal is true this method blocks util newClient is finished if modla if false this method reuturns imediatly.

closeOK

public void closeOK()
Closes the component or page on top of the call stack.

Specified by:
closeOK in interface at.spardat.xma.boot.component.IDialog
Overrides:
closeOK in class DialogPage

closeCancel

public void closeCancel()
Closes the component or page on top of the call stack.

Specified by:
closeCancel in interface at.spardat.xma.boot.component.IDialog
Overrides:
closeCancel in class DialogPage

leaveBase

public void leaveBase()
Notify the AppShell, all Tasks and all Subpages, that the Page no longer is visible.

Specified by:
leaveBase in interface at.spardat.xma.boot.component.IXMAControl
Overrides:
leaveBase in class PageClient

exit

public void exit()
Closes the AppShell.


close

protected boolean close()
This method will be called every time the Shell is tried to be closed. It is intended to be implemented by the application programmer if he wants to react on this event. The application programmer my decide if the shell will actually be closed. Per default closing is permitted if the menu is enabled - no blocking Task is active.

Overrides:
close in class DialogPage
Returns:
true means it is ok to close the Shell false means do not close the Shell

closeTasks

protected boolean closeTasks(IMenuItem item)
Closes all tasks on the call stack which are outside the given MenuItem. The call stack is rewinded until the task is on top which corresponds to the given MenuItem.

Parameters:
item - the menu item outside which all tasks should be closed.
Returns:
true if all this tasks could be successfully closed. false if a task refused to close.

hasWidgets

public boolean hasWidgets()
Determine if the AppShell still contains widgets. Can be used to test if it is disposed.

Specified by:
hasWidgets in interface IAppShell
Returns:
true if it has widgets.