|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
net.xoetrope.swt.XSwtPage
public class XSwtPage
A basic unit for building applications. XSwtPage 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
|
static java.lang.String |
COOLITEM
Tag for a splitter |
protected XPageHelper |
pageHelper
|
protected XPageManager |
pageMgr
|
protected XProject |
project
|
protected XModel |
rootModel
|
| 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 |
addBinding(XDataBinding b)
Add a binding of a component to the data model. |
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 |
addListener(java.lang.Object comp,
java.lang.String listenerName,
java.lang.String argType,
java.lang.Object listener)
Adds a listener for an event type. |
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()
Suppress the subclassing exception |
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 |
getExtension()
Get the file extension of this page. |
java.lang.String |
getName()
Get the name of the page |
java.lang.Object |
getOwner()
Get the parent |
java.awt.Dimension |
getPageSize()
Get the size |
XProject |
getProject()
Get the current project, the project that owns this page |
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 |
int |
setAttribute(java.lang.String attribName,
java.lang.Object attribValue)
Set one or more attributes of the component. |
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 |
setExtension(java.lang.String ext)
Get the file extension of this page |
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(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. remove |
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()
Validate |
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 |
|---|
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, 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, getBackgroundImage, 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, setBackgroundImage, 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 |
|---|
public static final java.lang.String COOLITEM
protected XStyleFactory componentFactory
protected WidgetAdapter adapter
protected XPageHelper pageHelper
protected XProject project
protected XPageManager pageMgr
protected XModel rootModel
| Constructor Detail |
|---|
public XSwtPage()
| Method Detail |
|---|
protected void checkSubclass()
checkSubclass in class org.eclipse.swt.widgets.Compositepublic void setBackground(java.awt.Color c)
setBackground in interface PageSupportc - AWT colorpublic void doLayout()
doLayout in interface PageSupportpublic void setLayout(java.lang.Object obj)
setLayout in interface PageSupportobj - the layout manager instancepublic void setClearPage(boolean value)
setClearPage in interface PageSupportvalue -
public void showComponents(java.lang.Object container,
boolean visible,
int recursionLevel)
showComponents in interface PageSupportcontainer - the containervisible - the visibility of the componentsrecursionLevel - a counter of the recursion levelpublic java.lang.Object findComponent(java.lang.String name)
findComponent in interface PageSupportname - the name to locate
public java.lang.Object findComponent(java.lang.Object container,
java.lang.String name)
findComponent in interface PageSupportcontainer - the page or container to searchname - the name to locate
public java.lang.String getName()
getName in interface PageSupportpublic void setName(java.lang.String name)
setName in interface PageSupportname - the new name for the pagepublic java.lang.String getExtension()
getExtension in interface PageSupportpublic void setExtension(java.lang.String ext)
setExtension in interface PageSupportext - the page file extensionpublic void setExceptionHandler(XExceptionHandler eh)
setExceptionHandler in interface PageSupporteh - the new event handler
public boolean handleException(java.lang.Object comp,
java.lang.Exception ex,
java.lang.Object validator)
handleException in interface XExceptionHandlerhandleException in interface PageSupportcomp - Component being validatedex - The exception causedvalidator - The validator being used to validate.
public boolean handleEventHandlerException(XProject project,
java.lang.Object container,
java.lang.Throwable error)
handleEventHandlerException in interface XExceptionHandlerhandleEventHandlerException in interface PageSupportproject - the current projectcontainer - the pageerror - the exception or error that was thrown
public void clearValidations()
clearValidations in interface PageSupportpublic int checkValidations()
checkValidations in interface PageSupport
public int accumulateMessages(boolean start,
int level)
accumulateMessages in interface XExceptionHandleraccumulateMessages in interface PageSupportstart - boolean to indicate whether the accumulation is started or
stopped.level - int which indicates the most serious level of error encountered
public XValidator addValidation(java.lang.Object comp,
java.lang.String validationName,
java.lang.String method,
int mask,
XmlElement ele)
addValidation in interface PageSupportcomp - the component being validatedvalidationName - the name of the validation in the validation filemethod - the method used to get the component's value if anymask - the event mask used to filter the events that trigger the
validationele - the XML element which is declared in the page
public XValidator addValidation(java.lang.Object comp,
java.lang.String validationName,
java.lang.String method)
addValidation in interface PageSupportcomp - the component being validatedvalidationName - the name of the validation in the validation filemethod - the method used to get the component's value if any
public XValidator addValidation(java.lang.Object comp,
java.lang.String validationName)
addValidation in interface PageSupportcomp - the component being validatedvalidationName - the name of the validation in the validation file
public void setValidationFactory(XValidationFactory vf)
setValidationFactory in interface PageSupportvf - public XValidationHandler getValidationHandler()
getValidationHandler in interface PageSupportpublic int validationHandler()
validationHandler in interface PageSupportpublic XuiEventHandler getEventHandler()
getEventHandler in interface PageSupportpublic void setEventHandler(XuiEventHandler eh)
setEventHandler in interface PageSupporteh - the xuieventhandlerpublic java.util.EventObject getCurrentEvent()
getCurrentEvent in interface PageSupport
public void addListener(java.lang.Object comp,
java.lang.String listenerName,
java.lang.String argType,
java.lang.Object listener)
addListener in interface PageSupportcomp - the component that fires eventslistenerName - the name of the listener interfaceargType - the listener argumentslistener - the listener implementation
public void addHandler(java.lang.Object comp,
long eventType,
java.lang.String methodName)
throws java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException
addHandler in interface PageSupportcomp - the component that fires the eventeventType - the event ID/maskmethodName - the method to be invoked in response to the object
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
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)
addHandler in interface PageSupportsrcObj - the menu item that fires the eventsmethodName - the method to be invoked in response to the action eventadderMethod - the adder method name e.g. addActionListenerlistenerInterface - the listener interface e.g. java.awt.event.ActionListenereventMask - the event mask e.g. AWTEvent.ACTION_EVENT_MASKlistener - the listener implementation, usually the page's this pointerActionListener,
ActionEventpublic boolean isFocusChangeSuppressed()
isFocusChangeSuppressed in interface PageSupportpublic boolean wasMouseClicked()
wasMouseClicked in interface PageSupportpublic boolean wasMouseDoubleClicked()
wasMouseDoubleClicked in interface PageSupportpublic boolean wasMouseRightClicked()
wasMouseRightClicked in interface PageSupportpublic void showHandCursor(java.lang.Object comp)
showHandCursor in interface PageSupportcomp - the componentpublic java.util.Vector getBindings()
PageSupport
getBindings in interface PageSupportpublic void addBinding(XDataBinding b)
addBinding in interface PageSupportb - the bindingpublic void removeBinding(XDataBinding b)
removeBinding in interface PageSupportb - the bindingpublic void updateBindings()
updateBindings in interface PageSupportpublic void updateBinding(XDataBinding binding)
updateBinding in interface PageSupportbinding - the data binding to updatepublic void updateBoundComponentValues()
updateBoundComponentValues in interface PageSupportpublic void saveBoundComponentValues()
saveBoundComponentValues in interface PageSupportpublic XDataBinding getBinding(java.lang.Object targetComp)
getBinding in interface PageSupporttargetComp - the component whose binding is required
public XDataBinding getBinding(java.lang.String targetPath)
getBinding in interface PageSupporttargetPath - the path to the bound model
public int getStatus()
getStatus in interface PageSupportpublic void setStatus(int newStatus)
setStatus in interface PageSupportnewStatus - the new page statuspublic void pageActivated()
pageActivated in interface PageSupportpublic void pageCreated()
pageCreated in interface PageSupportpublic void pageDeactivated()
pageDeactivated in interface PageSupport
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.
setAttribute in interface PageSupportattribName - the attribute namecompName - the component name or null if it is a page attributeattribValue - the attribute valuegetAttribute(java.lang.String)public java.lang.Object getAttribute(java.lang.String attribName)
getAttribute in interface PageSupportattribName - the name of the attribute
public java.lang.Object getAttribute(java.lang.String attribName,
java.lang.String compName)
getAttribute in interface PageSupportattribName - the name of the attributecompName - the component name
public java.lang.String getComponentName(java.lang.Object comp)
getComponentName in interface PageSupportcomp - the component
public java.lang.Object getEventAttribute(java.lang.Object c,
java.lang.String attribName)
getEventAttribute in interface PageSupportattribName - the name of the attributec - the component/container
public java.lang.Object evaluateAttribute(java.lang.String attribValue)
evaluateAttribute in interface PageSupportattribValue - the raw attribute value
public java.lang.String evaluatePath(java.lang.String path)
evaluatePath in interface PageSupportpath - the raw path
public java.lang.String stripAttributeValues(java.lang.String path)
stripAttributeValues in interface PageSupportpath - the path to strip
public XComponentFactory getComponentFactory()
getComponentFactory in interface PageSupportpublic void setComponentFactory(XStyleFactory factory)
setComponentFactory in interface PageSupportfactory - the component factory used for component creationpublic java.lang.String translate(java.lang.String key)
PageSupport
translate in interface PageSupportkey - the language string lookup key
public void showMessage(java.lang.String title,
java.lang.String msg)
showMessage in interface PageSupporttitle - the message dialog titlemsg - the text of the message
public void showMessage(java.lang.Object parent,
java.lang.String title,
java.lang.String msg)
showMessage in interface PageSupportparent - the message dialog parenttitle - the message dialog titlemsg - the text of the messagepublic void validate()
validate in interface PageSupportpublic java.lang.Object getOwner()
getOwner in interface PageSupportpublic java.awt.Dimension getPageSize()
getPageSize in interface PageSupport
public int setAttribute(java.lang.String attribName,
java.lang.Object attribValue)
setAttribute in interface XAttributedComponentattribName - the name of the attributeattribValue - the value of the attribute
public XProject getProject()
getProject in interface PageSupport
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||