Package cambridge

Examples of cambridge.Cambridge$Bind


      if ("id".equals(a.getAttributeName())) {
         id = a.getValue();
      }

      Cambridge bindings = Cambridge.getInstance();

      tagParts.add(a);

      if (a.isDynamic()) {
         DynamicAttributeKey attributeKey = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
         if (bindings.getStaticBehavior(attributeKey) == null) {
            dynamic = true;
         }
      }

      return this;
View Full Code Here


            normalize(doc, f);
         }
         return true;
      } else {
         if (attributes != null) {
            Cambridge bindings = Cambridge.getInstance();
            boolean remove = false;
            HashSet<AttributeKey> staticAttributes = new HashSet<AttributeKey>();

            for (Attribute a : attributes.values()) {
               if (a.isDynamic()) {
                  DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
                  StaticBehavior sb = bindings.getStaticBehavior(key);
                  if (sb != null) {
                     sb.modify(doc, a.getValue(), this);
                     staticAttributes.add(new AttributeKey(a.getAttributeNameSpace(), a.getAttributeName()));
                     if (sb.shouldRemove()) {
                        remove = true;
View Full Code Here

   }

   @Override
   void normalize(TemplateDocument doc, FragmentList f) throws BehaviorInstantiationException {
      if (attributes != null) {
         Cambridge bindings = Cambridge.getInstance();
         boolean remove = false;
         HashSet<AttributeKey> staticAttributes = new HashSet<AttributeKey>();

         for (Attribute a : attributes.values()) {
            if (a.isDynamic()) {
               DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
               StaticBehavior sb = bindings.getStaticBehavior(key);
               if (sb != null) {
                  sb.modify(doc, a.getValue(), this);
                  staticAttributes.add(new AttributeKey(a.getAttributeNameSpace(), a.getAttributeName()));
                  if (sb.shouldRemove()) {
                     remove = true;
View Full Code Here

   private boolean conditionsMet(Map<String, Object> bindings) throws ExpressionEvaluationException {
      return conditionalBehavior == null || conditionalBehavior.conditionMet(bindings);
   }

   private void assignBehaviors() throws BehaviorInstantiationException {
      Cambridge bindings = Cambridge.getInstance();
      if (attributes != null) {
         for (Attribute a : attributes.values()) {
            if (a.isDynamic()) {
               DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
               TagBehavior behavior;
               try {
                  behavior = bindings.getBehavior(key, attributes, a.getLine(), a.getColumn());
               } catch (ExpressionParsingException e) {
                  throw new BehaviorInstantiationException("Error in parsing expression", e, getBeginLine(), getBeginColumn());
               }
               if (behavior != null) {
                  addBehavior(behavior);
View Full Code Here

   }

   private TagNode tag() throws IOException, TemplateParsingException {
      OpenTagToken token = (OpenTagToken) currentToken;

      Cambridge bindings = Cambridge.getInstance();

      TagNode node = null;

      if (token.getNameSpace() != null) {
         String namespaceUri = getNamespaceUri(token.getNameSpace());
         if (namespaceUri != null) {
            node = bindings.getDynamicTag(new DynamicAttributeKey(namespaceUri, token.getNameSpace(), token.getTagName()));
         }
      }

      boolean dynamicTag = true;
      if (node == null) {
         node = new TagNode();
         dynamicTag = false;
      }

      node.setBeginLine(token.getLineNo());
      node.setBeginColumn(token.getColumn());
      node.setTagName(token.getTagName());
      node.setNameSpace(token.getNameSpace());
      node.setTagNameString(token.value);

      // Match the open tag
      while (peek(1).getType() != TokenType.EOF) {
         nextToken();
         switch (currentToken.getType()) {
            case WS:
            case EOL:
               TextTagPart e = new TextTagPart(currentToken.getActualValue(), currentToken.getLineNo(), currentToken.getColumn());
               e.whitespace = true;
               node.addText(e);
               break;
            case TAG_STRING:
            case ASSIGN:
               node.addText(new TextTagPart(currentToken.getActualValue(), currentToken.getLineNo(), currentToken.getColumn()));
               break;
            case ATTRIBUTE_NAME:
               AttributeNameToken tok = (AttributeNameToken) currentToken;

               if (dynamicTag && tok.getNameSpace() == null) {
                  tok.setNameSpace(node.getNameSpace());
               }

               Attribute element = null;
               StringBuilder textContent = new StringBuilder();
               textContent.append(tok.getActualValue());
               boolean dynamic = false;
               boolean staticAttribute = false;

               String namespaceUri = getNamespaceUri(tok.getNameSpace());
               if (namespaceUri != null && bindings.isRegisteredNamespace(namespaceUri)) {

                  dynamic = true;
                  if (bindings.isStaticAttribute(namespaceUri, tok.getAttributeName())) {
                     staticAttribute = true;
                     element = new StaticAttribute(namespaceUri, tok.getLineNo(), tok.getColumn());
                  } else {
                     element = new DynamicAttribute(namespaceUri, tok.getLineNo(), tok.getColumn());
                  }
View Full Code Here

    }

    private TagNode tag() throws IOException, TemplateParsingException {
        OpenTagToken token = (OpenTagToken) currentToken;

        Cambridge bindings = Cambridge.getInstance();

        TagNode node = null;

        if (token.getNameSpace() != null) {
            String namespaceUri = getNamespaceUri(token.getNameSpace());
            if (namespaceUri != null) {
                node = bindings.getDynamicTag(new DynamicAttributeKey(namespaceUri, token.getNameSpace(), token.getTagName()));
            }
        }

        boolean dynamicTag = true;
        if (node == null) {
            node = new TagNode();
            dynamicTag = false;
        }

        node.setBeginLine(token.getLineNo());
        node.setBeginColumn(token.getColumn());
        node.setTagName(token.getTagName());
        node.setNameSpace(token.getNameSpace());
        node.setTagNameString(token.value);

        // Match the open tag
        while (peek(1).getType() != TokenType.EOF) {
            nextToken();
            switch (currentToken.getType()) {
                case WS:
                case EOL:
                    TextTagPart e = new TextTagPart(currentToken.getActualValue(), currentToken.getLineNo(), currentToken.getColumn());
                    e.whitespace = true;
                    node.addText(e);
                    break;
                case TAG_STRING:
                case ASSIGN:
                    node.addText(new TextTagPart(currentToken.getActualValue(), currentToken.getLineNo(), currentToken.getColumn()));
                    break;
                case ATTRIBUTE_NAME:
                    AttributeNameToken tok = (AttributeNameToken) currentToken;

                    if (dynamicTag && tok.getNameSpace() == null) {
                        tok.setNameSpace(node.getNameSpace());
                    }

                    Attribute element = null;
                    StringBuilder textContent = new StringBuilder();
                    textContent.append(tok.getActualValue());
                    boolean dynamic = false;
                    boolean staticAttribute = false;

                    String namespaceUri = getNamespaceUri(tok.getNameSpace());
                    if (namespaceUri != null && bindings.isRegisteredNamespace(namespaceUri)) {

                        dynamic = true;
                        if (bindings.isStaticAttribute(namespaceUri, tok.getAttributeName())) {
                            staticAttribute = true;
                            element = new StaticAttribute(namespaceUri, tok.getLineNo(), tok.getColumn());
                        } else {
                            element = new DynamicAttribute(namespaceUri, tok.getLineNo(), tok.getColumn());
                        }
View Full Code Here

      if ("id".equals(a.getAttributeName())) {
         id = a.getValue();
      }

      Cambridge bindings = Cambridge.getInstance();

      tagParts.add(a);

      if (a.isDynamic()) {
         DynamicAttributeKey attributeKey = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
         if (bindings.getStaticBehavior(attributeKey) == null) {
            dynamic = true;
         }
      }

      return this;
View Full Code Here

            normalize(doc, f);
         }
         return true;
      } else {
         if (attributes != null) {
            Cambridge bindings = Cambridge.getInstance();
            boolean remove = false;
            HashSet<AttributeKey> staticAttributes = new HashSet<AttributeKey>();

            for (Attribute a : attributes.values()) {
               if (a.isDynamic()) {
                  DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
                  StaticBehavior sb = bindings.getStaticBehavior(key);
                  if (sb != null) {
                     sb.modify(doc, a.getValue(), this);
                     staticAttributes.add(new AttributeKey(a.getAttributeNameSpace(), a.getAttributeName()));
                     if (sb.shouldRemove()) {
                        remove = true;
View Full Code Here

   }

   @Override
   void normalize(TemplateDocument doc, FragmentList f) throws BehaviorInstantiationException {
      if (attributes != null) {
         Cambridge bindings = Cambridge.getInstance();
         boolean remove = false;
         HashSet<AttributeKey> staticAttributes = new HashSet<AttributeKey>();

         for (Attribute a : attributes.values()) {
            if (a.isDynamic()) {
               DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
               StaticBehavior sb = bindings.getStaticBehavior(key);
               if (sb != null) {
                  sb.modify(doc, a.getValue(), this);
                  staticAttributes.add(new AttributeKey(a.getAttributeNameSpace(), a.getAttributeName()));
                  if (sb.shouldRemove()) {
                     remove = true;
View Full Code Here

   private boolean conditionsMet(ExpressionContext context) throws ExpressionEvaluationException {
      return conditionalBehavior == null || conditionalBehavior.conditionMet(context);
   }

   private void assignBehaviors() throws BehaviorInstantiationException {
      Cambridge bindings = Cambridge.getInstance();
      if (attributes != null) {
         for (Attribute a : attributes.values()) {
            if (a.isDynamic()) {
               DynamicAttributeKey key = new DynamicAttributeKey(a.getNamespaceUri(), a.getAttributeNameSpace(), a.getAttributeName());
               TagBehavior behavior;
               try {
                  behavior = bindings.getBehavior(key, attributes, a.getLine(), a.getColumn());
               } catch (ExpressionParsingException e) {
                  throw new BehaviorInstantiationException("Error in parsing expression", e, getBeginLine(), getBeginColumn());
               }
               if (behavior != null) {
                  addBehavior(behavior);
View Full Code Here

TOP

Related Classes of cambridge.Cambridge$Bind

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.