use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class WOHelperFunctionParser method didParseClosingWebObjectTag.
public void didParseClosingWebObjectTag(String s, WOHelperFunctionHTMLParser htmlParser) throws WOHelperFunctionDeclarationFormatException, WOHelperFunctionHTMLFormatException, ClassNotFoundException {
WOHTMLWebObjectTag webobjectTag = _currentWebObjectTag.parentTag();
if (webobjectTag == null) {
throw new WOHelperFunctionHTMLFormatException("<" + getClass().getName() + "> Unbalanced WebObject tags. Either there is an extra closing </WEBOBJECT> tag in the html template, or one of the opening <WEBOBJECT ...> tag has a typo (extra spaces between a < sign and a WEBOBJECT tag ?).");
}
try {
WOElement element = _currentWebObjectTag.dynamicElement(_declarations, _languages);
_currentWebObjectTag = webobjectTag;
_currentWebObjectTag.addChildElement(element);
} catch (RuntimeException e) {
throw new RuntimeException("Unable to load the component named '" + componentName(_currentWebObjectTag) + "' with the declaration " + prettyDeclaration((WODeclaration) _declarations.objectForKey(_currentWebObjectTag.name())) + ". Make sure the .wo folder is where it's supposed to be and the name is spelled correctly.", e);
}
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOComponentContent method appendToResponse.
@Override
public void appendToResponse(WOResponse woresponse, WOContext wocontext) {
WOComponent component = wocontext.component();
WOElement template = template(component);
if (template != null) {
wocontext._setCurrentComponent(component.parent());
template.appendToResponse(woresponse, wocontext);
wocontext._setCurrentComponent(component);
} else {
_defaultTemplate.appendToResponse(woresponse, wocontext);
}
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOComponentContent method takeValuesFromRequest.
@Override
public void takeValuesFromRequest(WORequest worequest, WOContext wocontext) {
WOComponent component = wocontext.component();
WOElement template = template(component);
if (template != null) {
wocontext._setCurrentComponent(component.parent());
template.takeValuesFromRequest(worequest, wocontext);
wocontext._setCurrentComponent(component);
} else {
_defaultTemplate.takeValuesFromRequest(worequest, wocontext);
}
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOComponentContent method template.
private WOElement template(WOComponent component) {
WOElement content = component._childTemplate();
WOElement result = null;
String templateName = (_templateName == null) ? null : (String) _templateName.valueInComponent(component);
if (content != null && content.getClass() == WODynamicGroup.class) {
WODynamicGroup group = (WODynamicGroup) content;
if (templateName == null) {
// MS: If you don't set a template name, then let's construct all the children of
// this element that are NOT ERXWOTemplate's, so we don't double-display. This lets
// you use an ERXWOComponentContent and have it just act like a "default" template
// that skips all the children that are explicitly wrapped in an ERXWOTemplate.
NSMutableArray<WOElement> originalChildrenElements = group.childrenElements();
if (originalChildrenElements != null && originalChildrenElements.count() > 0) {
NSMutableArray<WOElement> nonTemplateChildrenElements = new NSMutableArray<>();
for (WOElement originalChild : originalChildrenElements) {
if (!(originalChild instanceof ERXWOTemplate)) {
nonTemplateChildrenElements.addObject(originalChild);
}
}
result = new WODynamicGroup(null, null, nonTemplateChildrenElements);
}
} else {
for (Enumeration e = group.childrenElements().objectEnumerator(); e.hasMoreElements() && result == null; ) {
WOElement current = (WOElement) e.nextElement();
if (current instanceof ERXWOTemplate) {
ERXWOTemplate template = (ERXWOTemplate) current;
String name = template.templateName(component);
if (name.equals(templateName)) {
result = template;
}
}
}
}
} else if (content instanceof ERXWOTemplate) {
ERXWOTemplate template = (ERXWOTemplate) content;
String name = template.templateName(component);
if (name.equals(templateName)) {
result = template;
}
} else if (templateName == null) {
result = content;
}
return result;
}
use of com.webobjects.appserver.WOElement in project wonder-slim by undur.
the class ERXWOSwitchComponent method takeValuesFromRequest.
@Override
public void takeValuesFromRequest(WORequest paramWORequest, WOContext paramWOContext) {
String name = componentNameInContext(paramWOContext.component());
String id = _elementNameInContext(name, paramWOContext);
paramWOContext.appendElementIDComponent(id);
WOElement localWOElement = _realComponentWithName(name, id, paramWOContext);
localWOElement.takeValuesFromRequest(paramWORequest, paramWOContext);
paramWOContext.deleteLastElementIDComponent();
}
Aggregations