|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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"/>
<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"/>
<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.
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. |
java.lang.Objectariba.ui.aribaweb.util.AWBaseObject
ariba.ui.aribaweb.core.AWComponent
ariba.ui.widgets.Confirmation
public class Confirmation
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.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 |
---|
public static final java.lang.String ConfirmationId
public static final java.lang.String ClientSideConfirmationIdList
public static final java.lang.String HideConfirmationId
public static final java.lang.String LazyLoadConfirmation
public java.lang.String _confId
Constructor Detail |
---|
public Confirmation()
Method Detail |
---|
public boolean isClientSideConfirmation()
public boolean renderConfirmation()
public boolean useLazyDiv()
public boolean hideConfirmation()
public boolean showConfirmation()
public AWResponseGenerating cancelAction()
public AWResponseGenerating okAction()
public boolean hasButtonsTemplate()
public static final AWResponseGenerating showConfirmation(AWRequestContext requestContext, AWEncodedString confirmationId)
public static final AWResponseGenerating hideConfirmation(AWRequestContext requestContext)
public static final boolean hasConfirmation(AWRequestContext requestContext)
public void renderResponse(AWRequestContext requestContext, AWComponent component)
AWCycleable
AWRequestContext.response()
renderResponse
in interface AWCycleable
renderResponse
in class AWComponent
requestContext
- the context for the current request.component
- the current parent componentpublic void applyValues(AWRequestContext requestContext, AWComponent component)
AWCycleable
AWRequestContext.request()
.
applyValues
in interface AWCycleable
applyValues
in class AWComponent
requestContext
- the context for the current request.component
- the current parent componentpublic AWResponseGenerating invokeAction(AWRequestContext requestContext, AWComponent component)
AWCycleable
AWRequestContext.request()
AWRequest.senderId()
) and,
if so, handle the action and return the result.
invokeAction
in interface AWCycleable
invokeAction
in class AWComponent
requestContext
- the context for the current request.component
- the current parent component
public void pushErrorManager()
public void popErrorManager()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |