at.spardat.xma.page
Class DialogPage

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

public abstract class DialogPage
extends PageClient
implements IDialogPage

This Class is the base class of all dialog Pages. It implements the main livecycle protocoll for the dialog and the handling of the corresponding SWT-Shell.


Field Summary
protected  StatusBar statusBar
          The StatusBar of the Dialog.
protected  org.eclipse.swt.widgets.Composite statusBarComposite
          The SWT-Composite serving as parent for the StatusBar
 
Fields inherited from class at.spardat.xma.page.PageClient
composite
 
Constructor Summary
DialogPage(ComponentClient component, boolean stateless, int style)
          Initializes a DialogPage inside a given Component.
DialogPage(ComponentClient component, org.eclipse.swt.widgets.Shell parentShell, boolean stateless, int style)
          Initializes a DialogPage inside a given Component.
DialogPage(PageClient parent, boolean stateless, int style)
          Initializes a DialogPage inside the same Component as the parent PageClient.
 
Method Summary
 void clearError(org.eclipse.swt.widgets.Widget widget)
          Removes the error for the given widget.
 void clearInfo(org.eclipse.swt.widgets.Widget widget)
          Removes the info for the given widget.
 void clearValidationErrorImpl(org.eclipse.swt.widgets.Widget widget)
          Removes a validation error for a particular widget.
 void clearWarning(org.eclipse.swt.widgets.Widget widget)
          Removes the warning for the given widget.
protected  boolean close()
          This method will be called every time the Shell is tried to be closed.
 void closeCancel()
          Closes the dialog with exitStatus false.
 void closeOK()
          Closes the dialog with exitStatus true.
 org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parentComp)
           
 at.spardat.xma.boot.component.IDialog getDialog()
          Get the DialogPage of this Page.
 int getErrorCount()
          Returns the number of Errors in this dialog including its subpages.
 boolean getExitstatus()
          Returns the exitStatus of the DialogPage.
 org.eclipse.swt.widgets.Control getFocusControl()
          Gets the Control on the DialogPage or a Subpage of it, which currently has the focus.
 org.eclipse.swt.widgets.Shell getShell()
          Get the SWT-Shell of the DialogPage.
 boolean hasValidationError(org.eclipse.swt.widgets.Widget widget)
          Determines if a validation error currently exists for a given widget.
 void initGUI()
          Creates the Widgets of the PageClient and all Subpages by calling PageClient.createWidgets() on the PageClient and all Subpages.
 boolean invoke()
          Method called to start the DialogPage.
 boolean isVisible()
          Indicates if the dialog is shown to the user.
 void overrideErrorsFromModel()
          Resets all widgets containing values with validation errors to their last known valid value from the model.
 void removeWidgetsBase()
          Notify the PageClient and all Subpages, that the Widgets are disposed by calling PageClient.removeWidgets() on all Subpages and the PageClient.
 void setError(org.eclipse.swt.widgets.Widget widget, java.lang.String errorText)
          Sets an error for the given widget.
 void setFocus(org.eclipse.swt.widgets.Control control)
          Sets the focus to the given control.
 void setFocusControl(org.eclipse.swt.widgets.Control control)
          Sets the Control on the DialogPage of a Subpage of it, which currently has the focus.
 void setInfo(org.eclipse.swt.widgets.Widget widget, java.lang.String infoText)
          Sets an info for the given widget.
 void setRerunStateChanched()
          Requests another call to PageClient.determineState() and PageClient.stateChanged() if called within one of these methods.
 void setValidationErrorImpl(org.eclipse.swt.widgets.Widget widget, java.lang.String errorText)
          Sets a validation error for a particular widget.
 void setWarning(org.eclipse.swt.widgets.Widget widget, java.lang.String warningText)
          Sets an warning for the given widget.
 void stateChangedBase()
          Notify the PageClient and all Subpages of a possible Change in the PageModels by calling PageClient.determineState() and PageClient.stateChanged() on the PageClient and all Subpages.
 void updateErrorStatus(org.eclipse.swt.widgets.Widget current)
          Updates the error message in the StatusBar.
 
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, leaveBase, 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.boot.component.IXMAControl
enterBase, getComposite, leaveBase, removeModel
 
Methods inherited from interface at.spardat.xma.page.IEmbeddable
determineStateBase, getContextString, setDialog, setEventsEnabled, stateChangedBaseImpl, stateChangedExtend
 

