Package org.apache.tapestry5.services.javascript

Examples of org.apache.tapestry5.services.javascript.StylesheetLink


        "class", "t-autocomplete-menu");
        writer.end();

        Link link = resources.createEventLink(EVENT_NAME);

        JSONObject config = new JSONObject();
        config.put("paramName", PARAM_NAME);
        config.put("indicator", loaderId);

        if (resources.isBound("minChars"))
            config.put("minChars", minChars);

        if (resources.isBound("frequency"))
            config.put("frequency", frequency);

        if (resources.isBound("tokens"))
        {
            for (int i = 0; i < tokens.length(); i++)
            {
                config.accumulate("tokens", tokens.substring(i, i + 1));
            }
        }

        // Let subclasses do more.
        configure(config);
View Full Code Here


    }

    public void importStylesheet(Asset stylesheet)
    {
        assert stylesheet != null;
        importStylesheet(new StylesheetLink(stylesheet));
    }
View Full Code Here

    private void trainForCoreStack(DocumentLinker linker, JavaScriptStackSource stackSource,
            JavaScriptStackPathConstructor pathConstructor)
    {
        JavaScriptStack stack = mockJavaScriptStack();

        StylesheetLink stylesheetLink = new StylesheetLink("style.css");

        expect(stackSource.getStack(InternalConstants.CORE_STACK_NAME)).andReturn(stack);
        expect(pathConstructor.constructPathsForJavaScriptStack(InternalConstants.CORE_STACK_NAME)).andReturn(
                CollectionFactory.newList("stack1.js", "stack2.js"));
        expect(stack.getStylesheets()).andReturn(CollectionFactory.newList(stylesheetLink));
View Full Code Here

        trainForCoreStack(linker, stackSource, pathConstructor);

        JavaScriptStack stack = mockJavaScriptStack();

        StylesheetLink stylesheetLink = new StylesheetLink("stack.css");

        expect(stackSource.getStack("custom")).andReturn(stack);
        expect(pathConstructor.constructPathsForJavaScriptStack("custom")).andReturn(
                CollectionFactory.newList("stack.js"));
        expect(stack.getStylesheets()).andReturn(CollectionFactory.newList(stylesheetLink));
View Full Code Here

        trainForCoreStack(linker, stackSource, pathConstructor);

        JavaScriptStack child = mockJavaScriptStack();
        JavaScriptStack parent = mockJavaScriptStack();

        StylesheetLink parentStylesheetLink = new StylesheetLink("parent.css");

        StylesheetLink childStylesheetLink = new StylesheetLink("child.css");

        expect(stackSource.getStack("child")).andReturn(child);

        expect(child.getStacks()).andReturn(Arrays.asList("parent"));
View Full Code Here

    public void import_stylesheet_as_asset()
    {
        DocumentLinker linker = mockDocumentLinker();
        Asset stylesheet = mockAsset("style.css");

        StylesheetLink link = new StylesheetLink("style.css");
        linker.addStylesheetLink(link);

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, null, null);
View Full Code Here

    public void duplicate_stylesheet_ignored_first_media_wins()
    {
        DocumentLinker linker = mockDocumentLinker();
        StylesheetOptions options = new StylesheetOptions("print");

        linker.addStylesheetLink(new StylesheetLink("style.css", options));

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, null, null);

        jss.importStylesheet(new StylesheetLink("style.css", options));
        jss.importStylesheet(new StylesheetLink("style.css", new StylesheetOptions("hologram")));

        jss.commit();

        verify();
    }
View Full Code Here

    @Test
    public void stylesheet_link()
    {
        PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker();

        linker.addStylesheetLink(new StylesheetLink("foo.css", new StylesheetOptions("print")));
        linker.addStylesheetLink(new StylesheetLink("bar.css"));

        JSONObject reply = new JSONObject();

        linker.commit(reply);
View Full Code Here

        {
            public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
            {
                DocumentLinker linker = environment.peekRequired(DocumentLinker.class);

                linker.addStylesheetLink(new StylesheetLink(defaultStylesheet.toClientURL()));

                renderer.renderMarkup(writer);
            }
        };
View Full Code Here

    {
        String media = "print";
        JavaScriptSupport javascriptSupport = mockJavaScriptSupport();
        Asset asset = mockAsset("foo.css");

        javascriptSupport.importStylesheet(new StylesheetLink("foo.css", new StylesheetOptions(media)));

        replay();

        RenderSupport support = new RenderSupportImpl(null, null, javascriptSupport);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.javascript.StylesheetLink

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.