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);
}
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;
}
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;
}
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;
}
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();
}
Aggregations