<w:Confirmation>

Displays a confirmation dialog with Header, Content, and Buttons. By default there are two buttons, Ok and Cancel. Cancel will close the Confirmation dialog and redisplay the current page.

There are two distinct patterns for the Confirmation widget.

1. Client Side Confirmation

For client side confirmations, the TextButton and the Confirmation widget are associated via the "confirmationId" binding on TextButton. In this case, no java code needs to be written and the Confirmation widget will always be displayed when the TextButton is clicked. Note that there is no "action" binding on TextButton since the server side action is always defined by the buttons in the Confirmation widget.

NOTE: the TextButton MUST appear before the Confirmation in this usage.

Client Side Example 1:

<a:SetValue exampleId="$requestContext.nextElementId"/>
<w:TextButton confirmationId="$exampleId">Client Side Confirmation</w:TextButton>
<w:Confirmation id="$exampleId" okAction="$okAction">
    <a:Content name="header"><a:Image align="absmiddle" filename="sso/warning.gif"/>&nbsp;&nbsp;
        <a:Local key="a001">Confirm Action</a:Local>
    </a:Content><a:Content name="content"><table>
            <tr>
                <td><a:Local key="a002">Are you sure?</a:Local></td>
            </tr>
        </table>
    </a:Content></w:Confirmation>

In the example above, the default ok/cancel buttons are used. In this case, the ok button will call the okAction binding defined on the Confirmation and the cancel button will simply close the confirmation (with no server side update).

Client Side Example 2:

<a:SetValue exampleId="$requestContext.nextElementId"/>
<w:TextButton confirmationId="$exampleId">Client Side Confirmation (Custom buttons)</w:TextButton>
<w:Confirmation id="$exampleId">
    <a:Content name="header"><a:Image align="absmiddle" filename="sso/warning.gif"/>&nbsp;&nbsp;
        <a:Local key="a001">Confirm Action</a:Local>
    </a:Content><a:Content name="content"><table>
            <tr>
                <td><a:Local key="a002">Are you sure?</a:Local></td>
            </tr>
        </table>
    </a:Content><a:Content name="buttons">
        <table>
            <tr>
                <td>
                    <w:TextButton onClick="ariba.Widgets.cancelConfirmation();">Custom Cancel</w:TextButton></td>
                <td>
                    <w:TextButton action="$postConfirmHome">Go Home</w:TextButton>
                </td>
                <td>
                    <w:TextButton action="$clientSideConfirmationRefresh">Redisplay Page</w:TextButton>
                </td>
            </tr>
        </table>
    </a:Content>
</w:Confirmation>

public AWResponseGenerating clientSideConfirmationRefresh ()
{
    Confirmation.hideConfirmation(requestContext());
    return null;
}

In the example above, the default ok/cancel buttons are used. In this case, the ok button will call the okAction binding defined on the Confirmation and the cancel button will simply close the confirmation (with no server side update).

Note: Using an action that returns $null will NOT close the confirmation. Instead an explicit call to Confirmation.hideConfirmation() is necessary. As shown by clientSideConfirmationRefresh.

2. Server Side Confirmation

In the second pattern, the display of the Confirmation is explicitly controlled on the server side in the "action" method of the TextButton (or other action firing widget). Using this pattern, the Confirmation is displayed by using the showConfirmation static utility method.

Server Side Example 1:

<a:SetValue exampleId="$requestContext.nextElementId"/>
<w:TextButton action="$showConfirmationDiv">Server Side Confirmation</w:TextButton>
<w:Confirmation id="$exampleId" okAction="$okAction">
    <a:Content name="header">Confirm Action</a:Content><a:Content name="content">Are you really sure?</a:Content></w:Confirmation>

public AWEncodedString _exampleId;
public AWResponseGenerating showConfirmationDiv ()
{
    // make some decision here
    if (reasonForShowingDiv) {
        // show the confirmation
        return Confirmation.showConfirmation(requestContext(), _exampleId);
    }
    else {
        // show some page -- just returning current page in this example
        return null;
    }
}

public AWResponseGenerating okAction ()
{
    // hide the confirmation so if the current page is redisplayed the
    // confirmation will be closed
    Confirmation.hideConfirmation(requestContext());
    // show some page -- just returning current page in this example
    return null;
}

Server Side Example 2:

The example below also has a custom button template, a javascript button, and examples of how to implement ok / cancel.

<a:SetValue exampleId="$requestContext.nextElementId"/>
<w:TextButton action="$showConfirmationDiv">Server Side Confirmation (Custom buttons)</w:TextButton>
<w:Confirmation id="$exampleId">
    <a:Content name="header">Confirm Action</a:Content><a:Content name="content">Are you really sure?</a:Content><a:Content name="buttons">
        <table>
            <tr>
                <td>
                    <w:TextButton tabIndex="0"
                                  onClick="alert('javascript button');return false;"
                                  onKeyPress="alert('javascript button');return false;"
                                  buttonClass="btnSpecial1">
                        JS Button
                    </w:TextButton>
                </td>
                <td>
                    <w:TextButton action="$cancelConfirmation">Cancel</w:TextButton>
                </td>
                <td>
                    <w:TextButton action="$postConfirmHome">Go Home</w:TextButton>
                </td>
            </tr>
        </table>
    </a:Content>