Field Detail

statusBar

protected StatusBar statusBar
The StatusBar of the Dialog.


statusBarComposite

protected org.eclipse.swt.widgets.Composite statusBarComposite
The SWT-Composite serving as parent for the StatusBar

Constructor Detail

DialogPage

public DialogPage(ComponentClient component,
                  boolean stateless,
                  int style)
Initializes a DialogPage inside a given Component.

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

DialogPage

public DialogPage(ComponentClient component,
                  org.eclipse.swt.widgets.Shell parentShell,
                  boolean stateless,
                  int style)
Initializes a DialogPage inside a given Component.

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

DialogPage

public DialogPage(PageClient parent,
                  boolean stateless,
                  int style)
Initializes a DialogPage inside the same Component as the parent PageClient.

Parameters:
parent - the PageClient calling this DialogPage.
stateless - indicating if this page is stateless on the server.
style - The SWT-Style for the Shell of the DialogPage.
Method Detail

getDialog

public at.spardat.xma.boot.component.IDialog getDialog()
Get the DialogPage of this Page.

Specified by:
getDialog in interface IEmbeddable
Overrides:
getDialog in class PageClient
Returns:
this.

getShell

public org.eclipse.swt.widgets.Shell getShell()
Get the SWT-Shell of the DialogPage. For DialogPages the corresponding SWT-Composite of the DialogPage is a Shell and will be returned.

Specified by:
getShell in interface at.spardat.xma.boot.component.IDialog
Returns:
the SWT-Shell containing the widgets of this DialogPage.

setFocus

public void setFocus(org.eclipse.swt.widgets.Control control)
Sets the focus to the given control.

Specified by:
setFocus in interface IDialogPage
Parameters:
control - the Control to set the focus to.

getFocusControl

public org.eclipse.swt.widgets.Control getFocusControl()
Gets the Control on the DialogPage or a Subpage of it, which currently has the focus.

Specified by:
getFocusControl in interface at.spardat.xma.boot.component.IDialog
Returns:
the Control with the focus.

setFocusControl

public void setFocusControl(org.eclipse.swt.widgets.Control control)
Sets the Control on the DialogPage of a Subpage of it, which currently has the focus. The Control must allready have the focus. No SWT-Method will be called. This method is reserverd for the runtime to keep track of the focus. Do not call it directly!

Specified by:
setFocusControl in interface at.spardat.xma.boot.component.IDialog
Parameters:
control - the Control with the focus.

createComposite

public org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parentComp)
Specified by:
createComposite in interface at.spardat.xma.boot.component.IXMAControl

initGUI

public void initGUI()
Creates the Widgets of the PageClient and all Subpages by calling PageClient.createWidgets() on the PageClient and all Subpages.

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

invoke

public boolean invoke()
Method called to start the DialogPage. The Dialog will be shown and executed. For modal dialogs invoke() blocks until the Dialog is closed. For nonmodal dialogs invoke() returns imediately.

Returns:
true if a nonmodal dialog is started successfully or a modal dialog is closed via the ok-, save- or a similar button. false if a modal dialog is canceld.

stateChangedBase

public void stateChangedBase()
Notify the PageClient and all Subpages of a possible Change in the PageModels by calling PageClient.determineState() and PageClient.stateChanged() on the PageClient and all Subpages. My be repeated by calling setRerunStateChanched().

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

setRerunStateChanched

public void setRerunStateChanched()
Requests another call to PageClient.determineState() and PageClient.stateChanged() if called within one of these methods. It has no effect if called outside these methods.

Since:
1.7.0

closeOK

public void closeOK()
Closes the dialog with exitStatus true.

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

closeCancel

public void closeCancel()
Closes the dialog with exitStatus false.

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

removeWidgetsBase

public void removeWidgetsBase()
Notify the PageClient and all Subpages, that the Widgets are disposed by calling PageClient.removeWidgets() on all Subpages and the PageClient.

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

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.

Returns:
true means it is ok to close the Shell false means do not close the Shell

isVisible

public boolean isVisible()
Indicates if the dialog is shown to the user. Use this method to determine if a modeless dialog is open or closed.

Returns:
true if the dialog is visible to the user.

getExitstatus

public boolean getExitstatus()
Returns the exitStatus of the DialogPage.


getErrorCount

public int getErrorCount()
Returns the number of Errors in this dialog including its subpages. This is the count of widgets with errors.

