Search in sources :

Example 11 with WOConstantValueAssociation

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

the class AjaxInPlaceViewTemplate method processAssociations.

protected static NSDictionary processAssociations(NSDictionary associations) {
    NSMutableDictionary mutableAssociations = (NSMutableDictionary) associations;
    mutableAssociations.setObjectForKey(new WOConstantValueAssociation("view"), "templateName");
    return mutableAssociations;
}
Also used : WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation) NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 12 with WOConstantValueAssociation

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

the class AjaxFunctionLink method processAssociations.

protected static NSDictionary processAssociations(NSDictionary associations) {
    NSMutableDictionary mutableAssociations = (NSMutableDictionary) associations;
    mutableAssociations.setObjectForKey(new WOConstantValueAssociation("javascript:void(0)"), "href");
    return mutableAssociations;
}
Also used : WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation) NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 13 with WOConstantValueAssociation

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

the class WOHelperFunctionParser method createDeclaration.

public static WODeclaration createDeclaration(String declarationName, String declarationType, NSMutableDictionary associations) {
    WODeclaration declaration = new WODeclaration(declarationName, declarationType, associations);
    if (WOHelperFunctionParser._debugSupport && associations != null && associations.objectForKey(WOHTMLAttribute.Debug) == null) {
        // associations.setObjectForKey(new WOConstantValueAssociation(Boolean.TRUE), WOHTMLAttribute.Debug);
        Enumeration associationsEnum = associations.keyEnumerator();
        while (associationsEnum.hasMoreElements()) {
            String bindingName = (String) associationsEnum.nextElement();
            WOAssociation association = (WOAssociation) associations.objectForKey(bindingName);
            association.setDebugEnabledForBinding(bindingName, declarationName, declarationType);
            association._setDebuggingEnabled(false);
        }
    }
    return declaration;
}
Also used : WOAssociation(com.webobjects.appserver.WOAssociation) Enumeration(java.util.Enumeration) WODeclaration(com.webobjects.appserver._private.WODeclaration) WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString)

Example 14 with WOConstantValueAssociation

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

the class WOHelperFunctionParser method parserHelperAssociation.

protected WOAssociation parserHelperAssociation(WOAssociation originalAssociation) {
    WOAssociation association = originalAssociation;
    String originalKeyPath = null;
    if (association instanceof WOKeyValueAssociation) {
        WOKeyValueAssociation kvAssociation = (WOKeyValueAssociation) association;
        originalKeyPath = kvAssociation.keyPath();
    }
    if (originalKeyPath != null) {
        int pipeIndex = originalKeyPath.indexOf('|');
        if (pipeIndex != -1) {
            String targetKeyPath = originalKeyPath.substring(0, pipeIndex).trim();
            String frameworkName = WOHelperFunctionRegistry.APP_FRAMEWORK_NAME;
            String helperFunctionName = originalKeyPath.substring(pipeIndex + 1).trim();
            String otherParams = null;
            int openParenIndex = helperFunctionName.indexOf('(');
            if (openParenIndex != -1) {
                int closeParenIndex = helperFunctionName.indexOf(')', openParenIndex + 1);
                otherParams = helperFunctionName.substring(openParenIndex + 1, closeParenIndex);
                helperFunctionName = helperFunctionName.substring(0, openParenIndex);
            }
            int helperFunctionDotIndex = helperFunctionName.indexOf('.');
            if (helperFunctionDotIndex != -1) {
                frameworkName = helperFunctionName.substring(0, helperFunctionDotIndex);
                helperFunctionName = helperFunctionName.substring(helperFunctionDotIndex + 1);
            }
            StringBuilder newKeyPath = new StringBuilder();
            newKeyPath.append('~');
            newKeyPath.append("@" + WOHelperFunctionRegistry.class.getName() + "@registry()._helperInstanceForFrameworkNamed(#this, \"");
            newKeyPath.append(helperFunctionName);
            newKeyPath.append("\", \"");
            newKeyPath.append(targetKeyPath);
            newKeyPath.append("\", \"");
            newKeyPath.append(frameworkName);
            newKeyPath.append("\").");
            newKeyPath.append(helperFunctionName);
            newKeyPath.append('(');
            newKeyPath.append(targetKeyPath);
            if (otherParams != null) {
                newKeyPath.append(',');
                newKeyPath.append(otherParams);
            }
            newKeyPath.append(')');
            log.debug("Converted {} into {}", originalKeyPath, newKeyPath);
            association = new WOConstantValueAssociation(newKeyPath.toString());
        }
    }
    return association;
}
Also used : WOAssociation(com.webobjects.appserver.WOAssociation) WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation) WOKeyValueAssociation(com.webobjects.appserver._private.WOKeyValueAssociation) WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString)

Example 15 with WOConstantValueAssociation

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

the class WOHelperFunctionParser method createDeclaration.

public static WODeclaration createDeclaration(String declarationName, String declarationType, NSMutableDictionary associations) {
    WODeclaration declaration = new WODeclaration(declarationName, declarationType, associations);
    if (WOHelperFunctionParser._debugSupport && associations != null && associations.objectForKey(WOHTMLAttribute.Debug) == null) {
        // associations.setObjectForKey(new WOConstantValueAssociation(Boolean.TRUE), WOHTMLAttribute.Debug);
        Enumeration associationsEnum = associations.keyEnumerator();
        while (associationsEnum.hasMoreElements()) {
            String bindingName = (String) associationsEnum.nextElement();
            WOAssociation association = (WOAssociation) associations.objectForKey(bindingName);
            association.setDebugEnabledForBinding(bindingName, declarationName, declarationType);
            association._setDebuggingEnabled(false);
        }
    }
    return declaration;
}
Also used : WOAssociation(com.webobjects.appserver.WOAssociation) Enumeration(java.util.Enumeration) WODeclaration(com.webobjects.appserver._private.WODeclaration) WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString)

Aggregations

WOConstantValueAssociation (com.webobjects.appserver._private.WOConstantValueAssociation)13 WOAssociation (com.webobjects.appserver.WOAssociation)6 WOHTMLCommentString (com.webobjects.appserver._private.WOHTMLCommentString)6 WOKeyValueAssociation (com.webobjects.appserver._private.WOKeyValueAssociation)5 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)5 Enumeration (java.util.Enumeration)5 WODeclaration (com.webobjects.appserver._private.WODeclaration)2 NSArray (com.webobjects.foundation.NSArray)2 WOElement (com.webobjects.appserver.WOElement)1 WOBindingNameAssociation (com.webobjects.appserver._private.WOBindingNameAssociation)1 WODynamicGroup (com.webobjects.appserver._private.WODynamicGroup)1