|
Project Wonder 5.0 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.webobjects.appserver.WOElement
com.webobjects.appserver.WODynamicElement
er.ajax.AjaxOptions
public class AjaxOptions
AjaxOptions provides a mechanism to produce a JSON formatted dictionary from binding names and / or a dictionary. This is intended to support the options parameter in Prototype, e.g. the second parameter here:
new Ajax.Request('/some_url', {
method: 'get',
parameters: {company: 'example', limit: 12}
});
However, the functionality is not specific to Prototype and can be used anywhere a JSON formatted dictionary is needed.
AjaxOptions can be used either in a HTML/WOD setting, e.g.
AjaxOptions : AjaxOptions {
method = "get";
options = createAjaxOptions;
}
with options bound to a dictionary produced by AjaxOption, or it can be used directly in Java, e.g.
AjaxOptions.appendToResponse(createAjaxOptions(), context.response(), context);
Example (and fictitious) usage code:
public NSDictionary createAjaxOptions(WOComponent component) {
NSMutableArray ajaxOptionsArray = new NSMutableArray();
ajaxOptionsArray.addObject(new AjaxOption("frequency", AjaxOption.NUMBER));
ajaxOptionsArray.addObject(new AjaxOption("onLoading", AjaxOption.SCRIPT));
ajaxOptionsArray.addObject(new AjaxOption("evalScripts", Boolean.TRUE, AjaxOption.BOOLEAN));
ajaxOptionsArray.addObject(new AjaxOption("method", "get", AjaxOption.STRING));
...
NSMutableDictionary options = AjaxOption.createAjaxOptionsDictionary(ajaxOptionsArray, component, associations());
return options;
}
response.appendContentString("AUC.registerPeriodic('" + id + "'," + canStop + "," + stopped + ",");
AjaxOptions.appendToResponse(options, response, context);
response.appendContentString(");");
AjaxOption,
AjaxValue| Field Summary |
|---|
| Fields inherited from class com.webobjects.appserver.WODynamicElement |
|---|
_ConstructorParameters |
| Constructor Summary | |
|---|---|
AjaxOptions(String name,
NSDictionary bindings,
WOElement children)
|
|
| Method Summary | |
|---|---|
static void |
_appendToBuffer(NSDictionary options,
StringBuffer stringBuffer,
WOContext context)
Adds JSON formatted key-value pairs from options to end of response content. |
static void |
_appendToResponse(NSDictionary options,
WOResponse response,
WOContext context)
Adds JSON formatted key-value pairs from options to end of response content. |
static void |
appendToBuffer(NSDictionary options,
StringBuffer stringBuffer,
WOContext context)
Adds JSON formatted key-value pairs from options to end of response content. |
static void |
appendToResponse(NSDictionary options,
WOResponse response,
WOContext context)
Adds JSON formatted key-value pairs from options to end of response content. |
void |
appendToResponse(WOResponse response,
WOContext context)
|
| Methods inherited from class com.webobjects.appserver.WODynamicElement |
|---|
toString |
| Methods inherited from class com.webobjects.appserver.WOElement |
|---|
invokeAction, takeValuesFromRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AjaxOptions(String name,
NSDictionary bindings,
WOElement children)
| Method Detail |
|---|
public void appendToResponse(WOResponse response,
WOContext context)
appendToResponse in class WOElement
public static void _appendToResponse(NSDictionary options,
WOResponse response,
WOContext context)
options - dictionary of key-value pairs, intended to have come from AjaxOptionresponse - WOResponse to add JSON formatted key-value pairs tocontext - WOContext to provide WOComponent to resolve binding values in
public static void _appendToBuffer(NSDictionary options,
StringBuffer stringBuffer,
WOContext context)
options - dictionary of key-value pairs, intended to have come from AjaxOptionstringBuffer - StringBuffer to add JSON formatted key-value pairs tocontext - WOContext to provide WOComponent to resolve binding values in
public static void appendToBuffer(NSDictionary options,
StringBuffer stringBuffer,
WOContext context)
options - dictionary of key-value pairs, intended to have come from AjaxOptionstringBuffer - StringBuffer to add JSON formatted key-value pairs tocontext - WOContext to provide WOComponent to resolve binding values in
public static void appendToResponse(NSDictionary options,
WOResponse response,
WOContext context)
options - dictionary of key-value pairs, intended to have come from AjaxOptionresponse - WOResponse to add JSON formatted key-value pairs tocontext - WOContext to provide WOComponent to resolve binding values in
|
Last updated: Wed, Feb 22, 2012 07:00 AM EST | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||