Package cambridge.behaviors

Examples of cambridge.behaviors.ConditionalTagBehavior


      ArrayList<TagNode> conditionals = new ArrayList<TagNode>();
      for (Fragment f : this) {
         if (f instanceof TagNode) {
            TagNode t = (TagNode) f;
            ConditionalTagBehavior behavior = t.getConditionalBehavior();
            if (behavior != null) {
               conditionals.add(t);
            }
         }
      }

      if (conditionals.size() == 0) {
         return;
      }

      ArrayList<ConditionalBlock> blocks = new ArrayList<ConditionalBlock>();

      for (int i = 0; i < conditionals.size(); i++) {
         ConditionalBlock currentBlock = null;
         TagNode t = conditionals.get(i);

         ConditionalTagBehavior behavior = t.getConditionalBehavior();

         main:
         do {
            TagNode nextTag = getNextTag(t);

            TagNode nextConditional = i + 1 < conditionals.size() ? conditionals.get(i + 1) : null;

            if (currentBlock == null && behavior.getType() == FIRST
               && nextTag == nextConditional && nextTag != null
               && nextConditional.getConditionalBehavior().getType() != FIRST) {
               currentBlock = new ConditionalBlock(t);
            }

            if (nextTag == null || nextConditional == null) {
               break;
            }

            if (currentBlock == null && behavior.getType() != FIRST) {
               throw new TemplateParsingException(behavior.getValidationError(), nextTag.getBeginLine(), nextTag.getBeginColumn());
            }

            if (nextTag == nextConditional) {
               switch (nextTag.getConditionalBehavior().getType()) {
                  case FIRST:
View Full Code Here


        for (Fragment f : this)
        {
            if (f instanceof TagNode)
            {
                TagNode t = (TagNode) f;
                ConditionalTagBehavior behavior = t.getConditionalBehavior();
                if (behavior != null)
                {
                    conditionals.add(t);
                }
            }
        }

        if (conditionals.size() == 0)
        {
            return;
        }

        ArrayList<ConditionalBlock> blocks = new ArrayList<ConditionalBlock>();

        for (int i = 0; i < conditionals.size(); i++)
        {
            ConditionalBlock currentBlock = null;
            TagNode t = conditionals.get(i);

            ConditionalTagBehavior behavior = t.getConditionalBehavior();

            main:
            do
            {
                TagNode nextTag = getNextTag(t);

                TagNode nextConditional = i + 1 < conditionals.size() ? conditionals.get(i + 1) : null;

                if (currentBlock == null && behavior.getType() == FIRST
                    && nextTag == nextConditional && nextTag != null
                    && nextConditional.getConditionalBehavior().getType() != FIRST)
                {
                    currentBlock = new ConditionalBlock(t);
                }

                if (nextTag == null || nextConditional == null)
                {
                    break;
                }

                if (currentBlock == null && behavior.getType() != FIRST)
                {
                    throw new TemplateParsingException(behavior.getValidationError(), nextTag.getBeginLine(), nextTag.getBeginColumn());
                }

                if (nextTag == nextConditional)
                {
                    switch (nextTag.getConditionalBehavior().getType())
View Full Code Here

TOP

Related Classes of cambridge.behaviors.ConditionalTagBehavior

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.