Examples of JavaScriptStack


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

    private BytestreamCache assembleStackContent(String localeName, String stackName) throws IOException
    {
        localizationSetter.setNonPeristentLocaleFromLocaleName(localeName);

        JavaScriptStack stack = javascriptStackSource.getStack(stackName);
        List<Asset> libraries = stack.getJavaScriptLibraries();

        return assembleStackContent(libraries);
    }
View Full Code Here

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

    private void addAssetsFromStack(String stackName)
    {
        if (addedStacks.containsKey(stackName))
            return;

        JavaScriptStack stack = javascriptStackSource.getStack(stackName);

        for (String dependentStackname : stack.getStacks())
        {
            addAssetsFromStack(dependentStackname);
        }

        stackLibraries.addAll(stackPathConstructor.constructPathsForJavaScriptStack(stackName));

        stylesheetLinks.addAll(stack.getStylesheets());

        String initialization = stack.getInitialization();

        if (initialization != null)
            linker.addScript(InitializationPriority.IMMEDIATE, initialization);

        addedStacks.put(stackName, true);
View Full Code Here

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

    }

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

        List<String> libraryPaths = Collections.emptyList();
        List<StylesheetLink> stylesheets = Collections.emptyList();
        List<String> stacks = libraryPaths;

        expect(stackSource.getStack(InternalConstants.CORE_STACK_NAME)).andReturn(stack);
        expect(pathConstructor.constructPathsForJavaScriptStack(InternalConstants.CORE_STACK_NAME)).andReturn(
                libraryPaths);
        expect(stack.getStylesheets()).andReturn(stylesheets);

        expect(stack.getInitialization()).andReturn(null);

        expect(stack.getStacks()).andReturn(stacks);
    }
View Full Code Here

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

    }

    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));

        expect(stack.getInitialization()).andReturn("stackInit();");

        List<String> stacks = Collections.emptyList();
        expect(stack.getStacks()).andReturn(stacks);

        linker.addScriptLink("stack1.js");
        linker.addScriptLink("stack2.js");
        linker.addStylesheetLink(stylesheetLink);
    }
View Full Code Here

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

        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();

        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));

        expect(stack.getInitialization()).andReturn("customInit();");

        List<String> stacks = Collections.emptyList();
        expect(stack.getStacks()).andReturn(stacks);

        linker.addScriptLink("stack.js");
        linker.addStylesheetLink(stylesheetLink);

        linker.addScript(InitializationPriority.IMMEDIATE, "stackInit();");
View Full Code Here

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

        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();

        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"));

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

        expect(pathConstructor.constructPathsForJavaScriptStack("parent")).andReturn(Arrays.asList("parent.js"));
        expect(parent.getStylesheets()).andReturn(Arrays.asList(parentStylesheetLink));

        expect(parent.getInitialization()).andReturn("parentInit();");

        expect(pathConstructor.constructPathsForJavaScriptStack("child")).andReturn(Arrays.asList("child.js"));
        expect(child.getStylesheets()).andReturn(Arrays.asList(childStylesheetLink));

        expect(child.getInitialization()).andReturn("childInit();");

        expect(parent.getStacks()).andReturn(Collections.<String> emptyList());

        linker.addScriptLink("parent.js");
        linker.addScriptLink("child.js");

        linker.addStylesheetLink(parentStylesheetLink);
View Full Code Here

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

        this.configuration = configuration;
    }

    public JavaScriptStack getStack(String name)
    {
        JavaScriptStack stack = configuration.get(name);

        if (stack == null)
            throw new UnknownValueException(String.format("No JavaScriptStack with name '%s'.", name),
                    new AvailableValues("Configured JavaScript stacks", configuration));
View Full Code Here

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

    private void addAssetsFromStack(String stackName)
    {
        if (addedStacks.containsKey(stackName))
            return;

        JavaScriptStack stack = javascriptStackSource.getStack(stackName);

        for (String dependentStackname : stack.getStacks())
        {
            addAssetsFromStack(dependentStackname);
        }

        stackLibraries.addAll(stackPathConstructor.constructPathsForJavaScriptStack(stackName));

        stylesheetLinks.addAll(stack.getStylesheets());

        addedStacks.put(stackName, true);

        String initialization = stack.getInitialization();

        if (initialization != null)
            addScript(InitializationPriority.IMMEDIATE, initialization);
    }
View Full Code Here

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

    private StreamableResource assembleStackContent(String localeName, String stackName) throws IOException
    {
        localizationSetter.setNonPeristentLocaleFromLocaleName(localeName);

        JavaScriptStack stack = javascriptStackSource.getStack(stackName);
        List<Asset> libraries = stack.getJavaScriptLibraries();

        StreamableResource stackContent = assembleStackContent(localeName, stackName, libraries);

        return minificationEnabled ? resourceMinimizer.minimize(stackContent) : stackContent;
    }
View Full Code Here

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

        this.configuration = configuration;
    }

    public JavaScriptStack getStack(String name)
    {
        JavaScriptStack stack = findStack(name);

        if (stack == null)
        {
            throw new UnknownValueException(String.format("No JavaScriptStack with name '%s'.", name),
                    new AvailableValues("Configured JavaScript stacks", configuration));
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.