|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.appserver.WOElement
com.webobjects.appserver.WOComponent
er.ajax.AjaxComponent
er.ajax.AjaxModalDialog
public class AjaxModalDialog
AjaxModalDialog is a modal dialog window based on ModalBox (see below for link). It differs from AjaxModalContainer in that it handles submitting forms and updating the container contents. It also looks more like an OS X modal dialog if you consider that to be a benefit.
The AjaxModalDialog is not rendered where it is located in your page. Because of this, it should not be physically nested in a form if it uses form input (needs a form), as it will be rendered outside of the form. If you want to have such a dialog, place the AjaxModalDialog outside of the form and use an AjaxModalDialogOpener in the form.
The links shown to open the dialog can come from two sources:
The contents for the modal dialog can come from four sources:
To cause the dialog to be closed in an Ajax action method, use this:
AjaxModalDialog.close(context());
To cause the contents of the dialog to be updated in an Ajax action method, use this:
AjaxModalDialog.update(context());
The modal dialog is opened by calling a JavaScript function. While this is normally done from an onclick
handler, you can call it directly. The function name is openAMD_
openAMD_MyDialogId();
AjaxModalDialogOpener
,
Modalbox Page,
Google Group,
Serialized FormBindings | |
action | action method returning the contents of the dialog box |
pageName | name of WOComponent for the contents of the dialog box |
label | the text for the link that opens the dialog box |
title | Title to be displayed in the ModalBox window header, also used as title attribute of link opening dialog |
linkTitle | Title to be used as title attribute of link opening dialog, title is used if this is not present |
width | integer Width in pixels, use -1 for auto-width |
height | integer Height in pixels, use -1 for auto-height. When set Modalbox will operate in 'fixed-height' mode. |
centerVertically | optional, if true the dialog is centered vertically on the page instead of appearing at the top |
open | if true, the container is rendered already opened, the default is false |
showOpener | if false, no HTML is generated for the link, button etc. to open this dialog, it can only be opened from
custom JavaScript (see below). The default is true |
enabled | if false, nothing is rendered for this component. This can be used instead of wrapping this in a WOConditional.
The default is true. |
ignoreNesting | optional, if true and this dialog is nested inside another, no warning will be output |
onOpen | server side method that runs before the dialog is opened, the return value is discarded |
onClose | server side method that runs before the dialog is closed, the return value is discarded.
This will be executed if the page is reloaded, but not if the user navigates elsewhere. |
closeUpdateContainerID | the update container to refresh when onClose is called |
onCloseBeforeUpdate | if the given function returns true, the update container named in closeUpdateContainerID
is updated. This is to allow conditional updating, e.g. not updating when the dialog is simply dismissed. |
clickOnReturnId | optional, ID of clickable HTML element to click when the Return key is pressed. This is ignored
if a clickable element has the focus |
clickOnEscId | optional, ID of clickable HTML element to click when the Esc key is pressed. This is ignored
if a clickable element has the focus but overrides the locked setting |
id | HTML id for the link activating the modal dialog |
class | CSS class for the link activating the modal dialog |
style | CSS style for the link activating the modal dialog |
overlayClose | true | false Close modal box by clicking on overlay. Default is true. |
locked | if true, suppresses the close window link, prevents Esc key and overlay from closing dialog. Default is false,
true implies overlayClose false. If clickOnEscId is bound, this allows Esc to do something regardless of the locked binding |
method | get | post. Method of passing variables to a server. Default is 'get'. |
params | {} Collection of parameters to pass on AJAX request. Should be URL-encoded. See PassingFormValues for details. |
loadingString | string The message to show during loading. Default is "Please wait. Loading...". |
closeString | Defines title attribute for close window link. Default is "Close window". |
closeValue | Defines the string for close link in the header. Default is '×' |
overlayOpacity | Overlay opacity. Must be between 0-1. Default is .65. |
overlayDuration | Overlay fade in/out duration in seconds. |
slideDownDuration | Modalbox appear slide down effect in seconds. |
slideUpDuration | Modalbox hiding slide up effect in seconds. |
resizeDuration | Modalbox resize duration in seconds. |
inactiveFade | true | false, Toggles Modalbox window fade on inactive state. |
transitions | true | false, Toggles transition effects. Transitions are enabled by default. |
autoFocusing | true | false, Toggles auto-focusing for form elements. Disable it for long text pages. Add the class MB_notFocusable to
any inputs you want excluded from focusing. |
beforeLoad | client side method, fires right before loading contents into the ModalBox. If the callback function returns false, content loading will skipped. This can be used for redirecting user to another MB-page for authorization purposes for example. |
afterLoad | client side method, fires after loading content into the ModalBox (i.e. after showing or updating existing window). |
beforeHide | client side method, fires right before removing elements from the DOM. Might be useful to get form values before hiding modalbox. |
afterHide | client side method, fires after hiding ModalBox from the screen. |
afterResize | client side method, fires after calling resize method. |
onShow | client side method, fires on first appearing of ModalBox before the contents are being loaded. |
onUpdate | client side method, fires on updating the content of ModalBox (on call of Modalbox.show method from active ModalBox instance). |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.webobjects.appserver.WOComponent |
---|
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event |
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
---|
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility |
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding |
---|
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor |
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSValidation |
---|
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException |
Field Summary | |
---|---|
static java.lang.String |
Close
JavaScript to execute on the client to close the modal dialog |
static java.lang.String |
Close_ElementID_Suffix
Element ID suffix indicating an C Dialog action. |
static org.apache.log4j.Logger |
logger
|
static java.lang.String |
Open_ElementID_Suffix
Element ID suffix indicating an Open Dialog action. |
Fields inherited from class com.webobjects.appserver.WOComponent |
---|
_Extension, _IsEventLoggingEnabled, _keyAssociations |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling |
---|
_CLASS |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
---|
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
---|
NullValue |
Fields inherited from interface com.webobjects.foundation.NSValidation |
---|
_CLASS |
Constructor Summary | |
---|---|
AjaxModalDialog(com.webobjects.appserver.WOContext context)
|
Method Summary | |
---|---|
protected java.lang.String |
_containerID(com.webobjects.appserver.WOContext context)
Returns the ID that represents this container for the purposes of Ajax updates. |
static AjaxModalDialog |
_currentDialog(com.webobjects.appserver.WOContext context)
|
protected void |
addRequiredWebResources(com.webobjects.appserver.WOResponse response)
Override this method to append the needed scripts for this component. |
protected void |
appendOpenModalDialogFunction(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
Appends function body to open the modal dialog window. |
void |
appendToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
This has two modes. |
void |
awake()
Start of R-R loop. |
static void |
close(com.webobjects.appserver.WOContext context)
Call this method to have a JavaScript response returned that closes the modal dialog. |
void |
closeDialog()
If the dialog is open, calls the method bound to onClose (if any), and marks the dialog state as closed. |
protected java.lang.String |
closeDialogURL(com.webobjects.appserver.WOContext context)
|
protected com.webobjects.foundation.NSMutableDictionary |
createModalBoxOptions()
|
protected java.lang.String |
cssFileFrameworkName()
|
protected java.lang.String |
cssFileName()
|
static AjaxModalDialog |
currentDialog(com.webobjects.appserver.WOContext context)
|
com.webobjects.appserver.WOActionResults |
handleRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Handles the open and close dialog actions. |
java.lang.String |
id()
|
com.webobjects.appserver.WOActionResults |
invokeAction(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Only handle this phase if the modal box is open or it is our action (opening the box). |
static boolean |
isInDialog(com.webobjects.appserver.WOContext context)
|
boolean |
isOpen()
|
static void |
open(com.webobjects.appserver.WOContext context,
java.lang.String id)
Call this method to have a JavaScript response returned that opens the modal dialog. |
static void |
open(com.webobjects.appserver.WOContext context,
java.lang.String id,
java.lang.String title)
Call this method to have a JavaScript response returned that opens the modal dialog. |
void |
openDialog()
Calls the method bound to onOpen (if any), and marks the dialog state as open. |
static java.lang.String |
openDialogFunctionName(java.lang.String id)
Returns the JavaScript function name for the function to open the AjaxModalDialog with the specified ID. |
protected java.lang.String |
openDialogURL(com.webobjects.appserver.WOContext context)
|
protected void |
popActionResultsFromContext(com.webobjects.appserver.WOContext context)
Sets the current component in context to the one there before pushActionResultsIntoContext was called. |
protected void |
popDialog()
Remove this dialog instance from the context, replacing the previous one if any. |
protected void |
pushActionResultsIntoContext(com.webobjects.appserver.WOContext context)
Make _actionResults (result of the action binding) the current component in context for WO processing. |
protected void |
pushDialog()
Stash this dialog instance in the context so we can access it from the static methods. |
void |
setCurrentDialogInPageIfNecessary(com.webobjects.appserver.WOActionResults results,
com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
|
void |
setOpen(boolean open)
|
static void |
setTitle(com.webobjects.appserver.WOContext context,
java.lang.String title)
Deprecated. use update(WOContext, title) instead |
protected boolean |
shouldHandleRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Removes Open_ElementID_Suffix or Close_ElementID_Suffix before evaluating senderID. |
void |
sleep()
End of R-R loop. |
boolean |
synchronizesVariablesWithBindings()
|
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Only handle this phase if the modal box is open. |
java.lang.String |
templateName()
Returns the template name for the ERXWOComponentContent: null to show the dialog (default) contents and "link" to show the link contents |
static void |
update(com.webobjects.appserver.WOContext context)
Deprecated. use update(WOContext, null) instead |
static void |
update(com.webobjects.appserver.WOContext context,
java.lang.String title)
Call this method to have a JavaScript response returned that updates the contents of the modal dialog. |
Methods inherited from class er.ajax.AjaxComponent |
---|
addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, booleanValueForBinding, safeElementID, valueForBinding, valueForBinding, valueForBinding |
Methods inherited from class com.webobjects.appserver.WOComponent |
---|
_associationWithName, _awakeInContext, _childTemplate, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, isStateless, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, takeValueForKey, takeValueForKeyPath, template, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForKey, valueForKeyPath |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String Close
public static final java.lang.String Open_ElementID_Suffix
public static final java.lang.String Close_ElementID_Suffix
public static final org.apache.log4j.Logger logger
Constructor Detail |
---|
public AjaxModalDialog(com.webobjects.appserver.WOContext context)
Method Detail |
---|
public boolean synchronizesVariablesWithBindings()
synchronizesVariablesWithBindings
in class com.webobjects.appserver.WOComponent
public boolean isOpen()
public void setOpen(boolean open)
public static void open(com.webobjects.appserver.WOContext context, java.lang.String id)
context
- the current WOContextid
- the HTML ID of the AjaxModalDialog to openpublic static void open(com.webobjects.appserver.WOContext context, java.lang.String id, java.lang.String title)
context
- the current WOContextid
- the HTML ID of the AjaxModalDialog to opentitle
- the title for the AjaxModalDialogpublic static java.lang.String openDialogFunctionName(java.lang.String id)
id
- the HTML ID of the AjaxModalDialog to open
public static void close(com.webobjects.appserver.WOContext context)
context
- the current WOContextpublic static void update(com.webobjects.appserver.WOContext context, java.lang.String title)
context
- the current WOContexttitle
- optional new title for the updated dialogpublic static void update(com.webobjects.appserver.WOContext context)
context
- the current WOContextupdate(WOContext, String)
public static void setTitle(com.webobjects.appserver.WOContext context, java.lang.String title)
context
- the current WOContexttitle
- the new title for the dialog windowupdate(WOContext, String)
public void setCurrentDialogInPageIfNecessary(com.webobjects.appserver.WOActionResults results, com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
public static AjaxModalDialog _currentDialog(com.webobjects.appserver.WOContext context)
context
- the current WOContext
java.lang.RuntimeException
- if no AjaxModalDialog is currently being processedpublic static AjaxModalDialog currentDialog(com.webobjects.appserver.WOContext context)
context
- the current WOContext
java.lang.RuntimeException
- if no AjaxModalDialog is currently being processedpublic static boolean isInDialog(com.webobjects.appserver.WOContext context)
context
- the current WOContext
public void awake()
awake
in class com.webobjects.appserver.WOComponent
WOComponent.awake()
public void takeValuesFromRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
takeValuesFromRequest
in class com.webobjects.appserver.WOComponent
WOComponent.takeValuesFromRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
public com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
invokeAction
in class AjaxComponent
close(WOContext)
,
update(WOContext)
,
WOComponent.takeValuesFromRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
protected boolean shouldHandleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
shouldHandleRequest
in class AjaxComponent
true
if this request is for this componentAjaxComponent.shouldHandleRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
public com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
handleRequest
in interface IAjaxElement
handleRequest
in class AjaxComponent
AjaxComponent.handleRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
public void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
appendToResponse
in class AjaxComponent
AjaxComponent.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)
protected void appendOpenModalDialogFunction(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
response
- WOResponse to append tocontext
- WOContext of responseAjaxModalDialog#openDialogFunctionName(String)
public void sleep()
sleep
in class com.webobjects.appserver.WOComponent
WOComponent.sleep()
public void openDialog()
public void closeDialog()
! AjaxRequestHandler.AjaxRequestHandlerKey.equals(context().request().requestHandlerKey())
protected java.lang.String _containerID(com.webobjects.appserver.WOContext context)
AjaxComponent
_containerID
in class AjaxComponent
context
- the current context
AjaxComponent._containerID(com.webobjects.appserver.WOContext)
public java.lang.String id()
public java.lang.String templateName()
protected com.webobjects.foundation.NSMutableDictionary createModalBoxOptions()
protected void addRequiredWebResources(com.webobjects.appserver.WOResponse response)
AjaxComponent
addRequiredWebResources
in class AjaxComponent
AjaxComponent.addRequiredWebResources(com.webobjects.appserver.WOResponse)
protected java.lang.String cssFileName()
protected java.lang.String cssFileFrameworkName()
protected void pushDialog()
AjaxModalDialog#popDialog()
protected void popDialog()
pushDialog()
protected void pushActionResultsIntoContext(com.webobjects.appserver.WOContext context)
context
- WOContext to push _actionResults intopopActionResultsFromContext(WOContext)
protected void popActionResultsFromContext(com.webobjects.appserver.WOContext context)
context
- WOContext to restore previous component inpushActionResultsIntoContext(WOContext)
protected java.lang.String openDialogURL(com.webobjects.appserver.WOContext context)
context
- WOContext to create URL in
protected java.lang.String closeDialogURL(com.webobjects.appserver.WOContext context)
context
- WOContext to create URL in
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |