Project Wonder 5.0

er.ajax
Class AjaxModalDialogOpener

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WOComponent
          extended by er.ajax.AjaxComponent
              extended by er.ajax.AjaxModalDialogOpener
All Implemented Interfaces:
com.webobjects.appserver.WOActionResults, com.webobjects.foundation.NSKeyValueCoding, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCodingAdditions, com.webobjects.foundation.NSValidation, IAjaxElement, java.io.Serializable, java.lang.Cloneable

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.

See Also:
AjaxModalDialog, Modalbox Page, Google Group, Serialized Form
Author:
chill
Bindings
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
           

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
 
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
AjaxModalDialogOpener(com.webobjects.appserver.WOContext context)
           
 
Method Summary
protected  void addRequiredWebResources(com.webobjects.appserver.WOResponse res)
          Override this method to append the needed scripts for this component.
protected  com.webobjects.foundation.NSMutableDictionary ajaxRequestOptions()
           
 void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Generate a link that opens the indicated dialog.
 com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
          Runs action and returns success status if enabled, otherwise returns failed status.
 java.lang.String id()
           
 boolean isStateless()
           
 java.lang.String modalDialogId()
           
static void rejectOpen(com.webobjects.appserver.WOContext context)
          Call this, from the action method only, to prevent the dialog from opening.
 
Methods inherited from class er.ajax.AjaxComponent
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, booleanValueForBinding, invokeAction, safeElementID, shouldHandleRequest, 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, 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, sleep, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, 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
 

Constructor Detail

AjaxModalDialogOpener

public AjaxModalDialogOpener(com.webobjects.appserver.WOContext context)
Method Detail

rejectOpen

public static void rejectOpen(com.webobjects.appserver.WOContext context)
Call this, from the action method only, to prevent the dialog from opening. If there is an onFailure callback, it will get executed. This is also called internally if 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.

Parameters:
context - WOContext to reject open in

isStateless

public boolean isStateless()
Overrides:
isStateless in class com.webobjects.appserver.WOComponent

appendToResponse

public void appendToResponse(com.webobjects.appserver.WOResponse response,
                             com.webobjects.appserver.WOContext context)
Generate a link that opens the indicated dialog.

Overrides:
appendToResponse in class AjaxComponent
See Also:
AjaxComponent.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)

id

public java.lang.String id()
Returns:
the value bound to id or an manufactured string if id is not bound

modalDialogId

public java.lang.String modalDialogId()
Returns:
the value bound to dialogId

addRequiredWebResources

protected void addRequiredWebResources(com.webobjects.appserver.WOResponse res)
Description copied from class: AjaxComponent
Override this method to append the needed scripts for this component.

Specified by:
addRequiredWebResources in class AjaxComponent

handleRequest

public com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request,
                                                              com.webobjects.appserver.WOContext context)
Runs action and returns success status if enabled, otherwise returns failed status.

Specified by:
handleRequest in interface IAjaxElement
Specified by:
handleRequest in class AjaxComponent

ajaxRequestOptions

protected com.webobjects.foundation.NSMutableDictionary ajaxRequestOptions()
Returns:
options for Ajax.Request that is made when the link is clicked

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.