Examples of NestableAttributeHolderNode


Examples of org.thymeleaf.dom.NestableAttributeHolderNode

       
        if (node instanceof NestableAttributeHolderNode) {

            final ArrayList<ProcessorAndContext> processors = new ArrayList<ProcessorAndContext>(2);
           
            final NestableAttributeHolderNode nestableNode = (NestableAttributeHolderNode) node;

            if (node instanceof Element) {
               
                final Element element = (Element) nestableNode;
               
                final Set<ProcessorAndContext> processorsForElementName =
                        this.mergedSpecificProcessorsByElementName.get(element.getNormalizedName());
                if (processorsForElementName != null) {
                    for (final ProcessorAndContext processorAndContext : processorsForElementName) {
                        if (processorAndContext.matches(node)) {
                            processors.add(processorAndContext);
                        }
                    }
                }
               
            }

            final String[] normalizedAttributeNames = nestableNode.unsafeGetAttributeNormalizedNames();
            final int normalizedAttributesLen = nestableNode.numAttributes();
            for (int i = 0; i < normalizedAttributesLen; i++) {
                final String normalizedAttributeName = normalizedAttributeNames[i];
                final Set<ProcessorAndContext> processorsForAttributeName =
                        this.mergedSpecificProcessorsByAttributeName.get(normalizedAttributeName);
                if (processorsForAttributeName != null) {
View Full Code Here

Examples of org.thymeleaf.dom.NestableAttributeHolderNode

                    } else {
                        return Collections.singletonList((Node)nestableNode);
                    }
               }
            } else if (nestableNode instanceof NestableAttributeHolderNode) {
                final NestableAttributeHolderNode attributeHolderNode = (NestableAttributeHolderNode) nestableNode;
                // If not null, an element without name can never be selectable
                if (normalizedElementName == null) {
                    if (normalizedAttributeName != null) {
                        if (attributeHolderNode.hasNormalizedAttribute(normalizedAttributeName)) {
                            final String elementAttrValue = attributeHolderNode.getAttributeValue(normalizedAttributeName);
                            if (elementAttrValue != null && elementAttrValue.trim().equals(attributeValue)) {
                                return Collections.singletonList((Node)nestableNode);
                            }
                        }
                    } else {
View Full Code Here

Examples of org.thymeleaf.dom.NestableAttributeHolderNode

        // Check whether this is a node specifying a fragment signature. If it is, process its parameters.
        if (nodes.size() == 1 && this.fragmentSignatureAttributeName != null) {
            final Node node = nodes.get(0);
            if (node instanceof NestableAttributeHolderNode) {
                final NestableAttributeHolderNode attributeHolderNode = (NestableAttributeHolderNode)node;
                if (attributeHolderNode.hasNormalizedAttribute(this.dialectPrefix, this.fragmentSignatureAttributeName)) {
                    final String attributeValue =
                            attributeHolderNode.getAttributeValueFromNormalizedName(
                                    this.dialectPrefix, this.fragmentSignatureAttributeName);
                    if (attributeValue != null) {
                        final FragmentSignature fragmentSignature =
                                FragmentSignatureUtils.parseFragmentSignature(configuration, attributeValue);
                        if (fragmentSignature != null) {
View Full Code Here

Examples of org.thymeleaf.dom.NestableAttributeHolderNode

            return true;
        }

        if (node instanceof NestableAttributeHolderNode) {

            final NestableAttributeHolderNode attributeHolderNode = (NestableAttributeHolderNode) node;

            if (attributeHolderNode.hasNormalizedAttribute(this.dialectPrefix, this.fragmentAttributeName)) {
                final String elementAttrValue =
                        attributeHolderNode.getAttributeValueFromNormalizedName(this.dialectPrefix, this.fragmentAttributeName);
                if (elementAttrValue != null) {
                    final FragmentSignature fragmentSignature =
                            FragmentSignatureUtils.parseFragmentSignature(this.configuration, elementAttrValue);
                    if (fragmentSignature != null) {
                        final String signatureFragmentName = fragmentSignature.getFragmentName();
View Full Code Here

Examples of org.thymeleaf.dom.NestableAttributeHolderNode

       
        if (!(node instanceof NestableAttributeHolderNode)) {
            return false;
        }
       
        final NestableAttributeHolderNode attributeHolderNode = (NestableAttributeHolderNode) node;
        final String prefix = context.getDialectPrefix();

        if (!attributeHolderNode.hasNormalizedAttribute(prefix, this.attributeName)) {
            return false;
        }

        if (this.elementNameFilter != null) {
            if (attributeHolderNode instanceof Element) {
                final Element element = (Element) attributeHolderNode;
                if (!element.getNormalizedName().equals(this.elementNameFilter)) {
                    return false;
                }
            } else {
                // if node is not an element (because it probably is a group of nodes, it has no
                // "element/tag name", and therefore does not match if this matcher specifies one.
                return false;
            }
        }

        if (this.attributeValuesByNameFilter != null) {

            for (final Map.Entry<String,String> filterAttributeEntry : this.attributeValuesByNameFilter.entrySet()) {

                final String filterAttributeName = filterAttributeEntry.getKey();
                final String filterAttributeValue = filterAttributeEntry.getValue();

                if (!attributeHolderNode.hasAttribute(filterAttributeName)) {
                    if (filterAttributeValue != null) {
                        return false;
                    }
                    continue;
                }
                final String elementAttributeValue = attributeHolderNode.getAttributeValue(filterAttributeName);
                if (elementAttributeValue == null) {
                    if (filterAttributeValue != null) {
                        return false;
                    }
                } else {
View Full Code Here

Examples of org.thymeleaf.dom.NestableAttributeHolderNode

import org.thymeleaf.processor.ProcessorMatchingContext;

public class WithMatcher implements IProcessorMatcher<NestableAttributeHolderNode> {

  public boolean matches(Node node, ProcessorMatchingContext context) {
    NestableAttributeHolderNode element = (NestableAttributeHolderNode) node;

    if (context.getDialect() instanceof WithDialect) {
      String dialectPrefix = context.getDialectPrefix();
      Map<String, Attribute> attributeMap = element.getAttributeMap();
      Collection<Attribute> values = attributeMap.values();
      for (Attribute attribute : values) {
        if (dialectPrefix.equals(Attribute.getPrefixFromAttributeName(attribute.getNormalizedName()))) {
          return true;
        }
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.