<a:If>

AWIf is the fundamental conditional control structure. It's body is evaluated based on the evaluation of its test condition binding.

Typical use:

<a:If ifTrue="$userCanEditItem">
    <a:TextField value="$theItem">
<a:Else/>
    <a:String value="$theItem">
</a:If>

Note that all of the condition bindings available on the a:If element can also be use on a:Else (and a single a:If block can have multiple conditional a:Else sections.

While a:If supports comparison operations (<a:If isGreaterThan="$rating" value="50"/>) use of the expression language may be clearer (<a:If ifTrue="${rating > 50}"/>)

Bindings
ifTrue

Tests for boolean True (or not null)

boolean
(get)
ifFalse

Tests for boolean False (or null)

boolean
(get)
equalNull

Tests for == null

Object
(get)
notEqualNull

Tests for == null

Object
(get)
isEqual

Comparison operator: <a:If isEqual="$choice" value="A"> </a:If>

Object
(get)
isNotEqual

Comparison operator: <a:If isNotEqual="$choice" value="B"> </a:If>

Object
(get)
isGreaterThan

Comparison operator: <a:If isGreaterThan="$rating" value="50"> </a:If>

Object
(get)
isGreaterThanOrEqual

Comparison operator: <a:If isGreaterThanOrEqual="$rating" value="50"> </a:If>

Object
(get)
isLessThan

Comparison operator: <a:If isLessThan="$rating" value="50"> </a:If>

Object
(get)
isLessThanOrEqual

Comparison operator: <a:If isLessThanOrEqual="$rating" value="50"> </a:If>

Object
(get)

ariba.ui.aribaweb.core
Class AWIf

java.lang.Object
  extended by ariba.ui.aribaweb.util.AWBaseObject
      extended by ariba.ui.aribaweb.core.AWBaseElement
          extended by ariba.ui.aribaweb.core.AWBindableElement
              extended by ariba.ui.aribaweb.core.AWIf
All Implemented Interfaces:
AWBindable, AWCycleable, AWCycleableReference, AWElement, AWElementContaining, AWVisitable, AWObject, java.lang.Cloneable

public class AWIf
extends AWBindableElement
implements AWElementContaining


Nested Class Summary
static class AWIf.AWIfBlock
           
 
Constructor Summary
AWIf()
           
 
Method Summary
 AWIf.AWIfBlock[] _conditionBlocks()
           
 void add(AWElement element)
           
 void applyValues(AWRequestContext requestContext, AWComponent component)
          The receiver should take any form values (or query string parameters) that it owns from the AWRequestContext.request().
static boolean evaluateConditionInComponent(AWBinding conditionBinding, AWComponent component, boolean negate)
           
 void init(java.lang.String tagName, java.util.Map bindingsHashtable)
           
 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.
 void renderResponse(AWRequestContext requestContext, AWComponent component)
          The receiver should render its content to the AWRequestContext.response()
 void setLineNumber(int lineNumber)
           
 void setTemplateName(java.lang.String name)
           
 java.lang.String toString()
           
 void validate(AWValidationContext validationContext, AWComponent component)
          Checks for things like valid binding names and definitions.
 
Methods inherited from class ariba.ui.aribaweb.core.AWBindableElement
allBindings, appendTo, determineInstance, tagName
 
Methods inherited from class ariba.ui.aribaweb.core.AWBaseElement
bareStringContent, clone, continueVisit, determineInstance, lineNumber, startVisit, templateName
 
Methods inherited from class ariba.ui.aribaweb.util.AWBaseObject
debugString, ensureFieldValuesClear, getFieldValue, init, isKindOfClass, localizedJavaString, logString, logWarning, setFieldValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ariba.ui.aribaweb.core.AWElement
clone
 
Methods inherited from interface ariba.ui.aribaweb.core.AWCycleableReference
determineInstance
 
Methods inherited from interface ariba.ui.aribaweb.util.AWObject
getFieldValue, init, isKindOfClass, setFieldValue
 
Methods inherited from interface ariba.ui.aribaweb.core.AWVisitable
continueVisit, startVisit
 

Constructor Detail

AWIf

public AWIf()
Method Detail

_conditionBlocks

public AWIf.AWIfBlock[] _conditionBlocks()

setTemplateName

public void setTemplateName(java.lang.String name)
Overrides:
setTemplateName in class AWBaseElement

setLineNumber

public void setLineNumber(int lineNumber)
Overrides:
setLineNumber in class AWBaseElement

evaluateConditionInComponent

public static boolean evaluateConditionInComponent(AWBinding conditionBinding,
                                                   AWComponent component,
                                                   boolean negate)

init

public void init(java.lang.String tagName,
                 java.util.Map bindingsHashtable)
Specified by:
init in interface AWBindable
Overrides:
init in class AWBindableElement

add

public void add(AWElement element)
Specified by:
add in interface AWElementContaining

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 AWBaseElement
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 AWBaseElement
Parameters:
requestContext - the context for the current request.
component - the current parent component
Returns:
the response for the action

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 AWBaseElement
Parameters:
requestContext - the context for the current request.
component - the current parent component

validate

public void validate(AWValidationContext validationContext,
                     AWComponent component)
Description copied from class: AWBaseElement
Checks for things like valid binding names and definitions. Logs all errors and warnings. This is the default, which is to do nothing.

Specified by:
validate in interface AWElement
Overrides:
validate in class AWBindableElement

toString

public java.lang.String toString()
Overrides:
toString in class AWBaseElement


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