Search in sources :

Example 1 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class WOHelperFunctionParser method parseInlineAssociation.

protected void parseInlineAssociation(StringBuffer keyBuffer, StringBuffer valueBuffer, NSMutableDictionary bindings) throws WOHelperFunctionHTMLFormatException {
    String key = keyBuffer.toString().trim();
    String value = valueBuffer.toString().trim();
    NSDictionary quotedStrings;
    if (value.startsWith("\"")) {
        value = value.substring(1);
        if (value.endsWith("\"")) {
            value = value.substring(0, value.length() - 1);
        } else {
            throw new WOHelperFunctionHTMLFormatException(valueBuffer + " starts with quote but does not end with one.");
        }
        if (value.startsWith("$")) {
            value = value.substring(1);
            if (value.endsWith("VALID")) {
                value = value.replaceFirst("\\s*//\\s*VALID", "");
            }
            quotedStrings = new NSDictionary();
        } else {
            value = value.replaceAll("\\\\\\$", "\\$");
            value = value.replaceAll("\\\"", "\"");
            quotedStrings = new NSDictionary(value, "_WODP_0");
            value = "_WODP_0";
        }
    } else {
        quotedStrings = new NSDictionary();
    }
    WOAssociation association = WOHelperFunctionDeclarationParser._associationWithKey(value, quotedStrings);
    bindings.setObjectForKey(association, key);
}
Also used : WOAssociation(com.webobjects.appserver.WOAssociation) NSDictionary(com.webobjects.foundation.NSDictionary) WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString)

Example 2 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class NSDictionaryPropertyAccessor method getProperty.

public Object getProperty(Object target, Object name) throws OgnlException {
    Object property = null;
    try {
        NSDictionary dictionary = (NSDictionary) target;
        property = dictionary.objectForKey(name);
    } catch (Exception ex) {
        throw new OgnlException(name.toString(), ex);
    }
    return property;
}
Also used : OgnlException(ognl.OgnlException) NSDictionary(com.webobjects.foundation.NSDictionary) OgnlException(ognl.OgnlException)

Example 3 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class WOHTMLWebObjectTag method _componentReferenceWithClassNameDeclarationAndTemplate.

private static WOElement _componentReferenceWithClassNameDeclarationAndTemplate(String s, WODeclaration wodeclaration, WOElement woelement, NSArray nsarray) throws ClassNotFoundException {
    WOComponentReference wocomponentreference = null;
    WOComponentDefinition wocomponentdefinition = WOApplication.application()._componentDefinition(s, nsarray);
    if (wocomponentdefinition != null) {
        NSDictionary nsdictionary = wodeclaration.associations();
        wocomponentreference = wocomponentdefinition.componentReferenceWithAssociations(nsdictionary, woelement);
    } else {
        throw new ClassNotFoundException("Cannot find class or component named \'" + s + "\" in runtime or in a loadable bundle");
    }
    return wocomponentreference;
}
Also used : WOComponentDefinition(com.webobjects.appserver._private.WOComponentDefinition) NSDictionary(com.webobjects.foundation.NSDictionary) WOComponentReference(com.webobjects.appserver._private.WOComponentReference)

Example 4 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class WOExceptionParser method _ignoredPackages.

private NSArray _ignoredPackages() {
    NSBundle bundle;
    String path, content;
    NSDictionary dic = null;
    NSMutableArray<NSBundle> allBundles = new NSMutableArray<>(NSBundle.frameworkBundles());
    NSMutableArray<String> ignored = new NSMutableArray<>();
    for (Enumeration enumerator = allBundles.objectEnumerator(); enumerator.hasMoreElements(); ) {
        bundle = (NSBundle) enumerator.nextElement();
        path = WOApplication.application().resourceManager().pathForResourceNamed("WOIgnoredPackage.plist", bundle.name(), null);
        if (path != null) {
            content = _stringFromFileSafely(path);
            if (content != null) {
                dic = (NSDictionary) NSPropertyListSerialization.propertyListFromString(content);
                if (dic != null && dic.containsKey("ignoredPackages")) {
                    @SuppressWarnings("unchecked") NSArray<String> tmpArray = (NSArray<String>) dic.objectForKey("ignoredPackages");
                    if (tmpArray != null && tmpArray.count() > 0) {
                        ignored.addObjectsFromArray(tmpArray);
                    }
                }
            }
        }
    }
    return ignored;
}
Also used : NSBundle(com.webobjects.foundation.NSBundle) Enumeration(java.util.Enumeration) NSArray(com.webobjects.foundation.NSArray) NSDictionary(com.webobjects.foundation.NSDictionary) NSMutableArray(com.webobjects.foundation.NSMutableArray)

Example 5 with NSDictionary

use of com.webobjects.foundation.NSDictionary in project wonder-slim by undur.

the class AjaxHyperlink method onClick.

public String onClick(WOContext context) {
    StringBuilder sb = new StringBuilder();
    String onClickBefore = (String) valueForBinding("onClickBefore", context.component());
    if (onClickBefore != null) {
        sb.append("if (");
        sb.append(onClickBefore);
        sb.append(") {");
    }
    NSDictionary options = createAjaxOptions(context.component());
    String actionUrl = AjaxUtils.ajaxComponentActionUrl(context);
    // PROTOTYPE FUNCTIONS
    sb.append("new Ajax.Request('");
    sb.append(actionUrl);
    sb.append("', ");
    AjaxOptions.appendToBuffer(options, sb, context);
    sb.append(')');
    String onClick = (String) valueForBinding("onClick", context.component());
    if (onClick != null) {
        sb.append(';');
        sb.append(onClick);
    }
    if (onClickBefore != null) {
        sb.append('}');
    }
    return sb.toString();
}
Also used : NSDictionary(com.webobjects.foundation.NSDictionary)

Aggregations

NSDictionary (com.webobjects.foundation.NSDictionary)34 WOComponent (com.webobjects.appserver.WOComponent)7 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)7 Enumeration (java.util.Enumeration)7 WOAssociation (com.webobjects.appserver.WOAssociation)4 WOResponse (com.webobjects.appserver.WOResponse)4 NSArray (com.webobjects.foundation.NSArray)3 NSForwardException (com.webobjects.foundation.NSForwardException)3 WOApplication (com.webobjects.appserver.WOApplication)2 WOComponentDefinition (com.webobjects.appserver._private.WOComponentDefinition)2 WOComponentReference (com.webobjects.appserver._private.WOComponentReference)2 WOHTMLCommentString (com.webobjects.appserver._private.WOHTMLCommentString)2 NSBundle (com.webobjects.foundation.NSBundle)2 ERXMutableURL (er.extensions.foundation.ERXMutableURL)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MalformedURLException (java.net.MalformedURLException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 WOContext (com.webobjects.appserver.WOContext)1 WORequest (com.webobjects.appserver.WORequest)1