net.xoetrope.swt
Class XSwtPage

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by net.xoetrope.swt.XSwtPage
All Implemented Interfaces:
XExceptionHandler, PageSupport, org.eclipse.swt.graphics.Drawable

public class XSwtPage
extends org.eclipse.swt.widgets.Composite

    
implements XExceptionHandler, PageSupport

    

A basic unit for building applications. XPage integrates with page and event management facilities provided by XUI. The page also provides a number of methods to help control the page lifecycle.

Pages can be displayed using the XPageDisplay interface implemented by XApplet and invoked by the XPage manager. Pages can be constructed directly or via the XuiBuilder.

Copyright (c) Xoetrope Ltd., 2002-2004

License: see license.txt

$Revision: 1.8 $


Field Summary
protected  WidgetAdapter adapter
           
protected  XStyleFactory componentFactory
           
protected  XProject currentProject
           
protected  XPageHelper pageHelper
           
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
XSwtPage()
          Constructs an empty page
 
Method Summary
 int accumulateMessages(boolean start, int level)
          informs the handler when a page validation is starting or stopping.
 void addActionHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for action events
 void addBinding(XDataBinding b)
          Add a binding of a component to the data model.
 void addFocusHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for focus events
 void addHandler(java.lang.Object comp, long eventType, java.lang.String methodName)
          Adds an event handler.
 void addHandler(java.lang.Object srcObj, java.lang.String methodName, java.lang.String adderMethod, java.lang.String listenerInterface, long eventMask, java.lang.Object listener)
          Adds a handler for action events
 void addItemHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for item events
 void addKeyHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for key events
 void addListener(java.lang.Object comp, java.lang.String listenerName, java.lang.String argType, java.lang.Object listener)
          Adds a listener for an event type.
 void addMenuHandler(java.lang.Object menuItem, java.lang.String methodName)
          Adds a handler for action events
 void addMouseHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for mouse events
 void addMouseMotionHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for mouse motion events
 void addTextHandler(java.lang.Object comp, java.lang.String methodName)
          Adds a handler for text events
 XValidator addValidation(java.lang.Object comp, java.lang.String validationName)
          Adds a validation to this page.
 XValidator addValidation(java.lang.Object comp, java.lang.String validationName, java.lang.String method)
          Adds a validation to this page.
 XValidator addValidation(java.lang.Object comp, java.lang.String validationName, java.lang.String method, int mask, XmlElement ele)
          Adds a validation to this page.
