Package org.apache.tapestry5.json

Examples of org.apache.tapestry5.json.JSONArray


        }

        // Let subclasses do more.
        configure(config);

        renderSupport.addInit("autocompleter", new JSONArray(id, menuId, link.toAbsoluteURI(), config));
    }
View Full Code Here


        expect(response.getPrintWriter("application/json;charset=UTF-8")).andReturn(pw);

        replay();

        JSONArray array = new JSONArray("   [ \"fred\", \"barney\" \n\n]");

        JSONArrayEventResultProcessor p = new JSONArrayEventResultProcessor(response, encoding);

        p.processResultValue(array);
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

    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

        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        JSONObject spec1 = new JSONObject("clientId", "chuck");
        JSONObject spec2 = new JSONObject("clientId", "fred");

        JSONObject aggregated = new JSONObject().put("setup", new JSONArray(spec1, spec2));

        linker.setInitialization(InitializationPriority.IMMEDIATE, aggregated);

        replay();
View Full Code Here

        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        JSONObject aggregated = new JSONObject().put("setup", new JSONArray("chuck", "charley"));

        linker.setInitialization(InitializationPriority.IMMEDIATE, aggregated);

        replay();
View Full Code Here

        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        JSONObject aggregated = new JSONObject().put("setup", new JSONArray().put("chuck"));

        linker.setInitialization(InitializationPriority.NORMAL, aggregated);

        replay();
View Full Code Here

        linker.setInitialization(InitializationPriority.NORMAL, spec2);
        linker.setInitialization(InitializationPriority.IMMEDIATE, spec1);

        linker.commit(reply);

        JSONObject expected = new JSONObject().put("inits", new JSONArray(spec1, spec2));

        assertEquals(reply, expected);
    }
View Full Code Here

        return encoder.toClient(value);
    }

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

        pushContext();

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

    @Test
    public void add_multiple_string_init_parameters()
    {
        JavaScriptSupport js = mockJavaScriptSupport();

        JSONObject spec = new JSONObject().put("foo", new JSONArray().put(new JSONArray("fred", "barney")));

        js.addScript("Tapestry.init(%s);", spec);

        replay();
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.