
Public Member Functions | |
| AjaxModalDialog (WOContext context) | |
| void | appendToResponse (WOResponse response, WOContext context) |
| void | awake () |
| void | closeDialog () |
| WOActionResults | handleRequest (WORequest request, WOContext context) |
| String | id () |
| WOActionResults | invokeAction (WORequest request, WOContext context) |
| boolean | isOpen () |
| void | openDialog () |
| void | setCurrentDialogInPageIfNecessary (WOActionResults results, WORequest request, WOContext context) |
| void | setOpen (boolean open) |
| void | sleep () |
| boolean | synchronizesVariablesWithBindings () |
| void | takeValuesFromRequest (WORequest request, WOContext context) |
| String | templateName () |
Static Public Member Functions | |
| static AjaxModalDialog | _currentDialog (WOContext context) |
| static void | close (WOContext context) |
| static AjaxModalDialog | currentDialog (WOContext context) |
| static boolean | isInDialog (WOContext context) |
| static void | open (WOContext context, String id, String title) |
| static void | open (WOContext context, String id) |
| static String | openDialogFunctionName (String id) |
| static void | setTitle (WOContext context, String title) |
| static void | update (WOContext context) |
| static void | update (WOContext context, String title) |
Static Public Attributes | |
| static final String | Close = "AMD.close();" |
| static final String | Close_ElementID_Suffix = ".close" |
| static final Logger | logger = Logger.getLogger(AjaxModalDialog.class) |
| static final String | Open_ElementID_Suffix = ".open" |
Protected Member Functions | |
| String | _containerID (WOContext context) |
| void | addRequiredWebResources (WOResponse response) |
| void | appendOpenModalDialogFunction (WOResponse response, WOContext context) |
| String | closeDialogURL (WOContext context) |
| NSMutableDictionary | createModalBoxOptions () |
| String | cssFileFrameworkName () |
| String | cssFileName () |
| String | openDialogURL (WOContext context) |
| void | popActionResultsFromContext (WOContext context) |
| void | popDialog () |
| void | pushActionResultsIntoContext (WOContext context) |
| void | pushDialog () |
| boolean | shouldHandleRequest (WORequest request, WOContext context) |
Private Attributes | |
| WOComponent | _actionResults |
| boolean | _open |
| String | ajaxComponentActionUrl |
| boolean | hasWarnedOnNesting = false |
| AjaxModalDialog | outerDialog |
| WOComponent | previousComponent |
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_<ID>(): openAMD_MyDialogId();
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).
TODO handle href to static content TODO make dialog draggable TODO lock dialog open unless closed by content TODO add transitioning to other contents without closing dialog
| AjaxModalDialog | ( | WOContext | context | ) |
| String _containerID | ( | WOContext | context | ) | [protected] |
Reimplemented from AjaxComponent.
| static AjaxModalDialog _currentDialog | ( | WOContext | context | ) | [static] |
| context | the current WOContext |
| RuntimeException | if no AjaxModalDialog is currently being processed |
| void addRequiredWebResources | ( | WOResponse | response | ) | [protected, virtual] |
Implements AjaxComponent.
| void appendOpenModalDialogFunction | ( | WOResponse | response, | |
| WOContext | context | |||
| ) | [protected] |
Appends function body to open the modal dialog window.
| response | WOResponse to append to | |
| context | WOContext of response |
| void appendToResponse | ( | WOResponse | response, | |
| WOContext | context | |||
| ) |
This has two modes. One is to generate the link that opens the dialog. The other is to return the contents of the dialog (the result returned by action binding is handled in handleRequest, not here).
Reimplemented from AjaxComponent.
| void awake | ( | ) |
Start of R-R loop. awakes the components from action if action is bound.
| static void close | ( | WOContext | context | ) | [static] |
Call this method to have a JavaScript response returned that closes the modal dialog.
| context | the current WOContext |
| void closeDialog | ( | ) |
If the dialog is open, calls the method bound to onClose (if any), and marks the dialog state as closed. This method can get called if the page gets reloaded so be careful modifying the response if ! AjaxRequestHandler.AjaxRequestHandlerKey.equals(context().request().requestHandlerKey())
| String closeDialogURL | ( | WOContext | context | ) | [protected] |
| context | WOContext to create URL in |
| NSMutableDictionary createModalBoxOptions | ( | ) | [protected] |
| String cssFileFrameworkName | ( | ) | [protected] |
| String cssFileName | ( | ) | [protected] |
| static AjaxModalDialog currentDialog | ( | WOContext | context | ) | [static] |
| context | the current WOContext |
| RuntimeException | if no AjaxModalDialog is currently being processed |
| WOActionResults handleRequest | ( | WORequest | request, | |
| WOContext | context | |||
| ) | [virtual] |
Handles the open and close dialog actions.
Implements AjaxComponent.
| String id | ( | ) |
| WOActionResults invokeAction | ( | WORequest | request, | |
| WOContext | context | |||
| ) |
Only handle this phase if the modal box is open or it is our action (opening the box). Overridden to include result returned by action binding if bound.
com.webobjects.appserver.WOComponent.takeValuesFromRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
Reimplemented from AjaxComponent.
| static boolean isInDialog | ( | WOContext | context | ) | [static] |
| context | the current WOContext |
| boolean isOpen | ( | ) |
Call this method to have a JavaScript response returned that opens the modal dialog. The title of the dialog will be the passed title. This is useful if the script to open this dialog was rendered without the title or with an incorrect title.
| context | the current WOContext | |
| id | the HTML ID of the AjaxModalDialog to open | |
| title | the title for the AjaxModalDialog |
| static void open | ( | WOContext | context, | |
| String | id | |||
| ) | [static] |
Call this method to have a JavaScript response returned that opens the modal dialog. The title of the dialog will be what it was when rendered.
| context | the current WOContext | |
| id | the HTML ID of the AjaxModalDialog to open |
| void openDialog | ( | ) |
Calls the method bound to onOpen (if any), and marks the dialog state as open.
Returns the JavaScript function name for the function to open the AjaxModalDialog with the specified ID.
| id | the HTML ID of the AjaxModalDialog to open |
| String openDialogURL | ( | WOContext | context | ) | [protected] |
| context | WOContext to create URL in |
| void popActionResultsFromContext | ( | WOContext | context | ) | [protected] |
Sets the current component in context to the one there before pushActionResultsIntoContext was called.
| context | WOContext to restore previous component in |
| void popDialog | ( | ) | [protected] |
Remove this dialog instance from the context, replacing the previous one if any.
| void pushActionResultsIntoContext | ( | WOContext | context | ) | [protected] |
Make _actionResults (result of the action binding) the current component in context for WO processing. Remembers the current component so that it can be restored.
| context | WOContext to push _actionResults into |
| void pushDialog | ( | ) | [protected] |
Stash this dialog instance in the context so we can access it from the static methods. If there is one AMD nested in another (a rather dubious thing to do that we warn about but it may have its uses), we need to remember the outer one while processing this inner one
| void setCurrentDialogInPageIfNecessary | ( | WOActionResults | results, | |
| WORequest | request, | |||
| WOContext | context | |||
| ) |
| void setOpen | ( | boolean | open | ) |
| static void setTitle | ( | WOContext | context, | |
| String | title | |||
| ) | [static] |
Call this method to have a JavaScript response returned that updates the title of the modal dialog.
| context | the current WOContext | |
| title | the new title for the dialog window |
| boolean shouldHandleRequest | ( | WORequest | request, | |
| WOContext | context | |||
| ) | [protected] |
Removes Open_ElementID_Suffix or Close_ElementID_Suffix before evaluating senderID.
true if this request is for this component Reimplemented from AjaxComponent.
| void sleep | ( | ) |
End of R-R loop. Puts the components from action to sleep if action is bound.
| boolean synchronizesVariablesWithBindings | ( | ) |
| void takeValuesFromRequest | ( | WORequest | request, | |
| WOContext | context | |||
| ) |
Only handle this phase if the modal box is open. Also includes result returned by action binding if bound.
| String templateName | ( | ) |
Returns the ID of the AjaxUpdateContainer that wraps the in-line contents of this dialog.
null or "link"
| static void update | ( | WOContext | context | ) | [static] |
Call this method to have a JavaScript response returned that updates the contents of the modal dialog without updating the title.
| context | the current WOContext |
| static void update | ( | WOContext | context, | |
| String | title | |||
| ) | [static] |
Call this method to have a JavaScript response returned that updates the contents of the modal dialog.
| context | the current WOContext | |
| title | optional new title for the updated dialog |
WOComponent _actionResults [private] |
boolean _open [private] |
String ajaxComponentActionUrl [private] |
JavaScript to execute on the client to close the modal dialog
final String Close_ElementID_Suffix = ".close" [static] |
Element ID suffix indicating an C Dialog action.
boolean hasWarnedOnNesting = false [private] |
final Logger logger = Logger.getLogger(AjaxModalDialog.class) [static] |
final String Open_ElementID_Suffix = ".open" [static] |
Element ID suffix indicating an Open Dialog action.
AjaxModalDialog outerDialog [private] |
WOComponent previousComponent [private] |
1.5.8