protected  void checkSubclass()
           
 int checkValidations()
          Check all validations for this page.
 void clearValidations()
          Reset/removes all validations
 void doLayout()
          Layout the page
 java.lang.Object evaluateAttribute(java.lang.String attribValue)
          Evaluates an attribute value.
 java.lang.String evaluatePath(java.lang.String path)
          Evaluates a path (potentially) containing a method call
 java.lang.Object findComponent(java.lang.Object container, java.lang.String name)
          Find a named component in the container.
 java.lang.Object findComponent(java.lang.String name)
          Find a named component in the container.
 java.lang.Object getAttribute(java.lang.String attribName)
          Gets an attribute value
 java.lang.Object getAttribute(java.lang.String attribName, java.lang.String compName)
          Gets an attribute value
 XDataBinding getBinding(java.lang.Object targetComp)
          Find the data binding associated with a component
 XDataBinding getBinding(java.lang.String targetPath)
          Find the data binding associated with a data source path
 java.util.Vector getBindings()
          Get the data bindings for the page
 XComponentFactory getComponentFactory()
          Get the component factory instance being used by this page.
 java.lang.String getComponentName(java.lang.Object comp)
          Get a name for a component.
 java.util.EventObject getCurrentEvent()
          Get the current event
 java.lang.Object getEventAttribute(java.lang.Object c, java.lang.String attribName)
          Gets an attribute value
 XuiEventHandler getEventHandler()
          Get the current event handler
 java.lang.String getName()
          Get the name of the page
 java.lang.Object getOwner()
          Get the parent
 java.awt.Dimension getPageSize()
          Get the size
 int getStatus()
          Get the page status
 XValidationHandler getValidationHandler()
          Gets the validation handler
 boolean handleEventHandlerException(XProject project, java.lang.Object container, java.lang.Throwable error)
          Handle an exception during the invocation of a page's event handler.
 boolean handleException(java.lang.Object comp, java.lang.Exception ex, java.lang.Object validator)
          A method called when a validation exeption has been trapped.
 boolean isFocusChangeSuppressed()
          Check the focus change status
 void pageActivated()
          A method called once the page has been created and initialized but just prior to display
 void pageCreated()
          A method called once the page has been created but not yet initialized.
 void pageDeactivated()
          Called when the page is about to loose scope and be hidden.
 void removeBinding(XDataBinding b)
          Remove a binding of a component to the data model.
 void saveBoundComponentValues()
          Save the component values to the model
 void setAttribute(java.lang.String attribName, java.lang.String compName, java.lang.Object attribValue)
          Set a named attributes.
 void setBackground(java.awt.Color c)
          Set the background color
 void setClearPage(boolean value)
          Modify the clearPage flag.
 void setComponentFactory(XStyleFactory factory)
          Set the component factory instance being used by this page when constructing new pages.
 void setEventHandler(XuiEventHandler eh)
          Set the current event handler
 void setExceptionHandler(XExceptionHandler eh)
          Set the validation exception handler called when a validation exception is trapped
 void setLayout(java.lang.Object obj)
          Set the layout manager
 void setName(java.lang.String name)
          Set the name of the component
 void setStatus(int newStatus)
          Set the page status
 void setValidationFactory(java.lang.String vf)
          Sets the factory used to create XValidator objects.
 void setValidationFactory(XValidationFactory vf)
          Sets the factory used to create XValidator objects
 void showComponents(java.lang.Object container, boolean visible, int recursionLevel)
          Show or hide the components.
 void showHandCursor(java.lang.Object comp)
          Show the hand/pointer cursor for this component
 void showMessage(java.lang.Object parent, java.lang.String title, java.lang.String msg)
          Shows a modal message box
 void showMessage(java.lang.String title, java.lang.String msg)
          Shows a modal message box
 java.lang.String stripAttributeValues(java.lang.String path)
          Remove the attribute paths from a path e.g.
 java.lang.String translate(java.lang.String key)
          Get the translatation refernced by the key
 void updateBinding(XDataBinding binding)
          Update the bound model node for the binding.
 void updateBindings()
          Iterate all of the bindings in the page to reflect the model state.
 void updateBoundComponentValues()
          Update the UI with values from the model
 void validate()
          Validates this container and all of its subcomponents.
 int validationHandler()
          Invoke the validators for the last event.
 boolean wasMouseClicked()
          A utility method used to determine if the last event corrseponds to a mouse click.
 boolean wasMouseDoubleClicked()
          A utility method used to determine if the last event corrseponds to a mouse double click.
 boolean wasMouseRightClicked()
          A utility method used to determine if the last event corrseponds to a mouse right click.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.xoetrope.xui.PageSupport
setLocation, setSize, setVisible
 

Field Detail

componentFactory

protected XStyleFactory componentFactory

currentProject

protected XProject currentProject

adapter

protected WidgetAdapter adapter

pageHelper

protected XPageHelper pageHelper
Constructor Detail

XSwtPage

public XSwtPage()
Constructs an empty page

Method Detail

checkSubclass

protected void checkSubclass()
Overrides:
checkSubclass in class org.eclipse.swt.widgets.Composite

setBackground

public void setBackground(java.awt.Color c)
Set the background color

Specified by:
setBackground in interface PageSupport
Parameters:
c - The color

doLayout

public void doLayout()
Layout the page

Specified by:
doLayout in interface PageSupport

setLayout

public void setLayout(java.lang.Object obj)
Set the layout manager

Specified by:
setLayout in interface PageSupport
Parameters:
obj - the layout manager instance

setClearPage

public void setClearPage(boolean value)
Modify the clearPage flag. This flag determines if the default behaviour is used to update the page whereby the background is first erased and then the content painted or alternatively if the erase is suppressed.

Specified by:
setClearPage in interface PageSupport
Parameters:
value -

showComponents

public void showComponents(java.lang.Object container,
                           boolean visible,
                           int recursionLevel)
Show or hide the components. In the AWT the heavyweight peers are created visible and paint themselves once created and therefore cause problems for page transitions.

Specified by:
showComponents in interface PageSupport
Parameters:
container - the container
visible - the
recursionLevel - a counter of the recursion level

findComponent

public java.lang.Object findComponent(java.lang.String name)
Find a named component in the container. Any child containers of the container will be searched recursively till the named component is found. The first component with a matching name will be returned.

Specified by:
findComponent in interface PageSupport
Parameters:
name - the name to locate
Returns:
the component ornull if nothing is found

findComponent

public java.lang.Object findComponent(java.lang.Object container,
                                      java.lang.String name)
Find a named component in the container. Any child containers of the container will be searched recursively till the named component is found. The first component with a matching name will be returned.

Specified by:
findComponent in interface PageSupport
Parameters:
container - the page or container to search
name - the name to locate
Returns:
the component or null if nothing is found

getName

public java.lang.String getName()
Get the name of the page

Specified by:
getName in interface PageSupport
Returns:
the name

setName

public void setName(java.lang.String name)
Set the name of the component

Specified by:
setName in interface PageSupport
Parameters:
name - the new name for the page

setExceptionHandler

public void setExceptionHandler(XExceptionHandler eh)
Set the validation exception handler called when a validation exception is trapped

Specified by:
setExceptionHandler in interface PageSupport
Parameters:
eh - the new event handler

handleException

public boolean handleException(java.lang.Object comp,
                               java.lang.Exception ex,
                               java.lang.Object validator)
A method called when a validation exeption has been trapped.

Specified by:
handleException in interface XExceptionHandler
Specified by:
handleException in interface PageSupport
Parameters:
comp - Component being validated
ex - The exception caused
validator - The validator being used to validate.
Returns:
true to continue with error validation or false to suppress further validation.

handleEventHandlerException

public boolean handleEventHandlerException(XProject project,
                                           java.lang.Object container,
                                           java.lang.Throwable error)
Handle an exception during the invocation of a page's event handler. The page normally implements this interface and has the first chance at handling the error. Thereafter if false is returned a central (optional) exception handler owned by the project is invoked.

Specified by:
handleEventHandlerException in interface XExceptionHandler
Specified by:
handleEventHandlerException in interface PageSupport
Parameters:
project - the current project
container - the page
error - the exception or error that was thrown
Returns:
true to continue processing, false to stop processing

clearValidations

public void clearValidations()
Reset/removes all validations

Specified by:
clearValidations in interface PageSupport

checkValidations

public int checkValidations()
Check all validations for this page. Typically this method should be invoked prior to a page transition or a critical transaction.

Specified by:
checkValidations in interface PageSupport
Returns:
the maximum error level raised by the validators

accumulateMessages

public int accumulateMessages(boolean start,
                              int level)
informs the handler when a page validation is starting or stopping. Typically when it starts the page will begin to accumulate message which are to be displayed. When the parameter is false the page will usually display the accumulated messages

Specified by:
accumulateMessages in interface XExceptionHandler
Specified by:
accumulateMessages in interface PageSupport
Parameters:
start - boolean to indicate whether the accumulation is started or stopped.
level - int which indicates the most serious level of error encountered
Returns:
the new level which might be set to zero if a confirm dialog is displayed

addValidation

public XValidator addValidation(java.lang.Object comp,
                                java.lang.String validationName,
                                java.lang.String method,
                                int mask,
                                XmlElement ele)
Adds a validation to this page.

Specified by:
addValidation in interface PageSupport
Parameters:
comp - the component being validated
validationName - the name of the validation in the validation file
method - the method used to get the component's value if any
mask - the event mask used to filter the events that trigger the validation
ele - the XML element which is declared in the page
Returns:
the new and initialized XValidator

addValidation

public XValidator addValidation(java.lang.Object comp,
                                java.lang.String validationName,
                                java.lang.String method)
Adds a validation to this page. It is assumed that the validation will be invoked in response to FocusEvent.FOCUS_LOST events

Specified by:
addValidation in interface PageSupport
Parameters:
comp - the component being validated
validationName - the name of the validation in the validation file
method - the method used to get the component's value if any
Returns:
the new and initialized XValidator

addValidation

public XValidator addValidation(java.lang.Object comp,
                                java.lang.String validationName)
Adds a validation to this page. It is assumed that the validation will be invoked in response to FocusEvent.FOCUS_LOST events

Specified by:
addValidation in interface PageSupport
Parameters:
comp - the component being validated
validationName - the name of the validation in the validation file
Returns:
the new and initialized XValidator

setValidationFactory

public void setValidationFactory(XValidationFactory vf)
Sets the factory used to create XValidator objects

