public class AjaxModalDialogOpener extends AjaxComponent
Generates an element to open a specific AjaxModalDialog. This is useful when you want to physically separate the modal dialog from what opens it, for example if you want a modal dialog containing a form to have an opener inside of another form. It is also useful if you want to use a dialog in a repetition. Using an AjaxModalDialogOpener in the repetition and moving the AjaxModalDialog outside of the repetition will result in only a single rendering of the AjaxModalDialog in the page. You can also move it before the repetition to speed up request handling when the dialog is open. Normally you will want to bind showOpener=false; on the AjaxModalDialog that this opens.
If you need to do some preparation before the dialog opens, use the action method.This is called synchronously so make it quick! The action method is useful for things like copying the item from a repetition to use in a dialog that is not nested in the repetition.
If you specify the elementName
as a
then the label binding can be used to specify the link, or you can use child elements.
You can also specify the link's title using the title binding.
As the opener functions on the client only, it is possible for it to be rendered when enabled
evaluates to
true
and clicked later when enabled
would evaluate to false
. This condition is checked for
when the opener is clicked. If enabled
evaluates to false
at that time: the action method
is not called, the AjaxModalDialog is not opened, and the onFailure handler (if any) is run.
AjaxModalDialog
,
Modalbox Page,
Google Group,
Serialized FormName | Description |
---|---|
dialogId | required, ID of the AjaxModalDialog to open |
elementName | the element that you want the open rendered as |
label | only relevant if elementName is a : the text for the link that opens the dialog box, if this used the child elements are ignored. |
linkTitle | only relevant if elementName is a : used as title attribute of link opening dialog |
title | the Title to be displayed in the ModalBox window header, can override what the dialog was created with |
action, | optional action to call before opening the modal dialog. |
enabled | if false, nothing is rendered for this component. This can be used instead of wrapping this in a WOConditional. The default is true. |
onFailure | optional JavaScript (not a function()!) to run if the opener is clicked and enabled evaluates to false. This can remove the element, show an alert, etc. e.g. onFailure = "alert('This is no longer available');"; |
id | HTML id for the link |
class | CSS class for the link |
style | CSS style for the link |
WOComponent._EventLoggingEnabler, WOComponent.Event
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
_Extension, _IsEventLoggingEnabled, _keyAssociations
_CLASS
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
_CLASS
Constructor and Description |
---|
AjaxModalDialogOpener(WOContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
addRequiredWebResources(WOResponse res)
Override this method to append the needed scripts for this component.
|
protected NSMutableDictionary |
ajaxRequestOptions() |
void |
appendToResponse(WOResponse response,
WOContext context)
Generate a link that opens the indicated dialog.
|
WOActionResults |
handleRequest(WORequest request,
WOContext context)
Runs action and returns success status if enabled, otherwise returns failed status.
|
String |
id() |
boolean |
isStateless() |
String |
modalDialogId() |
static void |
rejectOpen(WOContext context)
Call this, from the action method only, to prevent the dialog from opening.
|
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, booleanValueForBinding, invokeAction, safeElementID, shouldHandleRequest, valueForBinding, valueForBinding, valueForBinding
__valueForBinding, _associationWithName, _awakeInContext, _childTemplate, _cleanUpStatelessComponent, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
public AjaxModalDialogOpener(WOContext context)
public static void rejectOpen(WOContext context)
enabled
is bound and
evaluates to false. This method sets the response status code to an error code so that the onSuccess
callback is not executed. The error status returned is 409 - "Conflict" which seemed like the best
match for this.context
- WOContext to reject open inpublic boolean isStateless()
isStateless
in class WOComponent
public void appendToResponse(WOResponse response, WOContext context)
appendToResponse
in class AjaxComponent
response
- the HTTP response that an application returns to a Web server to complete a cycle of the request-response loopcontext
- context of a transactionAjaxComponent.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)
public String id()
public String modalDialogId()
protected void addRequiredWebResources(WOResponse res)
AjaxComponent
addRequiredWebResources
in class AjaxComponent
res
- the response to write topublic WOActionResults handleRequest(WORequest request, WOContext context)
handleRequest
in interface IAjaxElement
handleRequest
in class AjaxComponent
request
- the requestcontext
- the contextprotected NSMutableDictionary ajaxRequestOptions()
Copyright © 2002 – 2024 Project Wonder.