Package com.webobjects.appserver

Examples of com.webobjects.appserver.WOAssociation


  public AjaxFunctionLink(String aName, NSDictionary associations, WOElement template) {
    super("a", AjaxFunctionLink.processAssociations(associations), template);
    _action = _associations.removeObjectForKey("action");
    _updateContainerID = _associations.removeObjectForKey("updateContainerID");
    WOAssociation onclick = _associations.objectForKey("onclick");
    if (onclick == null) {
      onclick = _associations.objectForKey("onClick");
    }
    if (onclick != null && _action != null) {
      throw new WODynamicElementCreationException("You cannot bind both 'action' and 'onclick' at the same time.");
View Full Code Here


    _disabled = _associations.removeObjectForKey("disabled");
  }

  protected static NSDictionary _processAssociations(NSDictionary associations) {
    NSMutableDictionary mutableAssociations = (NSMutableDictionary) associations;
    WOAssociation action = (WOAssociation) mutableAssociations.removeObjectForKey("action");
    if (action != null) {
      mutableAssociations.setObjectForKey(action, "invokeAction");
    }
    if (!mutableAssociations.containsKey("elementName")) {
      mutableAssociations.setObjectForKey(new WOConstantValueAssociation("div"), "elementName");
View Full Code Here

   
    @Override
    public WOActionResults invokeAction(WORequest worequest, WOContext wocontext) {
        WOComponent component = wocontext.component();
      if (!booleanValueForBinding("ajax", false, component)) {
          WOAssociation action = associations().objectForKey("action");
          if(action != null && wocontext.elementID().equals(wocontext.senderID())) {
              return (WOActionResults) action.valueInComponent(component);
          }
      }
        return super.invokeAction(worequest, wocontext);
    }
View Full Code Here

    @Override
    public WOActionResults handleRequest(WORequest request, WOContext context) {
        WOComponent component = context.component();

        WOResponse response = null;
        WOAssociation action = associations().objectForKey("action");
        if(action != null) {
            action.valueInComponent(component);
        }

      if (booleanValueForBinding("ajax", false, component) && hasChildrenElements()) {
      response = AjaxUtils.createResponse(request, context);
      AjaxUtils.setPageReplacementCacheKey(context, _containerID(context));
View Full Code Here

    protected Object _value;
    protected WOElement _children;
   
    public ERXWOCase(String name, NSDictionary<String, WOAssociation> associations, WOElement woelement) {
        super(name, associations, woelement);
        WOAssociation assoc = associations.objectForKey("case");
        if(!assoc.isValueConstant()) {
            throw new IllegalStateException("You must bind 'case' to a constant value");
        }
        _value = assoc.valueInComponent(null);
        _children = woelement;
    }
View Full Code Here

   *
   * @param keyPath the keypath
   * @return a corresponding WOAssociation
   */
  public static WOAssociation associationWithKeyPath(String keyPath) {
    WOAssociation association;
    if (keyPath.charAt(0) == '^') {
      association = new WOHelperFunctionBindingNameAssociation(keyPath);
    }
    else if (_keyPathIsReadOnly(keyPath)) {
      association = new WOReadOnlyKeyValueAssociation(keyPath);
View Full Code Here

    AjaxUpdateLink.addEffect(options, (String) valueForBinding("afterEffect", component), afterEffectID, (String) valueForBinding("afterEffectDuration", component));

    // PROTOTYPE EFFECTS
    String beforeEffect = (String) valueForBinding("beforeEffect", component);

    WOAssociation directActionNameAssociation = (WOAssociation) associations().valueForKey("directActionName");
    if (beforeEffect == null && updateContainerID != null && directActionNameAssociation == null && replaceID == null && function == null && onClick == null && onClickBefore == null) {
      NSDictionary nonDefaultOptions = AjaxUpdateContainer.removeDefaultOptions(options);
      onClickBuffer.append("AUL.");
      if (generateFunctionWrapper) {
        onClickBuffer.append("updateFunc");
      }
      else {
        onClickBuffer.append("update");
      }
      onClickBuffer.append("('");
      onClickBuffer.append(updateContainerID);
      onClickBuffer.append("', ");
      AjaxOptions.appendToBuffer(nonDefaultOptions, onClickBuffer, context);
      onClickBuffer.append(", '");
      onClickBuffer.append(context.contextID());
      onClickBuffer.append('.');
      onClickBuffer.append(context.elementID());
      onClickBuffer.append('\'');
      // if (generateFunctionWrapper) {
      // onClickBuffer.append(", additionalParams");
      // }
      onClickBuffer.append(')');
      onClickBuffer.append(';');
    }
    else {
      if (generateFunctionWrapper) {
        onClickBuffer.append("function(additionalParams) {");
      }
      if (onClickBefore != null) {
        onClickBuffer.append("if (");
        onClickBuffer.append(onClickBefore);
        onClickBuffer.append(") {");
      }

      // PROTOTYPE EFFECTS
      if (beforeEffect != null) {
        onClickBuffer.append("new ");
        onClickBuffer.append(AjaxUpdateLink.fullEffectName(beforeEffect));
        onClickBuffer.append("('");

        String beforeEffectID = (String) valueForBinding("beforeEffectID", component);
        if (beforeEffectID == null) {
          beforeEffectID = AjaxUpdateContainer.currentUpdateContainerID();
          if (beforeEffectID == null) {
            beforeEffectID = updateContainerID;
          }
        }
        onClickBuffer.append(beforeEffectID);

        onClickBuffer.append("', { ");

        String beforeEffectDuration = (String) valueForBinding("beforeEffectDuration", component);
        if (beforeEffectDuration != null) {
          onClickBuffer.append("duration: ");
          onClickBuffer.append(beforeEffectDuration);
          onClickBuffer.append(", ");
        }

        onClickBuffer.append("queue:'end', afterFinish: function() {");
      }

      String actionUrl = null;
      if (directActionNameAssociation != null) {
        actionUrl = context._directActionURL((String) directActionNameAssociation.valueInComponent(component), ERXComponentUtilities.queryParametersInComponent(associations(), component), ERXRequest.isRequestSecure(context.request()), 0, false).replaceAll("&amp;", "&");
      }
      else {
        actionUrl = AjaxUtils.ajaxComponentActionUrl(context);
      }
     
View Full Code Here

  @Override
  public void appendToResponse(WOResponse response, WOContext context) {
    response.appendContentCharacter('{');
    NSMutableDictionary options = _bindings;
    WOAssociation optionsBinding = (WOAssociation) _bindings.objectForKey("options");
    if (optionsBinding != null) {
      NSDictionary passedInOptions = (NSDictionary) optionsBinding.valueInComponent(context.component());
      if (passedInOptions != null) {
        options = passedInOptions.mutableClone();
        options.addEntriesFromDictionary(_bindings);
      }
    }
View Full Code Here

        String bindingName = (String) bindingsEnum.nextElement();
        if (!"options".equals(bindingName)) {
          Object bindingValue = options.objectForKey(bindingName);
        // This is needed for the double step to resolve the value for ^ notation
          if (bindingValue instanceof WOAssociation) {
            WOAssociation association = (WOAssociation) bindingValue;
            bindingValue = association.valueInComponent(component);
          }
          if (bindingValue != null) {
            if (hasPreviousOptions) {
              stringBuffer.append(", ");
            }
View Full Code Here

      }
    }
    else {
      quotedStrings = new NSDictionary();
    }
    WOAssociation association = WOHelperFunctionDeclarationParser._associationWithKey(value, quotedStrings);
    bindings.setObjectForKey(association, key);
  }
View Full Code Here

TOP

Related Classes of com.webobjects.appserver.WOAssociation

Copyright © 2018 www.massapicom. 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.