Specified by:
setValidationFactory in interface PageSupport
Parameters:
vf -

setValidationFactory

public void setValidationFactory(java.lang.String vf)
Sets the factory used to create XValidator objects. It is assumed that the file can be found on the classpath and that it can be read as UTF8 (by default)

Specified by:
setValidationFactory in interface PageSupport
Parameters:
vf - the filename

getValidationHandler

public XValidationHandler getValidationHandler()
Gets the validation handler

Specified by:
getValidationHandler in interface PageSupport
Returns:
the validation handler

validationHandler

public int validationHandler()
Invoke the validators for the last event. Multiple validations are checked in the order in which they were added.

Specified by:
validationHandler in interface PageSupport
Returns:
the maximum level returned by the validators

getEventHandler

public XuiEventHandler getEventHandler()
Get the current event handler

Specified by:
getEventHandler in interface PageSupport
Returns:
the event handler

setEventHandler

public void setEventHandler(XuiEventHandler eh)
Set the current event handler

Specified by:
setEventHandler in interface PageSupport
Parameters:
eh - The event handler

getCurrentEvent

public java.util.EventObject getCurrentEvent()
Get the current event

Specified by:
getCurrentEvent in interface PageSupport
Returns:
the AWTEvent that was last triggered

addListener

public void addListener(java.lang.Object comp,
                        java.lang.String listenerName,
                        java.lang.String argType,
                        java.lang.Object listener)
Adds a listener for an event type. This method should not normally be called by an application

Specified by:
addListener in interface PageSupport
Parameters:
comp - the component that fires events
listenerName - the name of the listener interface
argType - the listener arguments
listener - the listener implementation

addHandler

public void addHandler(java.lang.Object comp,
                       long eventType,
                       java.lang.String methodName)
                throws java.lang.ClassNotFoundException,
                       java.lang.NoSuchMethodException
Adds an event handler. A specific handler such as the addActionHandler should be used instead of calling this method

Specified by:
addHandler in interface PageSupport
Parameters:
comp - the component that fires the event
eventType - the event ID/mask
methodName - the method to be invoked in response to the object
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException

addHandler

public void addHandler(java.lang.Object srcObj,
                       java.lang.String methodName,
                       java.lang.String adderMethod,
                       java.lang.String listenerInterface,
                       long eventMask,
                       java.lang.Object listener)
Adds a handler for action events

Specified by:
addHandler in interface PageSupport
Parameters:
srcObj - the menu item that fires the events
methodName - the method to be invoked in response to the action event
adderMethod - the adder method name e.g. addActionListener
listenerInterface - the listener interface e.g. java.awt.event.ActionListener
eventMask - the event mask e.g. AWTEvent.ACTION_EVENT_MASK
listener - the listener implementation, usually the page's this pointer
See Also:
ActionListener, ActionEvent

isFocusChangeSuppressed

public boolean isFocusChangeSuppressed()
Check the focus change status

Specified by:
isFocusChangeSuppressed in interface PageSupport
Returns:
true if the focus change events are being suppressed.

addMenuHandler

public void addMenuHandler(java.lang.Object menuItem,
                           java.lang.String methodName)
Adds a handler for action events

Specified by:
addMenuHandler in interface PageSupport
Parameters:
menuItem - the component that fires the event
methodName - the method to be invoked in response to the action event
See Also:
ActionListener, ActionEvent

addActionHandler

public void addActionHandler(java.lang.Object comp,
                             java.lang.String methodName)
Adds a handler for action events

Specified by:
addActionHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the action event
See Also:
ActionListener, ActionEvent

addFocusHandler

public void addFocusHandler(java.lang.Object comp,
                            java.lang.String methodName)
Adds a handler for focus events

Specified by:
addFocusHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the focus event
See Also:
FocusListener, FocusEvent

addTextHandler

public void addTextHandler(java.lang.Object comp,
                           java.lang.String methodName)
Adds a handler for text events

Specified by:
addTextHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the text event
See Also:
TextListener, TextEvent

addItemHandler

public void addItemHandler(java.lang.Object comp,
                           java.lang.String methodName)
Adds a handler for item events

Specified by:
addItemHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the item event
See Also:
ItemListener, ItemEvent

addKeyHandler

public void addKeyHandler(java.lang.Object comp,
                          java.lang.String methodName)
Adds a handler for key events

Specified by:
addKeyHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the key event
See Also:
KeyListener, KeyEvent

