use of com.webobjects.appserver._private.WODeclaration in project wonder-slim by undur.
the class WOHelperFunctionParser method processDeclaration.
protected void processDeclaration(WODeclaration declaration) {
NSMutableDictionary associations = (NSMutableDictionary) declaration.associations();
Enumeration bindingNameEnum = associations.keyEnumerator();
while (bindingNameEnum.hasMoreElements()) {
String bindingName = (String) bindingNameEnum.nextElement();
WOAssociation association = (WOAssociation) associations.valueForKey(bindingName);
WOAssociation helperAssociation = parserHelperAssociation(association);
if (helperAssociation != association) {
associations.setObjectForKey(helperAssociation, bindingName);
}
}
// This will replace constant associations with ognl associations
// when needed.
WOOgnl.factory().convertOgnlConstantAssociations(associations);
}
use of com.webobjects.appserver._private.WODeclaration in project wonder-slim by undur.
the class WOHelperFunctionParser method prettyDeclaration.
protected String prettyDeclaration(WODeclaration declaration) {
StringBuilder declarationStr = new StringBuilder();
if (declaration == null) {
declarationStr.append("[none]");
} else {
declarationStr.append("Component Type = " + declaration.type());
declarationStr.append(", Bindings = { ");
Enumeration keyEnum = declaration.associations().keyEnumerator();
while (keyEnum.hasMoreElements()) {
String key = (String) keyEnum.nextElement();
Object assoc = declaration.associations().objectForKey(key);
if (assoc instanceof WOKeyValueAssociation) {
declarationStr.append(key + "=" + ((WOKeyValueAssociation) assoc).keyPath());
} else if (assoc instanceof WOConstantValueAssociation) {
declarationStr.append(key + "='" + ((WOConstantValueAssociation) assoc).valueInComponent(null) + "'");
} else {
declarationStr.append(key + "=" + assoc);
}
if (keyEnum.hasMoreElements()) {
declarationStr.append(", ");
}
}
declarationStr.append(" }");
}
return declarationStr.toString();
}
use of com.webobjects.appserver._private.WODeclaration 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.appserver._private.WODeclaration in project wonder-slim by undur.
the class WOHelperFunctionParser method didParseOpeningWebObjectTag.
public void didParseOpeningWebObjectTag(String s, WOHelperFunctionHTMLParser htmlParser) throws WOHelperFunctionHTMLFormatException {
if (WOHelperFunctionTagRegistry.allowInlineBindings()) {
int spaceIndex = s.indexOf(' ');
int colonIndex;
if (spaceIndex != -1) {
colonIndex = s.substring(0, spaceIndex).indexOf(':');
} else {
colonIndex = s.indexOf(':');
}
if (colonIndex != -1) {
WODeclaration declaration = parseInlineBindings(s, colonIndex);
s = "<wo name = \"" + declaration.name() + "\"";
}
}
_currentWebObjectTag = new WOHTMLWebObjectTag(s, _currentWebObjectTag);
log.debug("Inserted WebObject with Name '{}'.", _currentWebObjectTag.name());
}
use of com.webobjects.appserver._private.WODeclaration in project wonder-slim by undur.
the class WOHelperFunctionDeclarationParser method parseDeclarationsWithoutComments.
private NSMutableDictionary parseDeclarationsWithoutComments(String declarationWithoutComment) throws WOHelperFunctionDeclarationFormatException {
NSMutableDictionary declarations = new NSMutableDictionary();
NSMutableDictionary rawDeclarations = _rawDeclarationsWithoutComment(declarationWithoutComment);
String tagName;
WODeclaration declaration;
Enumeration rawDeclarationHeaderEnum = rawDeclarations.keyEnumerator();
while (rawDeclarationHeaderEnum.hasMoreElements()) {
String declarationHeader = (String) rawDeclarationHeaderEnum.nextElement();
String declarationBody = (String) rawDeclarations.objectForKey(declarationHeader);
int colonIndex = declarationHeader.indexOf(':');
if (colonIndex < 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing ':' for declaration:\n" + declarationHeader + " " + declarationBody);
}
tagName = declarationHeader.substring(0, colonIndex).trim();
if (tagName.length() == 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing tag name for declaration:\n" + declarationHeader + " " + declarationBody);
}
if (declarations.objectForKey(tagName) != null) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Duplicate tag name '" + tagName + "' in declaration:\n" + declarationBody);
}
String type = declarationHeader.substring(colonIndex + 1).trim();
if (type.length() == 0) {
throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing element name for declaration:\n" + declarationHeader + " " + declarationBody);
}
NSMutableDictionary associations = _associationsForDictionaryString(declarationHeader, declarationBody);
declaration = WOHelperFunctionParser.createDeclaration(tagName, type, associations);
declarations.setObjectForKey(declaration, tagName);
}
return declarations;
}
Aggregations