|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.ajax.AjaxUtils
public class AjaxUtils
Properties | |
er.ajax.compressed | er.ajax.compressed |
er.extensions.ERXResponseRewriter.javascriptTypeAttribute | er.extensions.ERXResponseRewriter.javascriptTypeAttribute |
Constructor Summary | |
---|---|
AjaxUtils()
|
Method Summary | ||
---|---|---|
static void |
addResourceInHead(com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOResponse response,
java.lang.String framework,
java.lang.String fileName,
java.lang.String startTag,
java.lang.String endTag)
Deprecated. this is not called by anything anymore and does not use the new support for loading-on-demand |
|
static void |
addScriptCodeInHead(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
java.lang.String script)
Calls ERXWOContext.addScriptCodeInHead. |
|
static void |
addScriptResourceInHead(com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOResponse response,
java.lang.String fileName)
Calls ERXWOContext.addScriptResourceInHead with "Ajax" framework |
|
static void |
addScriptResourceInHead(com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOResponse response,
java.lang.String framework,
java.lang.String fileName)
Adds a script tag with a correct resource url in the html head tag if it isn't already present in the response. |
|
static void |
addStylesheetResourceInHead(com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOResponse response,
java.lang.String fileName)
Calls ERXWOContext.addStylesheetResourceInHead with "Ajax" framework |
|
static void |
addStylesheetResourceInHead(com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOResponse response,
java.lang.String framework,
java.lang.String fileName)
Calls ERXWOContext.addStylesheetResourceInHead |
|
static java.lang.String |
ajaxComponentActionUrl(com.webobjects.appserver.WOContext context)
Returns an Ajax component action url. |
|
static void |
appendScript(com.webobjects.appserver.WOContext context,
java.lang.String script)
Shortcut for appendScript. |
|
static void |
appendScript(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOResponse response,
java.lang.String script)
Appends the given javascript to the response, surrounding it in a script header/footer if necessary. |
|
static void |
appendScriptFooter(com.webobjects.appserver.WOResponse response)
|
|
static void |
appendScriptFooterIfNecessary(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOResponse response)
|
|
static void |
appendScriptHeader(com.webobjects.appserver.WOResponse response)
|
|
static void |
appendScriptHeaderIfNecessary(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOResponse response)
|
|
static void |
appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOComponent component,
com.webobjects.foundation.NSDictionary associations,
java.lang.String name)
|
|
static void |
appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOComponent component,
com.webobjects.foundation.NSDictionary associations,
java.lang.String name,
java.lang.String appendValue)
|
|
static void |
appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOComponent component,
java.lang.String name,
com.webobjects.appserver.WOAssociation association)
|
|
static void |
appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
com.webobjects.appserver.WOComponent component,
java.lang.String name,
com.webobjects.appserver.WOAssociation association,
java.lang.String appendValue)
|
|
static
|
arrayValueForAssociation(com.webobjects.appserver.WOComponent component,
com.webobjects.appserver.WOAssociation association)
Returns the array bound to the given association. |
|
static
|
arrayValueForBinding(com.webobjects.appserver.WOComponent component,
java.lang.String bindingName)
Returns the array bound to the given binding name. |
|
static
|
arrayValueForObject(java.lang.Object value)
Returns the array for the given object. |
|
static com.webobjects.appserver.WOAssociation |
bindingNamed(java.lang.String name,
com.webobjects.foundation.NSDictionary associations)
|
|
static boolean |
booleanValueForBinding(java.lang.String name,
boolean defaultValue,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOComponent component)
|
|
static AjaxResponse |
createResponse(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Creates a response for the given context (which can be null), sets the charset to UTF-8, the connection to keep-alive and flags it as a Ajax request by adding an AJAX_REQUEST_KEY header. |
|
static boolean |
hasBinding(java.lang.String name,
com.webobjects.foundation.NSDictionary associations)
|
|
static boolean |
isAjaxRequest(com.webobjects.appserver.WORequest request)
Return whether or not the given request is an Ajax request. |
|
static com.webobjects.appserver.WOResponse |
javascriptResponse(java.lang.String javascript,
com.webobjects.appserver.WOContext context)
Returns an AjaxResponse with the given javascript as the body of the response. |
|
static com.webobjects.foundation.NSMutableDictionary |
mutableUserInfo(com.webobjects.appserver.WOMessage message)
Returns the userInfo dictionary if the supplied message and replaces it with a mutable version if it isn't already one. |
|
static java.lang.String |
quote(java.lang.String value)
If the value is null, this returns "null", otherwise it returns '[value]'. |
|
static void |
redirectTo(com.webobjects.appserver.WOComponent component)
Creates (or modifies if already created) an AjaxResponse to redirect to the passed component with a component action. |
|
static void |
setPageReplacementCacheKey(com.webobjects.appserver.WOContext _context,
java.lang.String _key)
|
|
static void |
setValueForBinding(java.lang.Object value,
java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOComponent component)
|
|
static boolean |
shouldHandleRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context,
java.lang.String containerID)
|
|
static java.lang.String |
stringValueForBinding(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOComponent component)
|
|
static java.lang.String |
toSafeElementID(java.lang.String elementID)
Deprecated. replaced by ERXStringUtilities.safeIdentifierName |
|
static void |
updateDomElement(com.webobjects.appserver.WOResponse response,
java.lang.String id,
java.lang.Object value,
java.lang.String numberFormat,
java.lang.String dateFormat,
java.lang.String valueWhenEmpty)
updateDomElement appends JavaScript code to the given
AjaxResponse that updates the content of the DOM Element with the given
ID to the specified value. |
|
static void |
updateMutableUserInfoWithAjaxInfo(com.webobjects.appserver.WOContext context)
|
|
static void |
updateMutableUserInfoWithAjaxInfo(com.webobjects.appserver.WOMessage message)
|
|
static java.lang.Object |
valueForBinding(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOComponent component)
|
|
static java.lang.Object |
valueForBinding(java.lang.String name,
java.lang.Object defaultValue,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOComponent component)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AjaxUtils()
Method Detail |
---|
public static java.lang.String quote(java.lang.String value)
value
- the value to quote
public static boolean isAjaxRequest(com.webobjects.appserver.WORequest request)
request
- the request the checkpublic static void setPageReplacementCacheKey(com.webobjects.appserver.WOContext _context, java.lang.String _key)
public static AjaxResponse createResponse(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
context
- public static com.webobjects.foundation.NSMutableDictionary mutableUserInfo(com.webobjects.appserver.WOMessage message)
message
- public static void addScriptResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName)
response
- fileName
- public static void addScriptResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String fileName)
public static void addStylesheetResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName)
public static void addStylesheetResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String fileName)
public static void addResourceInHead(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOResponse response, java.lang.String framework, java.lang.String fileName, java.lang.String startTag, java.lang.String endTag)
response
- fileName
- startTag
- endTag
- public static void addScriptCodeInHead(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, java.lang.String script)
public static java.lang.String toSafeElementID(java.lang.String elementID)
public static boolean shouldHandleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context, java.lang.String containerID)
public static void updateMutableUserInfoWithAjaxInfo(com.webobjects.appserver.WOContext context)
public static void updateMutableUserInfoWithAjaxInfo(com.webobjects.appserver.WOMessage message)
public static com.webobjects.appserver.WOResponse javascriptResponse(java.lang.String javascript, com.webobjects.appserver.WOContext context)
context
- the WOContextjavascript
- the javascript to send
public static void appendScript(com.webobjects.appserver.WOContext context, java.lang.String script)
context
- the contextscript
- the script to appendpublic static void appendScript(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOResponse response, java.lang.String script)
request
- the requestresponse
- the responsescript
- the script to appendpublic static void appendScriptHeaderIfNecessary(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOResponse response)
public static void appendScriptHeader(com.webobjects.appserver.WOResponse response)
public static void appendScriptFooterIfNecessary(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOResponse response)
public static void appendScriptFooter(com.webobjects.appserver.WOResponse response)
public static boolean hasBinding(java.lang.String name, com.webobjects.foundation.NSDictionary associations)
public static com.webobjects.appserver.WOAssociation bindingNamed(java.lang.String name, com.webobjects.foundation.NSDictionary associations)
public static java.lang.Object valueForBinding(java.lang.String name, java.lang.Object defaultValue, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOComponent component)
public static java.lang.String stringValueForBinding(java.lang.String name, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOComponent component)
public static java.lang.Object valueForBinding(java.lang.String name, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOComponent component)
public static boolean booleanValueForBinding(java.lang.String name, boolean defaultValue, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOComponent component)
public static void setValueForBinding(java.lang.Object value, java.lang.String name, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOComponent component)
public static <T> com.webobjects.foundation.NSArray<T> arrayValueForAssociation(com.webobjects.appserver.WOComponent component, com.webobjects.appserver.WOAssociation association)
T
- the array typecomponent
- the component to resolve againstassociation
- the association to retrieve a value for
public static <T> com.webobjects.foundation.NSArray<T> arrayValueForBinding(com.webobjects.appserver.WOComponent component, java.lang.String bindingName)
T
- the array typecomponent
- the component to resolve againstbindingName
- the name of the binding
public static <T> com.webobjects.foundation.NSArray<T> arrayValueForObject(java.lang.Object value)
T
- the array typevalue
- the object value
public static java.lang.String ajaxComponentActionUrl(com.webobjects.appserver.WOContext context)
context
- the context of the request
public static void appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOComponent component, com.webobjects.foundation.NSDictionary associations, java.lang.String name)
public static void appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOComponent component, com.webobjects.foundation.NSDictionary associations, java.lang.String name, java.lang.String appendValue)
public static void appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOComponent component, java.lang.String name, com.webobjects.appserver.WOAssociation association)
public static void appendTagAttributeAndValue(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOComponent component, java.lang.String name, com.webobjects.appserver.WOAssociation association, java.lang.String appendValue)
public static void redirectTo(com.webobjects.appserver.WOComponent component)
component
- full page WOComponent instance to redirect topublic static void updateDomElement(com.webobjects.appserver.WOResponse response, java.lang.String id, java.lang.Object value, java.lang.String numberFormat, java.lang.String dateFormat, java.lang.String valueWhenEmpty)
updateDomElement
appends JavaScript code to the given
AjaxResponse that updates the content of the DOM Element with the given
ID to the specified value. Useful if you want to update multiple small
regions on a page with a single request, e.g. when an AjaxObserveField
triggers an action.
This method is also available on instances. The example
below uses the method on AjaxResponse.
public WOActionResults cartItemChanged() { ShoppingCart cart; // assume this exists ShoppingCartItem item; // assume this exists AjaxResponse response = AjaxUtils.createResponse(context().request(), context()); response.appendScriptHeaderIfNecessary(); response.updateDomElement("orderAmount_" + item.primaryKey(), item.orderAmount(), "#,##0.", null, null); response.updateDomElement("price_" + item.primaryKey(), item.priceForOrderAmount(), "#,##0.00", null, null); response.updateDomElement("shoppingCartPrice", cart.totalPrice(), "#,##0.00", null, null); response.appendScriptFooterIfNecessary(); return response; }
response
- The response to append the JavaScript toid
- ID of the DOM element to updatevalue
- The new valuenumberFormat
- optional number format to format the value withdateFormat
- optional date format to format the value withvalueWhenEmpty
- string to use when value is nullAjaxResponse#updateDomElement(String, Object, String, String, String)
,
AjaxResponse#updateDomElement(String, Object)
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |