|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.xoetrope.xui.XPageHelper
public class XPageHelper
A class used by XPage to implement its functionality in a reusable way
Copyright (c) Xoetrope Ltd., 2002-2004
License: see license.txt
$Revision: 1.31 $Field Summary | |
---|---|
WidgetAdapter |
adapter For handling different component packages |
java.util.Hashtable |
attribs Hashtable of named component attributes |
boolean |
clearPage boolean to indicate how to handle repaints of the page |
XStyleFactory |
componentFactory The XComponentFactory being used |
XProject |
currentProject The currently active XProject instance |
protected XDefaultAttributeEvaluator |
evaluator The default attribute expression evaluator |
XuiEventHandler |
eventHandler The XuiEventHandler being used by the XPage |
static java.awt.Cursor |
hand Hand Cursor Object instance |
java.util.Vector |
hiddenComponents Vector of components to be hidden or shown over page transitions |
java.util.Vector |
modelBindings Vector of XDataBinding Objects currently in use by the XPage |
PageSupport |
page The PageSupport being helped |
java.lang.String |
pageName The name of the page |
int |
status Indicates current state of the XPage in itÝs lifecycle |
Constructor Summary | |
---|---|
XPageHelper(PageSupport thePage) Creates a new instance of XPageHelper |
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 pageEle) Adds a validation to this page. |
int |
checkValidations() Check all validations for this page. |
void |
clearValidations() Reset/removes all validations |
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 |
java.lang.Object |
getAttributes() Gets the table of attributes used by this page. |
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() Retrieve the Vector of XDataBinding for the XPage |
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 |
getPageName() Get the name of 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 |
void |
setAttribute(java.lang.String attribName, java.lang.String compName, java.lang.Object attribValue) Set a named attributes. |
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 |
setPageName(java.lang.String name) Get the name of this page |
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) Used to translate strings found in the 'content' attribute of a component declaration and translate it using the localization resource bundles |
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 |
int |
validationHandler(XuiEventHandler eventHandler) 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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.Cursor hand
public XStyleFactory componentFactory
public java.util.Vector modelBindings
public java.util.Vector hiddenComponents
public XuiEventHandler eventHandler
public java.util.Hashtable attribs
public int status
public boolean clearPage
public XProject currentProject
public WidgetAdapter adapter
public PageSupport page
protected XDefaultAttributeEvaluator evaluator
public java.lang.String pageName
Constructor Detail |
---|
public XPageHelper(PageSupport thePage)
thePage
- The XPageHelper to be usedMethod Detail |
---|
public java.lang.String getPageName()
public void setPageName(java.lang.String name)
name
- the page namepublic void setClearPage(boolean value)
value
- boolean to apply to clearPagepublic void showComponents(java.lang.Object container, boolean visible, int recursionLevel)
recursionLevel
- The level to which the components should be showncontainer
- the containervisible
- thepublic java.lang.Object findComponent(java.lang.String name)
name
- the name to locatepublic java.lang.Object findComponent(java.lang.Object container, java.lang.String name)
container
- the page or container to searchname
- the name to locatepublic void setExceptionHandler(XExceptionHandler eh)
eh
- the new event handlerpublic boolean handleException(java.lang.Object comp, java.lang.Exception ex, java.lang.Object validator)
comp
- 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)
project
- the current projectcontainer
- the pageerror
- the exception or error that was thrownpublic void clearValidations()
public int checkValidations()
public int accumulateMessages(boolean start, int level)
start
- boolean to indicate whether the accumulation is started or stopped.level
- int which indicates the most serious level of error encounteredpublic XValidator addValidation(java.lang.Object comp, java.lang.String validationName, java.lang.String method, int mask, XmlElement pageEle)
comp
- 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 validationpageEle
- the XML element which is declared in the pagepublic XValidator addValidation(java.lang.Object comp, java.lang.String validationName, java.lang.String method)
comp
- the component being validatedvalidationName
- the name of the validation in the validation filemethod
- the method used to get the component's value if anypublic XValidator addValidation(java.lang.Object comp, java.lang.String validationName)
comp
- the component being validatedvalidationName
- the name of the validation in the validation filepublic void setValidationFactory(XValidationFactory vf)
vf
- The XValidationFactory to be usedpublic void setValidationFactory(java.lang.String vf)
vf
- the filenamepublic XValidationHandler getValidationHandler()
public int validationHandler(XuiEventHandler eventHandler)
eventHandler
- the current event handler that this handler uses to listen to for events that should trigger validationspublic XuiEventHandler getEventHandler()
public void setEventHandler(XuiEventHandler eh)
eh
- The XuiEventHandler to be usedpublic java.util.EventObject getCurrentEvent()
public void addListener(java.lang.Object comp, java.lang.String listenerName, java.lang.String argType, java.lang.Object listener)
comp
- the component that fires eventslistenerName
- the name of the listener interfaceargType
- the listener argumentslistener
- the listener implementationpublic void addHandler(java.lang.Object comp, long eventType, java.lang.String methodName) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException
comp
- the component that fires the eventeventType
- the event ID/maskmethodName
- the method to be invoked in response to the objectjava.lang.ClassNotFoundException
- throw if the class cannot be foundjava.lang.NoSuchMethodException
- throw if the method cannot be foundpublic boolean isFocusChangeSuppressed()
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)
srcObj
- 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
, ActionEvent
public void addMenuHandler(java.lang.Object menuItem, java.lang.String methodName)
menuItem
- the component that fires the eventmethodName
- the method to be invoked in response to the action eventActionListener
, ActionEvent
public void addActionHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the action eventActionListener
, ActionEvent
public void addFocusHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the focus eventFocusListener
, FocusEvent
public void addTextHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the text eventTextListener
, TextEvent
public void addItemHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the item eventItemListener
, ItemEvent
public void addKeyHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the key eventKeyListener
, KeyEvent
public void addMouseHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the mouse eventMouseMotionListener
, MouseEvent
public void addMouseMotionHandler(java.lang.Object comp, java.lang.String methodName)
comp
- the component that fires the eventsmethodName
- the method to be invoked in response to the mouse eventMouseMotionListener
, MouseEvent
public boolean wasMouseClicked()
public boolean wasMouseDoubleClicked()
public boolean wasMouseRightClicked()
public void showHandCursor(java.lang.Object comp)
comp
- the componentpublic java.util.Vector getBindings()
public void addBinding(XDataBinding b)
b
- the bindingpublic void removeBinding(XDataBinding b)
b
- the bindingpublic void updateBindings()
public void updateBinding(XDataBinding binding)
binding
- The databinding to be updatedpublic void updateBoundComponentValues()
public void saveBoundComponentValues()
public XDataBinding getBinding(java.lang.Object targetComp)
targetComp
- the component whose binding is requiredpublic XDataBinding getBinding(java.lang.String targetPath)
targetPath
- the path to the bound modelpublic int getStatus()
public void setStatus(int newStatus)
newStatus
- the new page statuspublic void pageActivated()
public void pageCreated()
public void pageDeactivated()
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.
attribName
- 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)
attribName
- the name of the attributepublic java.lang.Object getAttribute(java.lang.String attribName, java.lang.String compName)
attribName
- the name of the attributecompName
- the component namepublic java.lang.Object getAttributes()
public java.lang.String getComponentName(java.lang.Object comp)
comp
- the componentpublic java.lang.Object getEventAttribute(java.lang.Object c, java.lang.String attribName)
c
- Not usedattribName
- the name of the attributepublic java.lang.Object evaluateAttribute(java.lang.String attribValue)
attribValue
- the raw attribute valuepublic java.lang.String evaluatePath(java.lang.String path)
path
- the raw pathpublic java.lang.String stripAttributeValues(java.lang.String path)
path
- the path to strippublic XComponentFactory getComponentFactory()
public void setComponentFactory(XStyleFactory factory)
factory
- The XComponentFactory to be usedpublic java.lang.String translate(java.lang.String key)
key
- The key into the ResourceBundlepublic void showMessage(java.lang.String title, java.lang.String msg)
title
- the message dialog titlemsg
- the text of the messagepublic void showMessage(java.lang.Object parent, java.lang.String title, java.lang.String msg)
parent
- the message dialog parenttitle
- the message dialog titlemsg
- the text of the message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |