use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOSwitchComponent method appendToResponse.
@Override
public void appendToResponse(WOResponse paramWOResponse, WOContext paramWOContext) {
String name = componentNameInContext(paramWOContext.component());
String id = _elementNameInContext(name, paramWOContext);
paramWOContext.appendElementIDComponent(id);
WOElement localWOElement = _realComponentWithName(name, id, paramWOContext);
localWOElement.appendToResponse(paramWOResponse, paramWOContext);
paramWOContext.deleteLastElementIDComponent();
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOSwitch method childCaseInContext.
protected WOElement childCaseInContext(WOContext context) {
Object value = _case.valueInComponent(context.component());
value = (value == null ? "default" : value);
WOElement result = _childCases.objectForKey(value);
if (result == null) {
result = _childCases.objectForKey("default");
}
if (result == null) {
result = new WOHTMLBareString("");
}
return result;
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class AjaxTabbedPanel method findTabs.
/**
* Looks through the child components to locate the AjaxTabbedPanelTabs that are controlled by this panel.
* Tabs without an explicit id attributed are assigned a calculated one.
*
* @param template the graph of elements passed to the constructor.
*/
private void findTabs(WODynamicGroup template) {
if (template == null || template.childrenElements() == null)
return;
NSArray children = template.childrenElements();
for (int i = 0; i < children.count(); i++) {
WOElement child = (WOElement) children.objectAtIndex(i);
if (child instanceof AjaxTabbedPanelTab) {
AjaxTabbedPanelTab childTab = (AjaxTabbedPanelTab) child;
// The tabs need to have an id attribute so we assign one if needed
if (childTab.id() == null) {
childTab.setParentId(id);
childTab.setTabNumber(new WOConstantValueAssociation("_pane_" + tabs.count()));
}
tabs.addObject(childTab);
} else if (child instanceof WODynamicGroup) {
findTabs((WODynamicGroup) child);
}
}
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class AjaxAutoComplete method handleRequest.
/**
* Handles the Ajax request. Checks for the form value in the edit field,
* pushes it up to the parent and pulls the "list" binding. The parent is
* responsible for returning a list with some items that match the current value.
*/
@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
// String inputString = request.contentString();
String fieldValue = context.request().stringFormValueForKey(fieldName);
setValueForBinding(fieldValue, "value");
WOResponse response = AjaxUtils.createResponse(request, context);
response.appendContentString("<ul>");
int maxItems = maxItems();
int itemsCount = 0;
Object values = valueForBinding("list");
WOElement child = _childTemplate();
boolean hasItem = hasBinding("item");
if (values instanceof NSArray) {
for (Enumeration valueEnum = ((NSArray) values).objectEnumerator(); valueEnum.hasMoreElements() && itemsCount++ < maxItems; ) {
appendItemToResponse(valueEnum.nextElement(), child, hasItem, response, context);
}
} else if (values instanceof List) {
for (Iterator iter = ((List) values).iterator(); iter.hasNext() && itemsCount++ < maxItems; ) {
appendItemToResponse(iter.next(), child, hasItem, response, context);
}
} else if (values instanceof Object[]) {
Object[] array = (Object[]) values;
for (int i = 0; i < array.length && i < maxItems; i++) {
appendItemToResponse(array[i], child, hasItem, response, context);
}
} else if (values != null) {
log.warn("Unsupported class type for list: {}", values.getClass().getCanonicalName());
}
response.appendContentString("</ul>");
return response;
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class WOHTMLWebObjectTag method dynamicElement.
public WOElement dynamicElement(NSDictionary nsdictionary, NSArray nsarray) throws WOHelperFunctionDeclarationFormatException, ClassNotFoundException {
String s = name();
WOElement woelement = template();
WODeclaration wodeclaration = (WODeclaration) nsdictionary.objectForKey(s);
return _elementWithDeclaration(wodeclaration, s, woelement, nsarray);
}
Aggregations