use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class AjaxModalContainer method handleRequest.
@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
WOComponent component = context.component();
WOResponse response = null;
WOAssociation action = associations().objectForKey("action");
if (action != null) {
action.valueInComponent(component);
}
if (booleanValueForBinding("ajax", false, component) && hasChildrenElements()) {
response = AjaxUtils.createResponse(request, context);
AjaxUtils.setPageReplacementCacheKey(context, _containerID(context));
appendChildrenToResponse(response, context);
}
return response;
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class AjaxTabbedPanelTab method appendToResponse.
/**
* Creates the panes.
*/
@Override
public void appendToResponse(WOResponse aResponse, WOContext aContext) {
WOComponent component = aContext.component();
if (isVisble(component)) {
aResponse.appendContentString("<li id=\"");
aResponse.appendContentString(tabIdInComponent(component) + "_panel");
aResponse.appendContentString("\" data-updateUrl=\"");
aResponse.appendContentString(AjaxUtils.ajaxComponentActionUrl(aContext));
aResponse.appendContentString("\" class=\"");
aResponse.appendContentString(isSelected(component) ? "ajaxTabbedPanelPane-selected" : "ajaxTabbedPanelPane-unselected");
aResponse.appendContentString("\"");
if (onLoad != null) {
appendTagAttributeToResponse(aResponse, "onLoad", onLoad.valueInComponent(component));
}
aResponse.appendContentString(">");
// it is controlled by the user clicking tabs
if (isSelected(component) && content != null) {
content.appendToResponse(aResponse, aContext);
}
aResponse.appendContentString("</li>\n");
// it is fired by the user clicking tabs
if (isSelected(component) && content != null) {
aResponse.appendContentString("<script>AjaxTabbedPanel.onLoad('");
aResponse.appendContentString(tabIdInComponent(component) + "_panel");
aResponse.appendContentString("');</script>\n");
}
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class AjaxToggleLink method _appendAttributesToResponse.
public static void _appendAttributesToResponse(WOResponse response, WOContext context, WOAssociation toggleIDAssociation, WOAssociation effectAssociation, WOAssociation durationAssociation) {
WOComponent component = context.component();
String effect = null;
if (effectAssociation != null) {
effect = (String) effectAssociation.valueInComponent(component);
}
if (effect == null) {
effect = "blind";
}
String toggleID = (String) toggleIDAssociation.valueInComponent(component);
// PROTOTYPE EFFECTS
response.appendContentString(" onclick = \"Effect.toggle($wi('");
response.appendContentString(toggleID);
response.appendContentString("'), '");
response.appendContentString(effect);
response.appendContentString("', ");
NSMutableDictionary<String, WOAssociation> options = new NSMutableDictionary<>();
if (durationAssociation != null) {
options.setObjectForKey(durationAssociation, "duration");
}
AjaxOptions.appendToResponse(options, response, context);
response.appendContentString(")\"");
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class AjaxUpdateContainer method appendToResponse.
@Override
public void appendToResponse(WOResponse response, WOContext context) {
WOComponent component = context.component();
if (!shouldRenderContainer(component)) {
if (hasChildrenElements()) {
appendChildrenToResponse(response, context);
}
super.appendToResponse(response, context);
} else {
String previousUpdateContainerID = AjaxUpdateContainer.currentUpdateContainerID();
try {
String elementName = (String) valueForBinding("elementName", "div", component);
String id = _containerID(context);
AjaxUpdateContainer.setCurrentUpdateContainerID(_containerID(context));
response.appendContentString("<" + elementName + " ");
appendTagAttributeToResponse(response, "id", id);
appendTagAttributeToResponse(response, "class", valueForBinding("class", component));
appendTagAttributeToResponse(response, "style", valueForBinding("style", component));
appendTagAttributeToResponse(response, "data-updateUrl", AjaxUtils.ajaxComponentActionUrl(context));
// appendTagAttributeToResponse(response, "woElementID", context.elementID());
response.appendContentString(">");
if (hasChildrenElements()) {
appendChildrenToResponse(response, context);
}
response.appendContentString("</" + elementName + ">");
super.appendToResponse(response, context);
NSDictionary options = createAjaxOptions(component);
Object frequency = valueForBinding("frequency", component);
String observeFieldID = (String) valueForBinding("observeFieldID", component);
boolean skipFunction = frequency == null && observeFieldID == null && booleanValueForBinding("skipFunction", false, component);
if (!skipFunction) {
AjaxUtils.appendScriptHeader(response);
if (frequency != null) {
// try to convert to a number to check whether it is 0
boolean isNotZero = true;
try {
float numberFrequency = ERXValueUtilities.floatValue(frequency);
if (numberFrequency == 0.0) {
// set this only to false if it can be converted to 0
isNotZero = false;
}
} catch (RuntimeException e) {
throw new IllegalStateException("Error parsing float from value : <" + frequency + ">");
}
if (isNotZero) {
boolean canStop = false;
boolean stopped = false;
if (associations().objectForKey("stopped") != null) {
canStop = true;
stopped = booleanValueForBinding("stopped", false, component);
}
response.appendContentString("AUC.registerPeriodic('" + id + "'," + canStop + "," + stopped + ",");
AjaxOptions.appendToResponse(options, response, context);
response.appendContentString(");");
}
}
if (observeFieldID != null) {
boolean fullSubmit = booleanValueForBinding("fullSubmit", false, component);
AjaxObserveField.appendToResponse(response, context, this, observeFieldID, false, id, fullSubmit, createObserveFieldOptions(component));
}
response.appendContentString("AUC.register('" + id + "'");
NSDictionary nonDefaultOptions = AjaxUpdateContainer.removeDefaultOptions(options);
if (nonDefaultOptions.count() > 0) {
response.appendContentString(", ");
AjaxOptions.appendToResponse(nonDefaultOptions, response, context);
}
response.appendContentString(");");
AjaxUtils.appendScriptFooter(response);
}
} finally {
AjaxUpdateContainer.setCurrentUpdateContainerID(previousUpdateContainerID);
}
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class AjaxUpdateLink method handleRequest.
@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
WOComponent component = context.component();
boolean disabled = booleanValueForBinding("disabled", false, component);
String updateContainerID = AjaxUpdateContainer.updateContainerID(this, component);
AjaxUpdateContainer.setUpdateContainerID(request, updateContainerID);
WOActionResults results = null;
if (!disabled) {
results = (WOActionResults) valueForBinding("action", component);
}
if (ERXAjaxApplication.isAjaxReplacement(request)) {
AjaxUtils.setPageReplacementCacheKey(context, (String) valueForBinding("replaceID", component));
} else if (results == null || booleanValueForBinding("ignoreActionResponse", false, component)) {
String script = (String) valueForBinding("onClickServer", component);
if (script != null) {
WOResponse response = AjaxUtils.createResponse(request, context);
AjaxUtils.appendScriptHeaderIfNecessary(request, response);
response.appendContentString(script);
AjaxUtils.appendScriptFooterIfNecessary(request, response);
results = response;
}
} else if (updateContainerID != null) {
AjaxUtils.setPageReplacementCacheKey(context, updateContainerID);
}
return results;
}
Aggregations