use of com.webobjects.appserver.WOAssociation in project wonder-slim by undur.
the class ERXComponentUtilities method appendHtmlAttributes.
/**
* Appends a dictionary of associations as HTML attributes.
*
* @param associations
* the associations dictionary
* @param response
* the response to write to
* @param component
* the component to evaluate the associations within
*/
public static void appendHtmlAttributes(NSDictionary<String, WOAssociation> associations, WOResponse response, WOComponent component) {
for (String key : associations.allKeys()) {
WOAssociation association = associations.objectForKey(key);
ERXComponentUtilities.appendHtmlAttribute(key, association, response, component);
}
}
use of com.webobjects.appserver.WOAssociation in project wonder-slim by undur.
the class AjaxOption method valueInComponent.
/*
* Bridge to an AjaxDynamicElement.
*/
protected Object valueInComponent(WOComponent component, NSDictionary<String, ? extends WOAssociation> associations) {
Object value = null;
if (associations != null) {
value = associations.objectForKey(_bindingName);
// This is needed for the double step to resolve the value for ^ notation
if (value instanceof WOAssociation) {
WOAssociation association = (WOAssociation) value;
value = association.valueInComponent(component);
}
}
if (value == null) {
value = _defaultValue;
}
return value;
}
use of com.webobjects.appserver.WOAssociation in project wonder-slim by undur.
the class AjaxOption method valueInComponent.
/*
* Bridge to an AjaxComponent.
*/
protected Object valueInComponent(WOComponent component) {
Object value = component.valueForBinding(_bindingName);
if (value instanceof WOAssociation) {
WOAssociation association = (WOAssociation) value;
value = association.valueInComponent(component);
}
if (value == null) {
value = _defaultValue;
}
return value;
}
use of com.webobjects.appserver.WOAssociation in project wonder-slim by undur.
the class AjaxOptions method _appendToBuffer.
/**
* Adds JSON formatted key-value pairs from options to end of response content. Does not adds the surrounding "{" and "}" signifying a dictionary / object.
*
* @param options dictionary of key-value pairs, intended to have come from AjaxOption
* @param appendable appendable to add JSON formatted key-value pairs to
* @param context WOContext to provide WOComponent to resolve binding values in
*/
public static void _appendToBuffer(NSDictionary options, Appendable appendable, WOContext context) {
if (options != null) {
WOComponent component = context.component();
boolean hasPreviousOptions = false;
Enumeration bindingsEnum = options.keyEnumerator();
while (bindingsEnum.hasMoreElements()) {
String bindingName = (String) bindingsEnum.nextElement();
if (!"options".equals(bindingName)) {
Object bindingValue = options.objectForKey(bindingName);
// This is needed for the double step to resolve the value for ^ notation
if (bindingValue instanceof WOAssociation) {
WOAssociation association = (WOAssociation) bindingValue;
bindingValue = association.valueInComponent(component);
}
if (bindingValue != null) {
try {
if (hasPreviousOptions) {
appendable.append(", ");
}
appendable.append(bindingName);
appendable.append(':');
appendable.append(bindingValue.toString());
hasPreviousOptions = true;
} catch (IOException e) {
// ignore
}
}
}
}
}
}
use of com.webobjects.appserver.WOAssociation in project wonder-slim by undur.
the class AjaxOptions method appendToResponse.
@Override
public void appendToResponse(WOResponse response, WOContext context) {
response.appendContentCharacter('{');
NSMutableDictionary options = _associations;
WOAssociation optionsBinding = _associations.objectForKey("options");
if (optionsBinding != null) {
NSDictionary passedInOptions = (NSDictionary) optionsBinding.valueInComponent(context.component());
if (passedInOptions != null) {
options = passedInOptions.mutableClone();
options.addEntriesFromDictionary(_associations);
}
}
AjaxOptions._appendToResponse(options, response, context);
if (_children != null) {
_children.appendToResponse(response, context);
}
response.appendContentCharacter('}');
}
Aggregations