Search in sources :

Example 6 with WOConstantValueAssociation

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

the class AjaxToggleLink method processAssociations.

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

Example 7 with WOConstantValueAssociation

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

the class NotTagProcessor method createDeclaration.

@Override
public WODeclaration createDeclaration(String elementName, String elementType, NSMutableDictionary associations) {
    String newElementType = "ERXWOConditional";
    if (associations.objectForKey("negate") != null) {
        throw new IllegalArgumentException("You already specified a binding for 'negate' of " + associations.objectForKey("negate") + " on a wo:not.");
    }
    associations.setObjectForKey(new WOConstantValueAssociation(Boolean.TRUE), "negate");
    return super.createDeclaration(elementName, newElementType, associations);
}
Also used : WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation)

Example 8 with WOConstantValueAssociation

use of com.webobjects.appserver._private.WOConstantValueAssociation 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();
}
Also used : Enumeration(java.util.Enumeration) WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation) WOKeyValueAssociation(com.webobjects.appserver._private.WOKeyValueAssociation) WOHTMLCommentString(com.webobjects.appserver._private.WOHTMLCommentString)

Example 9 with WOConstantValueAssociation

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

the class AjaxTabbedPanel method findTabs.

/**
 * Looks through the child components to locate the AjaxTabbedPanelTabs that are controlled by this panel.
 * Tabs without an explicit id attributed are assigned a calculated one.
 *
 * @param template the graph of elements passed to the constructor.
 */
private void findTabs(WODynamicGroup template) {
    if (template == null || template.childrenElements() == null)
        return;
    NSArray children = template.childrenElements();
    for (int i = 0; i < children.count(); i++) {
        WOElement child = (WOElement) children.objectAtIndex(i);
        if (child instanceof AjaxTabbedPanelTab) {
            AjaxTabbedPanelTab childTab = (AjaxTabbedPanelTab) child;
            // The tabs need to have an id attribute so we assign one if needed
            if (childTab.id() == null) {
                childTab.setParentId(id);
                childTab.setTabNumber(new WOConstantValueAssociation("_pane_" + tabs.count()));
            }
            tabs.addObject(childTab);
        } else if (child instanceof WODynamicGroup) {
            findTabs((WODynamicGroup) child);
        }
    }
}
Also used : NSArray(com.webobjects.foundation.NSArray) WODynamicGroup(com.webobjects.appserver._private.WODynamicGroup) WOConstantValueAssociation(com.webobjects.appserver._private.WOConstantValueAssociation) WOElement(com.webobjects.appserver.WOElement)

Example 10 with WOConstantValueAssociation

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

the class AjaxInPlaceEditTemplate method processAssociations.

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

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