Examples of MatcherContext


Examples of com.volantis.styling.impl.engine.matchers.MatcherContext

        });

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        MatcherContext matcherContext = new MatcherContextImpl(
                elementStackMock);

        matcherContext.prepareForCascade(attributesMock);

        assertSame("Local name", LOCAL_NAME, matcherContext.getLocalName());
        assertSame("Namespace", NAMESPACE, matcherContext.getNamespace());
        assertEquals("Position", POSITION, matcherContext.getPosition());

        assertSame("Attribute Value (1)", ATTRIBUTE_VALUE1,
                   matcherContext.getAttributeValue(NAMESPACE, LOCAL_NAME));
        assertSame("Attribute Value (2)", ATTRIBUTE_VALUE2,
                   matcherContext.getAttributeValue(NAMESPACE, LOCAL_NAME));

    }
View Full Code Here

Examples of com.volantis.styling.impl.engine.matchers.MatcherContext

        // Clear the flag that indicates whether the styling has to be
        // deferred.
        stylingDeferred = false;

        // Make sure that the matcher is prepared for the cascade.
        MatcherContext matcherContext = stylerContext.getMatcherContext();
        matcherContext.prepareForCascade(attributes);

        if (iterator instanceof IndexableStylerList) {
            IndexableStylerList styler = (IndexableStylerList) iterator;
            BitSet indexRef = styler.createIndexRef();
            styler.lookupElement(indexRef, matcherContext.getLocalName());
            String classes = attributes.getAttributeValue(null, "class");
            if (classes != null) {
                if (classes.indexOf(' ') > -1) {
                    // TODO later - this can probably be more efficient
                    StringTokenizer tokenizer = new StringTokenizer(classes, " ");
                    while (tokenizer.hasMoreTokens()) {
                        String token = tokenizer.nextToken();
                        styler.lookupClass(indexRef, token);
                    }
                } else {
                    styler.lookupClass(indexRef, classes);
                }
            }

            // Exclude stylers which require state that isn't present
            BitSet requiresState = styler.stateRequired();
            Iterator it = matcherContext.stateMarkers();
            if (it != null && it.hasNext()) {
                BitSet stateActive = new BitSet();
                while (it.hasNext()) {
                    StateMarker marker = (StateMarker) it.next();
                    if (marker.isActive()) {
View Full Code Here

Examples of com.volantis.styling.impl.engine.matchers.MatcherContext

    public StylingEngineImpl(
            StyleSheetCompilerFactory styleSheetCompilerFactory) {

        this.elementStack = new ElementStack();

        MatcherContext matcherContext = new MatcherContextImpl(elementStack);

        listeners = new MutableListenersImpl();

        this.stylerContext = new StandardStylerContextImpl(matcherContext,
                listeners);
View Full Code Here

Examples of com.volantis.styling.impl.engine.matchers.MatcherContext

    // Javadoc inherited.
    public StylerResult style(StylerContext context) {

        // Check to see whether the matcher matches the current element.
        MatcherContext matcherContext =
                context.getMatcherContext();
        MatcherResult result = matcher.matches(matcherContext);
        StylerResult stylerResult;
        if (result == MatcherResult.MATCHED) {
            // The matcher matched so merge the styles in.
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void endsWithMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "endsWith", ".xml");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc.xml");
        assertTrue(matches.containsValue("abc.xml"));
        assertTrue(matches.containsValue("abc"));
        assertEquals(2, matches.size());
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void startsWithMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "startsWith", "abc");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("/44"));
        assertEquals(2, matches.size());
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void regexpMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "regexp", "([a-zA-Z\\-]+)/(.*)");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("abc"));
        assertTrue(matches.containsValue("44"));
        assertEquals(3, matches.size());
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void regexpMatchingAttributeWithSlash() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "regexp", "([a-zA-Z\\-]+)/(.*)");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("abc"));
        assertTrue(matches.containsValue("44"));
        assertEquals(3, matches.size());
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void containsMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "contains", "123");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("000123456");
        assertTrue(matches.containsValue("000123456"));
        assertEquals(1, matches.size());
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext

    @Test
    public void equalsMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "equals", "123");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("123");
        assertTrue(matches.containsValue("123"));
        assertEquals(1, matches.size());
    }
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.