public class AjaxExpansion extends AjaxComponent
AjaxExpansion
provides an easy way to make expansion areas that
appear and disappear by clicking a link. (For instance, expandable options
areas). The simple implementation of an expansion area would include wrapping
the toggle link in the AjaxUpdateContainer
. The problem with this
approach is that if you want to animate the appearance of the contents, the
animation affects the link as well as the contents. AjaxExpansion
instead only updates the contents, and applies an "expanded" class to the
link, which you can use to change the expansion icon in a stylesheet. (See
AjaxExample2's ToggleDetails example).
You can use an openedLabel
and closedLabel
binding to change
the link text. Or, if you want to use something fancier than a string as link
label, you can put an ERXWOTemplate
with templateName='label'
inside the component. If present, that will replace the label provided by the
string
binding.
<wo:AjaxExpansion id="contact" class="contact" insertion="Effect.blind"
insertionDuration="0.1" string="Contact" action="$hitMe">
<dl>
<dt>Phone</dt>
<dd>804.555.1212</dd>
<dt>Address</dt>
<dd>
123 Somewhere Rd.<br />
Richmond, VA 23233
</dd>
</dl>
</wo:AjaxExpansion>
Name | Description |
---|---|
id | the id of the contents div |
linkID | the id of the toggle link (defaults to "[id]Link") |
class | the class of the contents div |
linkClass | the class of the toggle link (always gets "expansion" added, and "expanded" when opened) |
expanded | optionally allows controlling the expansion state of the contents |
initiallyExpanded | optionally allows controlling the initial expansion state when the "expanded" binding is not used |
string | the string displayed for the link. For something fancier than a plain string, see above. |
openedLabel | the string to display when expanded. An alternative to
the string binding. |
closedLabel | the string to display when not expanded. An alternative
to the string binding. |
insertion | the insertion effect (see AjaxUpdateLink ) |
insertionDuration | the insertion effect duration (see
AjaxUpdateLink ) |
action | the action to fire when the hyperlink is clicked (that is, on expansion and contraction) |
onLoading | JavaScript function to evaluate when the update request begins |
onComplete | JavaScript function to evaluate when the update request has finished |
onSuccess | JavaScript function to evaluate when the update request was successful |
onFailure | JavaScript function to evaluate when the update request has failed |
onException | JavaScript function to evaluate when the update request had errors |
accesskey | hot key that should toggle the expansion (optional) |
onExpansionComplete | value for the AjaxUpdateContainer
onRefreshComplete binding when the contents are
expanded |
WOComponent._EventLoggingEnabler, WOComponent.Event
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
_Extension, _IsEventLoggingEnabled, _keyAssociations
_CLASS
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
_CLASS
Constructor and Description |
---|
AjaxExpansion(WOContext context)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRequiredWebResources(WOResponse response)
Adds required resources for this component.
|
WOActionResults |
handleRequest(WORequest request,
WOContext context)
Returns
null . |
String |
id()
Returns ID for
AjaxUpdateContainer . |
boolean |
isAjaxRequest()
Is this request an Ajax request?
|
boolean |
isExpanded()
Is the component currently expanded?
|
String |
jsEscapedString()
Returns an escaped version of
string() using
ERXStringUtilities.escapeJavascriptApostrophes(String) . |
String |
linkClass()
Returns CSS
class attribute value applied to the
AjaxUpdateLink , and the corresponding HTML hyperlink element. |
String |
linkID()
Returns ID for
AjaxUpdateLink . |
String |
onExpansionComplete()
Returns value of
onExpansionComplete binding, or null if
the component is not currently expanded. |
void |
setExpanded(boolean expanded)
Sets the current expansion state of the component to
expanded . |
String |
string()
Returns the label to render for the hyperlink, based on the
string or openedLabel and closedLabel bindings. |
boolean |
synchronizesVariablesWithBindings() |
WOActionResults |
toggle()
Toggles the current state of the component.
|
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, appendToResponse, booleanValueForBinding, invokeAction, safeElementID, shouldHandleRequest, valueForBinding, valueForBinding, valueForBinding
__valueForBinding, _associationWithName, _awakeInContext, _childTemplate, _cleanUpStatelessComponent, _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, isStateless, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
public boolean synchronizesVariablesWithBindings()
synchronizesVariablesWithBindings
in class WOComponent
public String linkID()
AjaxUpdateLink
.linkID
binding if set, otherwise value of
id()
with "Link" appendedpublic String linkClass()
class
attribute value applied to the
AjaxUpdateLink
, and the corresponding HTML hyperlink element.public String id()
AjaxUpdateContainer
.public String string()
string
or openedLabel
and closedLabel
bindings.public boolean isAjaxRequest()
true
if this request is an Ajax request, otherwise
false
public String jsEscapedString()
string()
using
ERXStringUtilities.escapeJavascriptApostrophes(String)
.protected void addRequiredWebResources(WOResponse response)
addRequiredWebResources
in class AjaxComponent
response
- the response to write topublic WOActionResults handleRequest(WORequest request, WOContext context)
null
.handleRequest
in interface IAjaxElement
handleRequest
in class AjaxComponent
request
- the requestcontext
- the contextnull
public boolean isExpanded()
true
if the component is currently expanded, otherwise
false
public void setExpanded(boolean expanded)
expanded
.expanded
- desired current expansion statepublic WOActionResults toggle()
null
public String onExpansionComplete()
onExpansionComplete
binding, or null
if
the component is not currently expanded.onExpansionComplete
binding, or null
Copyright © 2002 – 2024 Project Wonder.