Specified by:
getErrorCount in interface at.spardat.xma.boot.component.IDialog

clearValidationErrorImpl

public void clearValidationErrorImpl(org.eclipse.swt.widgets.Widget widget)
Removes a validation error for a particular widget. This method is for internal use only. Calling it causes undefined behaviour!

Specified by:
clearValidationErrorImpl in interface IDialogPage
Overrides:
clearValidationErrorImpl in class PageClient
Parameters:
widget - the widget where to clear the error state.

setValidationErrorImpl

public void setValidationErrorImpl(org.eclipse.swt.widgets.Widget widget,
                                   java.lang.String errorText)
Sets a validation error for a particular widget. This method is for internal use only. Calling it causes undefined behaviour!

Specified by:
setValidationErrorImpl in interface IDialogPage
Parameters:
widget - the widget where the error occured
errorText - indicates the error

hasValidationError

public boolean hasValidationError(org.eclipse.swt.widgets.Widget widget)
Determines if a validation error currently exists for a given widget. Note that validation is disabled automatically for readonly widgets, so readonly widgets never have validation errors.

Specified by:
hasValidationError in interface IDialogPage
Overrides:
hasValidationError in class PageClient
Parameters:
widget - to search for validation errors
Returns:
true if the validator reported an error for the given widget. false otherwise.

updateErrorStatus

public void updateErrorStatus(org.eclipse.swt.widgets.Widget current)
Updates the error message in the StatusBar. If there are more then one error, the error belonging to the widget which currently owns the focus is displayed. If there is no error on the PageClient, the error message is cleared.

Specified by:
updateErrorStatus in interface at.spardat.xma.boot.component.IDialog
Parameters:
current - the Widget which currently owns the focus.

clearError

public void clearError(org.eclipse.swt.widgets.Widget widget)
Removes the error for the given widget.

Specified by:
clearError in interface at.spardat.xma.boot.component.IDialog
Overrides:
clearError in class PageClient
Parameters:
widget - the widget where to clear the error state.

setError

public void setError(org.eclipse.swt.widgets.Widget widget,
                     java.lang.String errorText)
Sets an error for the given widget. The error is shown in the status line. Only one error can be shown at a time. The precedence rules are:
1) the validation error of the widget owning the focus
2) the error of the widget owning the focus set with this method
3) the error of the next widget in the tab order containing an error
4) the error set for the null-widget.

Specified by:
setError in interface at.spardat.xma.boot.component.IDialog
Parameters:
widget - the widget where the error occured. Null is allowd if the error can not be associated with a widget.
errorText - indicates the error

overrideErrorsFromModel

public void overrideErrorsFromModel()
Resets all widgets containing values with validation errors to their last known valid value from the model.

Specified by:
overrideErrorsFromModel in interface IDialogPage

setWarning

public void setWarning(org.eclipse.swt.widgets.Widget widget,
                       java.lang.String warningText)
Sets an warning for the given widget. The warning is shown in the status line, if currently no error has to be shown. Only one error or warning can be shown at a time. The precedence rules are:
1) any error of any widget (see setError(Widget, String)
2) the warning of the widget owning the focus
3) the warning of the next widget in the tab order containing a warning
4) the warning set for the null-widget.

Specified by:
setWarning in interface IDialogPage
Parameters:
widget - the widget the warning is associated with. Null is allowed.
warningText - indicates the warning

clearWarning

public void clearWarning(org.eclipse.swt.widgets.Widget widget)
Removes the warning for the given widget.

Specified by:
clearWarning in interface IDialogPage
Parameters:
widget - the widget where to clear the warning.

setInfo

public void setInfo(org.eclipse.swt.widgets.Widget widget,
                    java.lang.String infoText)
Sets an info for the given widget. The info is shown in the status line, if currently no error or warning has to be shown. Only one error, warning or info can be shown at a time. The precedence rules are:
1) any error or warning of any widget (see setWarning(Widget, String)
2) the info of the widget owning the focus
3) the info of the next widget in the tab order containing a warning
4) the info set for the null-widget.

Specified by:
setInfo in interface IDialogPage
Parameters:
widget - the widget the info is associated with. Null is allowed.
infoText - indicates the info

clearInfo

public void clearInfo(org.eclipse.swt.widgets.Widget widget)
Removes the info for the given widget.

Specified by:
clearInfo in interface IDialogPage
Parameters:
widget - the widget where to clear the info.