</w:Confirmation>

public AWEncodedString _exampleId;
public AWResponseGenerating showConfirmationDiv ()
{
    // make some decision here
    if (reasonForShowingDiv) {
        // show the confirmation
        return Confirmation.showConfirmation(requestContext(), _exampleId);
    }
    else {
        // show something else
        return null;
    }
}

public AWResponseGenerating cancelConfirmation ()
{
    return Confirmation.hideConfirmation(requestContext());
}

public AWResponseGenerating postConfirmHome ()
{
    Confirmation.hideConfirmation(requestContext());
    return pageWithName("HomePage");
}
Bindings
id

Id of this Confirmation Dialog. This value is used by Confirmation.showConfirmation to detrmine which confirmation dialog to display.

String
(get)
okAction

Action to take when Ok is clicked

AWResponseGenerating
(get)
cancelAction

Action to take when Cancel is clicked

AWResponseGenerating
(get)
lazyLoadConfirmation

Determines whether or not Client Side Confirmations are lazily loaded (by default this is true).

boolean
(get)
validate

If true, prevents the confirmation from being closed when Ok is clicked if there are validation errors (by default this is false).

boolean
(get)

Named Content
header

Use to define content to display in header area.

content

Define content to display in body of the dialog.

buttons

Override default "Ok" "Cancel" buttons by passing in this named template.

ariba.ui.widgets
Class Confirmation

java.lang.Object
  extended by ariba.ui.aribaweb.util.AWBaseObject
      extended by ariba.ui.aribaweb.core.AWComponent
          extended by ariba.ui.widgets.Confirmation
All Implemented Interfaces:
AWCycleable, AWCycleableReference, AWResponseGenerating, AWResponseGenerating.ResponseSubstitution, AWObject

public class Confirmation
extends AWComponent


Nested Class Summary
 
Nested classes/interfaces inherited from class ariba.ui.aribaweb.core.AWComponent
AWComponent.RenderingFilter, AWComponent.RenderingListener
 
Nested classes/interfaces inherited from interface ariba.ui.aribaweb.core.AWResponseGenerating
AWResponseGenerating.ResponseSubstitution
 
Constructor Summary
Confirmation()
           
 
Method Summary
 void applyValues(AWRequestContext requestContext, AWComponent component)
          The receiver should take any form values (or query string parameters) that it owns from the AWRequestContext.request().
 AWResponseGenerating cancelAction()
           
 boolean hasButtonsTemplate()
           
static boolean hasConfirmation(AWRequestContext requestContext)
           
 boolean hideConfirmation()
           
static AWResponseGenerating hideConfirmation(AWRequestContext requestContext)
           
 AWResponseGenerating invokeAction(AWRequestContext requestContext, AWComponent component)
          The receiver should determine if it is the intended recipient of the current action (by checking the AWRequestContext.request() AWRequest.senderId()) and, if so, handle the action and return the result.
 boolean isClientSideConfirmation()
           
 AWResponseGenerating okAction()
           
 void popErrorManager()
           
 void pushErrorManager()
           
 boolean renderConfirmation()
           
 void renderResponse(AWRequestContext requestContext, AWComponent component)
          The receiver should render its content to the AWRequestContext.response()
 boolean showConfirmation()
           
static AWResponseGenerating showConfirmation(AWRequestContext requestContext, AWEncodedString confirmationId)
           
 boolean useLazyDiv()
           
 
