Package org.apache.tapestry5.json

Examples of org.apache.tapestry5.json.JSONArray


        return encoder.toClient(value);
    }

    void setupRender()
    {
        addRowTriggers = new JSONArray();

        pushContext();

        iterator = source == null ? Collections.EMPTY_LIST.iterator() : source.iterator();
View Full Code Here


    {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(stream, "UTF-8");
        PrintWriter writer = new PrintWriter(osw, true);

        JSONArray paths = new JSONArray();

        for (Asset library : libraries)
        {
            String path = library.toClientURL();

            paths.put(path);

            writer.format("\n/* %s */;\n", path);

            streamLibraryContent(library, stream);
        }
View Full Code Here

            reply.put("scripts", scripts);

        if (stylesheets.length() > 0)
            reply.put("stylesheets", stylesheets);

        JSONArray inits = new JSONArray();

        for (InitializationPriority p : InitializationPriority.values())
        {
            JSONObject init = priorityToInits.get(p);

            if (init != null)
                inits.put(init);
        }

        if (inits.length() > 0)
            reply.put("inits", inits);
    }
View Full Code Here

        {
            init = new JSONObject();
            inits.put(priority, init);
        }

        JSONArray invocations = init.has(functionName) ? init.getJSONArray(functionName) : null;

        if (invocations == null)
        {
            invocations = new JSONArray();
            init.put(functionName, invocations);
        }

        invocations.put(parameter);
    }
View Full Code Here

        head.element("meta");
        head.element("script");

        DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3", false);

        linker.setInitialization(InitializationPriority.IMMEDIATE, new JSONObject().put("fred", new JSONArray("barney",
                "wilma", "betty")));

        linker.updateDocument(document);

        assertEquals(document.toString(), readFile("pretty_print_initialization.txt"));
View Full Code Here

        {
            JSONObject spec = new JSONObject();

            DateFormatSymbols symbols = new DateFormatSymbols(locale);

            spec.put("months", new JSONArray(symbols.getMonths()));

            StringBuilder days = new StringBuilder();

            String[] weekdays = symbols.getWeekdays();
View Full Code Here

        {
            JSONObject spec = new JSONObject();

            DateFormatSymbols symbols = new DateFormatSymbols(locale);

            spec.put("months", new JSONArray(symbols.getMonths()));

            StringBuilder days = new StringBuilder();

            String[] weekdays = symbols.getWeekdays();
View Full Code Here

    }


    void setupRender()
    {
        addRowTriggers = new JSONArray();

        pushContext();

        iterator = source == null
                   ? Collections.EMPTY_LIST.iterator()
View Full Code Here

        if (showFunctionName != null) spec.put(key, showFunctionName.toLowerCase());
    }

    public void linkZone(String linkId, String elementId, Link eventLink)
    {
        JSONArray spec = new JSONArray();
        spec.put(linkId);
        spec.put(elementId);
        spec.put(eventLink.toAbsoluteURI());

        renderSupport.addInit("linkZone", spec);
    }
View Full Code Here

    public void addValidation(Field field, String validationName, String message, Object constraint)
    {
        String fieldId = field.getClientId();

        JSONArray specs;

        if (validations.has(fieldId)) specs = validations.getJSONArray(fieldId);
        else
        {
            specs = new JSONArray();
            validations.put(fieldId, specs);
        }

        JSONArray thisSpec = new JSONArray();

        thisSpec.put(validationName);
        thisSpec.put(message);

        if (constraint != null) thisSpec.put(constraint);

        specs.put(thisSpec);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.json.JSONArray

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.