Examples of WOAssociation


Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @return <code>true</code> if binding is settable
   */
  public static boolean bindingIsSettable(String name, NSDictionary<String, WOAssociation> associations) {
    boolean isSettable = false;
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      isSettable = association.isValueSettable();
    }
    return isSettable;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param name binding name
   * @param associations array of associations
   * @param component component to set the value in
   */
  public static void setValueForBinding(Object value, String name, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      association.setValue(value, component);
    }
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @param component component to get value from
   * @return retrieved value or <code>null</code>
   */
  public static Object valueForBinding(String name, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      return association.valueInComponent(component);
    }
    return null;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @param component component to get value from
   * @return retrieved string value or <code>null</code>
   */
  public static String stringValueForBinding(String name, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      return (String) association.valueInComponent(component);
    }
    return null;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @param component component to get value from
   * @return retrieved boolean value or default value
   */
  public static boolean booleanValueForBinding(String name, boolean defaultValue, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      return association.booleanValueInComponent(component);
    }
    return defaultValue;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @param component component to get value from
   * @return retrieved int value or default value
   */
  public static int integerValueForBinding(String name, int defaultValue, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      Object value = association.valueInComponent(component);
      return ERXValueUtilities.intValueWithDefault(value, defaultValue);
    }
    return defaultValue;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

   * @param associations array of associations
   * @param component component to get value from
   * @return retrieved array value or default value
   */
  public static <T> NSArray<T> arrayValueForBinding(String name, NSArray<T> defaultValue, NSDictionary<String, WOAssociation> associations, WOComponent component) {
    WOAssociation association = bindingNamed(name, associations);
    if (association != null) {
      Object value = association.valueInComponent(component);
      return ERXValueUtilities.arrayValueWithDefault(value, defaultValue);
    }
    return defaultValue;
  }
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

    public String buttonCssClass() {
      String css = (String) valueForBinding("css");
      if(css == null) {
        css = "";
      }
      WOAssociation assoc = _associationWithName("action");
      if(assoc != null) {
        css += " " + ERXSubmitButton.STYLE_PREFIX + assoc.keyPath().replaceAll("\\W+", "");
      } else {
        css += " " + ERXSubmitButton.STYLE_PREFIX + valueForBinding("directActionName");
      }
      if(css.length() == 0) {
        css = null;
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

  }

  public void convertOgnlConstantAssociations(NSMutableDictionary associations) {
    for (Enumeration e = associations.keyEnumerator(); e.hasMoreElements();) {
      String name = (String) e.nextElement();
      WOAssociation association = (WOAssociation) associations.objectForKey(name);
      boolean isConstant = false;
      String keyPath = null;
      if (association instanceof WOConstantValueAssociation) {
        WOConstantValueAssociation constantAssociation = (WOConstantValueAssociation) association;
        // AK: this sucks, but there is no API to get at the value
        Object value = constantAssociation.valueInComponent(null);
        keyPath = value != null ? value.toString() : null;
        isConstant = true;
      }
      else if (association instanceof WOKeyValueAssociation) {
        keyPath = association.keyPath();
      }
      else if (association instanceof WOBindingNameAssociation) {
        WOBindingNameAssociation b = (WOBindingNameAssociation) association;
        // AK: strictly speaking, this is not correct, as we only get the first part of
        // the path. But take a look at WOBindingNameAssociation for a bit of fun...
        keyPath = "^" + b._parentBindingName;
      }
      if (keyPath != null) {
        if (associationMappings.size() != 0) {
          int index = name.indexOf(':');
          if (index > 0) {
            String prefix = name.substring(0, index);
            if (prefix != null) {
              Class c = (Class) associationMappings.get(prefix);
              if (c != null) {
                String postfix = name.substring(index + 1);
                WOAssociation newAssociation = createAssociationForClass(c, keyPath, isConstant);
                associations.removeObjectForKey(name);
                associations.setObjectForKey(newAssociation, postfix);
              }
            }
          }
        }
        if (isConstant && keyPath.startsWith(ognlBindingFlag())) {
          String ognlExpression = keyPath.substring(ognlBindingFlag().length(), keyPath.length());
          if (ognlExpression.length() > 0) {
            WOAssociation newAssociation = new WOOgnlAssociation(ognlExpression);
            NSArray keys = associations.allKeysForObject(association);
            //if (log.isDebugEnabled())
            //    log.debug("Constructing Ognl association for binding key(s): "
            //              + (keys.count() == 1 ? keys.lastObject() : keys) + " expression: " + ognlExpression);
            if (keys.count() == 1) {
View Full Code Here

Examples of com.webobjects.appserver.WOAssociation

    return "text";
  }
    
    @Override
    protected boolean isDisabledInContext(WOContext context) {
      WOAssociation disabled = (WOAssociation) ERXKeyValueCodingUtilities.privateValueForKey(this, "_disabled");
      return disabled != null && disabled.booleanValueInComponent(context.component());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.