Search in sources :

Example 1 with WOElement

use of com.webobjects.appserver.WOElement 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;
}
Also used : Enumeration(java.util.Enumeration) NSMutableArray(com.webobjects.foundation.NSMutableArray) WODynamicGroup(com.webobjects.appserver._private.WODynamicGroup) WOHTMLBareString(com.webobjects.appserver._private.WOHTMLBareString) WOHTMLBareString(com.webobjects.appserver._private.WOHTMLBareString) WOComponentReference(com.webobjects.appserver._private.WOComponentReference) WOElement(com.webobjects.appserver.WOElement)

Example 2 with WOElement

use of com.webobjects.appserver.WOElement in project wonder-slim by undur.

the class WOHelperFunctionParser method parseHTML.

private WOElement parseHTML() throws WOHelperFunctionHTMLFormatException, WOHelperFunctionDeclarationFormatException, ClassNotFoundException {
    WOElement currentWebObjectTemplate = null;
    if (_HTMLString != null && _declarations != null) {
        WOHelperFunctionHTMLParser htmlParser = new WOHelperFunctionHTMLParser(this, _HTMLString);
        htmlParser.parseHTML();
        String webobjectTagName = _currentWebObjectTag.name();
        if (webobjectTagName != null) {
            throw new WOHelperFunctionHTMLFormatException("There is an unbalanced WebObjects tag named '" + webobjectTagName + "'.");
        }
        currentWebObjectTemplate = _currentWebObjectTag.template();
    }
    return currentWebObjectTemplate;
}
Also used : WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString) WOElement(com.webobjects.appserver.WOElement)

Example 3 with WOElement

use of com.webobjects.appserver.WOElement in project wonder-slim by undur.

the class WOIFrame method frameContent.

public WOElement frameContent() {
    WOElement aContentElement = null;
    if (hasBinding("pageName")) {
        String aPageName = (String) _WOJExtensionsUtil.valueForBindingOrNull("pageName", this);
        aContentElement = pageWithName(aPageName);
    } else if (hasBinding("value")) {
        aContentElement = (WOElement) _WOJExtensionsUtil.valueForBindingOrNull("value", this);
    } else if (hasBinding("actionName")) {
        aContentElement = (WOElement) parent().valueForBinding((String) valueForBinding("actionName"));
    }
    return aContentElement;
}
Also used : WOElement(com.webobjects.appserver.WOElement)

Example 4 with WOElement

use of com.webobjects.appserver.WOElement in project wonder-slim by undur.

the class WOHTMLWebObjectTag method _elementWithDeclaration.

private static WOElement _elementWithDeclaration(WODeclaration wodeclaration, String s, WOElement woelement, NSArray nsarray) throws ClassNotFoundException, WOHelperFunctionDeclarationFormatException {
    WOElement woelement1 = null;
    if (wodeclaration != null) {
        String s1 = wodeclaration.type();
        if (s1 != null) {
            if (NSLog.debugLoggingAllowedForLevelAndGroups(3, 8388608L)) {
                NSLog.debug.appendln("<WOHTMLWebObjectTag> will look for " + s1 + " in the java runtime.");
            }
            Class class1 = _NSUtilities.classWithName(s1);
            if (class1 == null) {
                if (NSLog.debugLoggingAllowedForLevelAndGroups(3, 8388608L)) {
                    NSLog.debug.appendln("<WOHTMLWebObjectTag> will look for com.webobjects.appserver._private." + s1 + " .");
                }
                class1 = WOBundle.lookForClassInAllBundles(s1);
                if (class1 == null) {
                    NSLog.err.appendln("WOBundle.lookForClassInAllBundles(" + s1 + ") failed!");
                } else if (!(com.webobjects.appserver.WODynamicElement.class).isAssignableFrom(class1)) {
                    class1 = null;
                }
            }
            if (class1 != null) {
                if (NSLog.debugLoggingAllowedForLevelAndGroups(3, 8388608L)) {
                    NSLog.debug.appendln("<WOHTMLWebObjectTag> Will initialize object of class " + s1);
                }
                if ((com.webobjects.appserver.WOComponent.class).isAssignableFrom(class1)) {
                    if (NSLog.debugLoggingAllowedForLevelAndGroups(3, 8388608L)) {
                        NSLog.debug.appendln("<WOHTMLWebObjectTag> will look for " + s1 + " in the Compiled Components.");
                    }
                    woelement1 = _componentReferenceWithClassNameDeclarationAndTemplate(s1, wodeclaration, woelement, nsarray);
                } else {
                    woelement1 = _elementWithClass(class1, wodeclaration, woelement);
                }
            } else {
                if (NSLog.debugLoggingAllowedForLevelAndGroups(3, 8388608L)) {
                    NSLog.debug.appendln("<WOHTMLWebObjectTag> will look for " + s1 + " in the Frameworks.");
                }
                woelement1 = _componentReferenceWithClassNameDeclarationAndTemplate(s1, wodeclaration, woelement, nsarray);
            }
        } else {
            throw new WOHelperFunctionDeclarationFormatException("<WOHTMLWebObjectTag> declaration object for dynamic element (or component) named " + s + "has no class name.");
        }
    } else {
        throw new WOHelperFunctionDeclarationFormatException("<WOHTMLTemplateParser> no declaration for dynamic element (or component) named " + s);
    }
    WOGenerationSupport.insertInElementsTableWithName(woelement1, s, wodeclaration.associations());
    return woelement1;
}
Also used : WOHTMLBareString(com.webobjects.appserver._private.WOHTMLBareString) WOElement(com.webobjects.appserver.WOElement)

Example 5 with WOElement

use of com.webobjects.appserver.WOElement 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;
}
Also used : Enumeration(java.util.Enumeration) NSMutableArray(com.webobjects.foundation.NSMutableArray) WODynamicGroup(com.webobjects.appserver._private.WODynamicGroup) WOHTMLBareString(com.webobjects.appserver._private.WOHTMLBareString) WOHTMLBareString(com.webobjects.appserver._private.WOHTMLBareString) WOComponentReference(com.webobjects.appserver._private.WOComponentReference) WOElement(com.webobjects.appserver.WOElement)

Aggregations

WOElement (com.webobjects.appserver.WOElement)26 WOHTMLBareString (com.webobjects.appserver._private.WOHTMLBareString)8 Enumeration (java.util.Enumeration)6 WODeclaration (com.webobjects.appserver._private.WODeclaration)4 WODynamicGroup (com.webobjects.appserver._private.WODynamicGroup)4 WOComponent (com.webobjects.appserver.WOComponent)3 NSMutableArray (com.webobjects.foundation.NSMutableArray)3 WOActionResults (com.webobjects.appserver.WOActionResults)2 WOComponentReference (com.webobjects.appserver._private.WOComponentReference)2 WOHTMLCommentString (com.webobjects.appserver._private.WOHTMLCommentString)2 NSArray (com.webobjects.foundation.NSArray)2 WOResponse (com.webobjects.appserver.WOResponse)1 WOConstantValueAssociation (com.webobjects.appserver._private.WOConstantValueAssociation)1 WODynamicElementCreationException (com.webobjects.appserver._private.WODynamicElementCreationException)1 ERXWOTemplate (er.extensions.components.conditionals.ERXWOTemplate)1 Iterator (java.util.Iterator)1 List (java.util.List)1