Methods inherited from class ariba.ui.aribaweb.core.AWComponent
_topLevelApplyValues, _topLevelInvokeAction, _topLevelRenderResponse, allowEmbeddedKeyPaths, allowsWhitespaceCompression, application, awcyclePageAndLog, bindingForName, bindingForName, bindings, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, browserMaxWidth, browserMinWidth, characterEncoding, clearValidationError, clientTimeZone, componentConfiguration, componentDefinition, componentPath, componentReference, createPageWithName, defaultTemplateParser, determineInstance, determineInstance, dict, dict, dict, doubleValueForBinding, doubleValueForBinding, doubleValueForBinding, encodedStringValueForBinding, encodedStringValueForBinding, ensureAwake, ensureFieldValuesClear, env, errorManager, escapeAttribute, escapeString, escapeUnsafeString, extendedFields, formValueManager, generateResponse, generateResponse, generateResponse, generateStringContents, getAWParameter, getDrivingBusinessObject, getFoldInSituOnWindowSizeParam, getPageRenderVersion, getThis, hasBinding, hasBinding, hasContentForTagName, hasContentNamed, hasMultipleTemplates, hasSubTemplateNamed, httpSession, init, init, initTemplateResourceManager, intValueForBinding, intValueForBinding, intValueForBinding, isBidirectional, isBrowserMicrosoft, isClientPanel, isMacintosh, isRenderAW5, isStateless, isStrictTagNaming, isUserCommunityEnabled, isValidationEnabled, languageDirection, languageLeft, languageRight, loadTemplate, localizedJavaString, markBacktrackState, name, namePath, notifyChange, otherBindings, otherBindingsValues, page, pageComponent, pageWithClass, pageWithClass, pageWithName, pageWithName, parent, postTakeValueActions, preferredLocale, recordBacktrackState, recordBacktrackState, recordValidationError, recordValidationError, recordValidationError, recordValidationErrors, recordValidationWarning, redirectToPage, registerRenderingListener, registerXmlNodeWithName, removeBacktrackState, replacementResponse, request, requestContext, requiresPreGlidCompatibility, resourceClassName, resourceManager, response, restoreFromBacktrackState, session, session, setCharacterEncoding, setClientPanel, setClientTimeZone, setComponentConfiguration, setDefaultTemplateParser, setEnv, setPerfDestinationInfo, setPreferredLocale, setResourceManager, setTemplateParser, setupForNextCycle, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, setValueForBinding, shouldCachePage, shouldCloseElements, strings, stringValueForBinding, stringValueForBinding, stringValueForBinding, supportedBindingNames, template, templateName, templateParser, templateResource, templateResourceManager, truncateBacktrackState, truncateBacktrackState, urlForResourceNamed, urlForResourceNamed, urlForResourceNamed, useXmlEscaping, valueForBinding, valueForBinding, valueForBinding, xml
 
Methods inherited from class ariba.ui.aribaweb.util.AWBaseObject
debugString, getFieldValue, isKindOfClass, localizedJavaString, logString, logWarning, setFieldValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ariba.ui.aribaweb.util.AWObject
getFieldValue, isKindOfClass, setFieldValue
 

Field Detail

ConfirmationId

public static final java.lang.String ConfirmationId
See Also:
Constant Field Values

ClientSideConfirmationIdList

public static final java.lang.String ClientSideConfirmationIdList
See Also:
Constant Field Values

HideConfirmationId

public static final java.lang.String HideConfirmationId
See Also:
Constant Field Values

LazyLoadConfirmation

public static final java.lang.String LazyLoadConfirmation
See Also:
Constant Field Values

_confId

public java.lang.String _confId
Constructor Detail

Confirmation

public Confirmation()
Method Detail

isClientSideConfirmation

public boolean isClientSideConfirmation()

renderConfirmation

public boolean renderConfirmation()

useLazyDiv

public boolean useLazyDiv()

hideConfirmation

public boolean hideConfirmation()

showConfirmation

public boolean showConfirmation()

cancelAction

public AWResponseGenerating cancelAction()

okAction

public AWResponseGenerating okAction()

hasButtonsTemplate

public boolean hasButtonsTemplate()

showConfirmation

public static final AWResponseGenerating showConfirmation(AWRequestContext requestContext,
                                                          AWEncodedString confirmationId)

hideConfirmation

public static final AWResponseGenerating hideConfirmation(AWRequestContext requestContext)

hasConfirmation

public static final boolean hasConfirmation(AWRequestContext requestContext)

renderResponse

public void renderResponse(AWRequestContext requestContext,
                           AWComponent component)
Description copied from interface: AWCycleable
The receiver should render its content to the AWRequestContext.response()

Specified by:
renderResponse in interface AWCycleable
Overrides:
renderResponse in class AWComponent
Parameters:
requestContext - the context for the current request.
component - the current parent component

applyValues

public void applyValues(AWRequestContext requestContext,
                        AWComponent component)
Description copied from interface: AWCycleable
The receiver should take any form values (or query string parameters) that it owns from the AWRequestContext.request().

Specified by:
applyValues in interface AWCycleable
Overrides:
applyValues in class AWComponent
Parameters:
requestContext - the context for the current request.
component - the current parent component

invokeAction

public AWResponseGenerating invokeAction(AWRequestContext requestContext,
                                         AWComponent component)
Description copied from interface: AWCycleable
The receiver should determine if it is the intended recipient of the current action (by checking the AWRequestContext.request() AWRequest.senderId()) and, if so, handle the action and return the result.

Specified by:
invokeAction in interface AWCycleable
Overrides:
invokeAction in class AWComponent
Parameters:
requestContext - the context for the current request.
component - the current parent component
Returns:
the response for the action

pushErrorManager

public void pushErrorManager()

popErrorManager

public void popErrorManager()


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.