addMouseHandler

public void addMouseHandler(java.lang.Object comp,
                            java.lang.String methodName)
Adds a handler for mouse events

Specified by:
addMouseHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the mouse event
See Also:
MouseMotionListener, MouseEvent

addMouseMotionHandler

public void addMouseMotionHandler(java.lang.Object comp,
                                  java.lang.String methodName)
Adds a handler for mouse motion events

Specified by:
addMouseMotionHandler in interface PageSupport
Parameters:
comp - the component that fires the events
methodName - the method to be invoked in response to the mouse event
See Also:
MouseMotionListener, MouseEvent

wasMouseClicked

public boolean wasMouseClicked()
A utility method used to determine if the last event corrseponds to a mouse click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Specified by:
wasMouseClicked in interface PageSupport
Returns:
true if the mouse was clicked

wasMouseDoubleClicked

public boolean wasMouseDoubleClicked()
A utility method used to determine if the last event corrseponds to a mouse double click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Specified by:
wasMouseDoubleClicked in interface PageSupport
Returns:
true if the mouse was double clicked

wasMouseRightClicked

public boolean wasMouseRightClicked()
A utility method used to determine if the last event corrseponds to a mouse right click. The notion of a click is extended by assuming the a mouse press and release within a single component constitutes a click even if not at the same coordinate. A MouseEvent.MOUSE_CLICKED is only triggered when the press and release are at the same location and this is often inadequate for end-user interaction.

Specified by:
wasMouseRightClicked in interface PageSupport
Returns:
true if the mouse was right clicked

showHandCursor

public void showHandCursor(java.lang.Object comp)
Show the hand/pointer cursor for this component

Specified by:
showHandCursor in interface PageSupport
Parameters:
comp - the component

getBindings

public java.util.Vector getBindings()
Description copied from interface: PageSupport
Get the data bindings for the page

Specified by:
getBindings in interface PageSupport
Returns:
the bindings

addBinding

public void addBinding(XDataBinding b)
Add a binding of a component to the data model. If the page has already been activated this method will update the binding automatically.

Specified by:
addBinding in interface PageSupport
Parameters:
b - the binding

removeBinding

public void removeBinding(XDataBinding b)
Remove a binding of a component to the data model.

Specified by:
removeBinding in interface PageSupport
Parameters:
b - the binding

updateBindings

public void updateBindings()
Iterate all of the bindings in the page to reflect the model state.

Specified by:
updateBindings in interface PageSupport

updateBinding

public void updateBinding(XDataBinding binding)
Update the bound model node for the binding. First the output path is reevaluated and then updated by setting the output node. Then the source path is reevaluated and set. Evaluation of the paths allows derived classes to dynamically modify the bindings. Some bindings may save the selection or state information to the output node and subsequently use it to restore the component state. This method does not alter the data held by the bound model nodes. To actually save the data use saveBoundComponentValues and to update the UI use updateBoundComponentValues.

Specified by:
updateBinding in interface PageSupport
Parameters:
binding - the data binding to update

updateBoundComponentValues

public void updateBoundComponentValues()
Update the UI with values from the model

Specified by:
updateBoundComponentValues in interface PageSupport

saveBoundComponentValues

public void saveBoundComponentValues()
Save the component values to the model

Specified by:
saveBoundComponentValues in interface PageSupport

getBinding

public XDataBinding getBinding(java.lang.Object targetComp)
Find the data binding associated with a component

Specified by:
getBinding in interface PageSupport
Parameters:
targetComp - the component whose binding is required
Returns:
the binding or null if no binding is found

getBinding

public XDataBinding getBinding(java.lang.String targetPath)
Find the data binding associated with a data source path

Specified by:
getBinding in interface PageSupport
Parameters:
targetPath - the path to the bound model
Returns:
the binding or null if no binding is found

getStatus

public int getStatus()
Get the page status

Specified by:
getStatus in interface PageSupport
Returns:
the current status

setStatus

public void setStatus(int newStatus)
Set the page status

Specified by:
setStatus in interface PageSupport
Parameters:
newStatus - the new page status

pageActivated

public void pageActivated()
A method called once the page has been created and initialized but just prior to display

Specified by:
pageActivated in interface PageSupport

pageCreated

public void pageCreated()
A method called once the page has been created but not yet initialized.

Specified by:
pageCreated in interface PageSupport

