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 |
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException
_Extension, _IsEventLoggingEnabled, _keyAssociations
Constructor and Description |
---|
AjaxExpansion(com.webobjects.appserver.WOContext context)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRequiredWebResources(com.webobjects.appserver.WOResponse response)
Adds required resources for this component.
|
com.webobjects.appserver.WOActionResults |
handleRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.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() |
com.webobjects.appserver.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 AjaxExpansion(com.webobjects.appserver.WOContext context)
context
- a WOContext
public boolean synchronizesVariablesWithBindings()
synchronizesVariablesWithBindings
in class com.webobjects.appserver.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(com.webobjects.appserver.WOResponse response)
addRequiredWebResources
in class AjaxComponent
response
- the response to write topublic com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.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 com.webobjects.appserver.WOActionResults toggle()
null
public String onExpansionComplete()
onExpansionComplete
binding, or null
if
the component is not currently expanded.onExpansionComplete
binding, or null
Copyright © 2002 – 2020 Project Wonder.