Examples of NestableNode


Examples of org.thymeleaf.dom.NestableNode

            isVisible(arguments, element);

        final boolean removeHostElementIfVisible =
                removeHostElementIfVisible(arguments, element);
       
        final NestableNode parent = element.getParent();
       
        if (!visible) {
            element.clearChildren();
            parent.removeChild(element);
            return ProcessorResult.OK;
        }
       
        if (removeHostElementIfVisible) {
            parent.extractChild(element);
        }
       
        return ProcessorResult.OK;
       
    }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

                final Node cdata =
                        new CDATASection(new String(this.cdataBuffer, 0, this.cdataBufferLen), null, null, true);
                if (this.elementStack.isEmpty()) {
                    this.rootNodes.add(cdata);
                } else {
                    final NestableNode parent = this.elementStack.peek();
                    parent.addChild(cdata);
                }
                this.cdataBufferLen = 0;
            }
           
        }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

                        new Comment(new String(ch, start, start + length));
               
                if (this.elementStack.isEmpty()) {
                    this.rootNodes.add(comment);
                } else {
                    final NestableNode parent = this.elementStack.peek();
                    parent.addChild(comment);
                }
               
            }
           
        }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

        @Override
        public void endElement(final String uri, final String localName, final String qName) {

            flushBuffer();

            final NestableNode node = this.elementStack.pop();
           
            if (node instanceof Element) {
                final Element element = (Element) node;
                if (TemplatePreprocessingReader.SYNTHETIC_ROOT_ELEMENT_NAME.equals(element.getOriginalName())) {
                    // If it is the synthetic root element, then we skip the element itself and just add
                    // its children to the results.
                    final List<Node> syntheticRootChildren = element.getChildren();
                    if (this.elementStack.isEmpty()) {
                        this.rootNodes.addAll(syntheticRootChildren);
                    } else {
                        final NestableNode parent = this.elementStack.peek();
                        for (final Node syntheticRootChild : syntheticRootChildren) {
                            parent.addChild(syntheticRootChild);
                        }
                    }
                    return;
                }
            }
           
            if (this.elementStack.isEmpty()) {
                this.rootNodes.add(node);
            } else {
                final NestableNode parent = this.elementStack.peek();
                parent.addChild(node);
            }
           
        }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

                        new Text(new String(this.textBuffer, 0, this.textBufferLen), null, null, true);
               
                if (this.elementStack.isEmpty()) {
                    this.rootNodes.add(textNode);
                } else {
                    final NestableNode parent = this.elementStack.peek();
                    parent.addChild(textNode);
                }
           
                this.textBufferLen = 0;
               
            }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

          + "\" is not an AbstractGeneralTemplateWriter");
    }

    StringWriter writer = new StringWriter();
    try {
      NestableNode parent = element.getParent();
      parent.removeChild(element);
      ((AbstractGeneralTemplateWriter) templateWriter).writeNode(arguments, writer, parent);

      Node content = new Macro(writer.toString());
      CacheManager.INSTANCE.put(arguments, cacheName, Collections.singletonList(content));
    } catch (IOException e) {
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

    @Override
    protected ProcessorResult processElement(final Arguments arguments, final Element element) {
        modifyModelAttributes(arguments, element);
       
        // Remove the tag from the DOM
        final NestableNode parent = element.getParent();
        parent.removeChild(element);
       
        return ProcessorResult.OK;
    }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

    @Override
    protected ProcessorResult processElement(Arguments arguments, Element element) {
        String name = element.getAttributeValue("name");
        String mappingPrefix = element.getAttributeValue("mapping-prefix");
        NestableNode parent = element.getParent();
        List<String> files = new ArrayList<String>();
        for (String file : element.getAttributeValue("files").split(",")) {
            files.add(file.trim());
        }
       
        if (getBundleEnabled()) {
            String versionedBundle = bundlingService.getVersionedBundleName(name);
            if (StringUtils.isBlank(versionedBundle)) {
                BroadleafResourceHttpRequestHandler reqHandler = getRequestHandler(name, arguments);
                try {
                    versionedBundle = bundlingService.registerBundle(name, files, reqHandler);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
                    .parseExpression(arguments.getConfiguration(), arguments, "@{'" + mappingPrefix + versionedBundle + "'}");
            String value = (String) expression.execute(arguments.getConfiguration(), arguments);
            Element e = getElement(value);
            parent.insertAfter(element, e);
        } else {
            List<String> additionalBundleFiles = bundlingService.getAdditionalBundleFiles(name);
            if (additionalBundleFiles != null) {
                files.addAll(additionalBundleFiles);
            }
            for (String file : files) {
                file = file.trim();
                Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
                        .parseExpression(arguments.getConfiguration(), arguments, "@{'" + mappingPrefix + file + "'}");
                String value = (String) expression.execute(arguments.getConfiguration(), arguments);
                Element e = getElement(value);
                parent.insertBefore(element, e);
            }
        }
       
        parent.removeChild(element);
        return ProcessorResult.OK;
    }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

   
  }
 
  private void wrapNodes(List<Node> toWrap, Element newElement) {
    if(toWrap.size()>0) {
      NestableNode parent = toWrap.get(0).getParent();
     
      parent.insertBefore(toWrap.get(0), newElement);
      for(Node child : toWrap) {
        parent.removeChild(child);
        newElement.addChild(child);
      }
    }   
  }
View Full Code Here

Examples of org.thymeleaf.dom.NestableNode

      }
    }   
  }

  private List<Node> getNodesToWrap(Element target) {
    NestableNode parent = target.getParent();
    List<Node> children = parent.getChildren();

    List<Node> toWrap = new ArrayList<Node>();

    final int maxElementCount = getNumberOfElementsToWrap();
    final int startIndex = indexOf(children, target);
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.