pageDeactivated

public void pageDeactivated()
Called when the page is about to loose scope and be hidden.

Specified by:
pageDeactivated in interface PageSupport

setAttribute

public void setAttribute(java.lang.String attribName,
                         java.lang.String compName,
                         java.lang.Object attribValue)

Set a named attributes. The attributes are stored in a hashtable owned by the page. Derived classes may access the hashtable directly but the preferred method of access is the getAttribute method. Attributes are used by the XuiBuilder class for component attributes other than those it handles directly. The attributes can be thought of as component properties or extra data and need not be used directly by the component.

Attributes are stored using a key in the form attribName_compName or just the attribName if compName is null.

Specified by:
setAttribute in interface PageSupport
Parameters:
attribName - the attribute name
compName - the component name or null if it is a page attribute
attribValue - the attribute value
See Also:
getAttribute(java.lang.String)

getAttribute

public java.lang.Object getAttribute(java.lang.String attribName)
Gets an attribute value

Specified by:
getAttribute in interface PageSupport
Parameters:
attribName - the name of the attribute
Returns:
the value

getAttribute

public java.lang.Object getAttribute(java.lang.String attribName,
                                     java.lang.String compName)
Gets an attribute value

Specified by:
getAttribute in interface PageSupport
Parameters:
attribName - the name of the attribute
compName - the component name
Returns:
the value

getComponentName

public java.lang.String getComponentName(java.lang.Object comp)
Get a name for a component. If the component doesn't have one use the component hashcode

Specified by:
getComponentName in interface PageSupport
Parameters:
comp - the component
Returns:
the name

getEventAttribute

public java.lang.Object getEventAttribute(java.lang.Object c,
                                          java.lang.String attribName)
Gets an attribute value

Specified by:
getEventAttribute in interface PageSupport
Parameters:
attribName - the name of the attribute
c - the component/container
Returns:
the value

evaluateAttribute

public java.lang.Object evaluateAttribute(java.lang.String attribValue)
Evaluates an attribute value. An attribute may be a value or a method call. If brackets are part of the value it is assumed that a method call is intended. The method call is indicated by the '$' symbol e.g. ${myMethod()}

Specified by:
evaluateAttribute in interface PageSupport
Parameters:
attribValue - the raw attribute value
Returns:
the evaluated attribute

evaluatePath

public java.lang.String evaluatePath(java.lang.String path)
Evaluates a path (potentially) containing a method call

Specified by:
evaluatePath in interface PageSupport
Parameters:
path - the raw path
Returns:
the evaluated path

stripAttributeValues

public java.lang.String stripAttributeValues(java.lang.String path)
Remove the attribute paths from a path e.g. remove @value=ignore

Specified by:
stripAttributeValues in interface PageSupport
Parameters:
path - the path to strip
Returns:
the stripped path

getComponentFactory

public XComponentFactory getComponentFactory()
Get the component factory instance being used by this page.

Specified by:
getComponentFactory in interface PageSupport
Returns:
the component factory

setComponentFactory

public void setComponentFactory(XStyleFactory factory)
Set the component factory instance being used by this page when constructing new pages.

Specified by:
setComponentFactory in interface PageSupport
Parameters:
factory - the component factory used for component creation

translate

public java.lang.String translate(java.lang.String key)
Description copied from interface: PageSupport
Get the translatation refernced by the key

Specified by:
translate in interface PageSupport
Parameters:
key - the language string lookup key
Returns:
The translated text

showMessage

public void showMessage(java.lang.String title,
                        java.lang.String msg)
Shows a modal message box

Specified by:
showMessage in interface PageSupport
Parameters:
title - the message dialog title
msg - the text of the message

showMessage

public void showMessage(java.lang.Object parent,
                        java.lang.String title,
                        java.lang.String msg)
Shows a modal message box

Specified by:
showMessage in interface PageSupport
Parameters:
parent - the message dialog parent
title - the message dialog title
msg - the text of the message

validate

public void validate()
Description copied from interface: PageSupport
Validates this container and all of its subcomponents.

Specified by:
validate in interface PageSupport

getOwner

public java.lang.Object getOwner()
Get the parent

Specified by:
getOwner in interface PageSupport
Returns:
The owner container

getPageSize

public java.awt.Dimension getPageSize()
Get the size

Specified by:
getPageSize in interface PageSupport
Returns:
The page's dimensions