<a:IncludeBlock>
AWIncludeBlock allows for reference to the content of an AWBlock.
The idea is to allow for a light-weight component which enables (template)
code factoring without the overhead of a full-blown template. Often,
factoring a duplicated region of a component's template leads to an
explosion of files, and an unnecessary clouding of what are the real
high-level pieces of the application. While AWIncludeBlock has is
limitations (no code may be associated specifically with the subcomponent),
it makes lightweight factoring easy and powerful.
To use AWIncludeBlock, you must define an AWBlock within the same
template where the AWIncludeBlock will reference the AWBlock. Within
an AWBlock, $ bindings are evaluated in the scope of the defining
component. However, $^ bindings apply to the values passed from the
AWIncludeBlock reference and not to the defining component (perhaps I could
do a cascased lookup?). This is necessary as this is the only way to
parameterize the sbcomponent.
As an example, consider the following template fragment:
<td>
<a:IncludeBlock name="ModuleBrowser" list="$moduleList1"/>
</td>
<td>
<a:IncludeBlock name="ModuleBrowser" list="$moduleList2"/>
</td>
...
<a:Block name="ModuleBrowser">
<a:Browser list="$^list" item="$currentModule" style="width:100%" size="10">
$currentModule.name
</a:Browser>
</a:Block>
Here, we define the AWBlock named ModuleBrowser and refer to it via an AWIncludeBlock tag which has two
bindings: the templateName of the AWBlock to use, and an arbitrary binding 'list'. In essence, AWIncludeBlock
operates like AWIncludeComponent in that it switches in the appropriate component/template and makes the
remaining bindings available to the subcomponent. In this case, the 'list' binding can be accessed within the
AWBlock by simply using the standard carat ($^) binding. In the example above, you can see that the
ModuleBrowser subtemplate accesses the $^list from the AWIncludeBlock reference, but all the other bindings
(ie $currentString) are evaluated int the scope of the enclosing component. By allowing for parameters to be
passed like this, the AWBlock can be parameterized and used with different sets of data, while still using the
rest of the values in the enclosing components scope/context.
It should also be noted that AWIncludeContent works as usual. For example, we could rewrite the above awl as
follows, thus giving us even more control over how the subcomponent renders:
<td>
<a:IncludeBlock name="ModuleBrowser" list="$moduleList1">
(1) $currentModule.name
</a:IncludeBlock>
</td>
<td>
<a:IncludeBlock name="ModuleBrowser" list="$moduleList2">
(2) $currentModule.name
</a:IncludeBlock>
</td>
...
<a:Block name="ModuleBrowser">
<a:Browser list="$^list" item="$currentModule" style="width:100%" size="10"><AWIncludeContent/>
</a:Browser>
</a:Block>
Bindings |
name
|
Name of AWBlock to include.
|
String
(get)
|
templateName
|
Alternative binding name for name .
|
String
(get)
|
ariba.ui.aribaweb.core
Class AWIncludeBlock
java.lang.Object
ariba.ui.aribaweb.util.AWBaseObject
ariba.ui.aribaweb.core.AWComponent
ariba.ui.aribaweb.core.AWIncludeBlock
- All Implemented Interfaces:
- AWCycleable, AWCycleableReference, AWResponseGenerating, AWResponseGenerating.ResponseSubstitution, AWObject
public final class AWIncludeBlock
- extends AWComponent
Methods inherited from class ariba.ui.aribaweb.core.AWComponent |
_topLevelApplyValues, _topLevelInvokeAction, _topLevelRenderResponse, allowEmbeddedKeyPaths, allowsWhitespaceCompression, application, applyValues, awcyclePageAndLog, 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, invokeAction, 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, renderResponse, 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, templateName, templateParser, templateResource, templateResourceManager, truncateBacktrackState, truncateBacktrackState, urlForResourceNamed, urlForResourceNamed, urlForResourceNamed, valueForBinding, valueForBinding, valueForBinding, xml |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_templateNameBinding
public AWBinding _templateNameBinding
AWIncludeBlock
public AWIncludeBlock()
template
public AWTemplate template()
- Extracts the template from the parentComponent's template by searching for
an AWBlock with the specified name. If the name bidning is constant
value, caches this template on the componentRef's userData,
otherwise re-extracts everytime.
- Overrides:
template
in class AWComponent
useXmlEscaping
public boolean useXmlEscaping()
- Overrides:
useXmlEscaping
in class AWComponent
bindingForName
public AWBinding bindingForName(java.lang.String bindingName,
boolean recursive)
- Overrides:
bindingForName
in class AWComponent
AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.