use of com.webobjects.appserver._private.WODynamicGroup in project wonder-slim by undur.
the class WOHTMLWebObjectTag method template.
public WOElement template() {
NSMutableArray nsmutablearray = null;
if (_children == null) {
return null;
}
Enumeration enumeration = _children.objectEnumerator();
if (enumeration != null) {
nsmutablearray = new NSMutableArray(_children.count());
StringBuilder stringbuffer = new StringBuilder(128);
while (enumeration.hasMoreElements()) {
Object obj1 = enumeration.nextElement();
if (obj1 instanceof String) {
stringbuffer.append((String) obj1);
} else {
if (stringbuffer.length() > 0) {
WOHTMLBareString wohtmlbarestring1 = new WOHTMLBareString(stringbuffer.toString());
nsmutablearray.addObject(wohtmlbarestring1);
stringbuffer.setLength(0);
}
nsmutablearray.addObject(obj1);
}
}
if (stringbuffer.length() > 0) {
WOHTMLBareString wohtmlbarestring = new WOHTMLBareString(stringbuffer.toString());
stringbuffer.setLength(0);
nsmutablearray.addObject(wohtmlbarestring);
}
}
WOElement obj = null;
if (nsmutablearray != null && nsmutablearray.count() == 1) {
Object obj2 = nsmutablearray.objectAtIndex(0);
if (obj2 instanceof WOComponentReference) {
obj = new WODynamicGroup(_name, null, (WOElement) obj2);
} else {
obj = (WOElement) obj2;
}
} else {
obj = new WODynamicGroup(_name, null, nsmutablearray);
}
return obj;
}
use of com.webobjects.appserver._private.WODynamicGroup in project wonder-slim by undur.
the class WOHTMLWebObjectTag method template.
public WOElement template() {
NSMutableArray nsmutablearray = null;
if (_children == null) {
return null;
}
Enumeration enumeration = _children.objectEnumerator();
if (enumeration != null) {
nsmutablearray = new NSMutableArray(_children.count());
StringBuilder stringbuffer = new StringBuilder(128);
while (enumeration.hasMoreElements()) {
Object obj1 = enumeration.nextElement();
if (obj1 instanceof String) {
stringbuffer.append((String) obj1);
} else {
if (stringbuffer.length() > 0) {
WOHTMLBareString wohtmlbarestring1 = new WOHTMLBareString(stringbuffer.toString());
nsmutablearray.addObject(wohtmlbarestring1);
stringbuffer.setLength(0);
}
nsmutablearray.addObject(obj1);
}
}
if (stringbuffer.length() > 0) {
WOHTMLBareString wohtmlbarestring = new WOHTMLBareString(stringbuffer.toString());
stringbuffer.setLength(0);
nsmutablearray.addObject(wohtmlbarestring);
}
}
WOElement obj = null;
if (nsmutablearray != null && nsmutablearray.count() == 1) {
Object obj2 = nsmutablearray.objectAtIndex(0);
if (obj2 instanceof WOComponentReference) {
obj = new WODynamicGroup(_name, null, (WOElement) obj2);
} else {
obj = (WOElement) obj2;
}
} else {
obj = new WODynamicGroup(_name, null, nsmutablearray);
}
return obj;
}
use of com.webobjects.appserver._private.WODynamicGroup 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._private.WODynamicGroup 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);
}
}
}
Aggregations