Package org.apache.tapestry5.json

Examples of org.apache.tapestry5.json.JSONObject


        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        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

        PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker();

        linker.addScript(InitializationPriority.NORMAL, "foo();");
        linker.addScript(InitializationPriority.NORMAL, "bar();");

        JSONObject reply = new JSONObject();

        linker.commit(reply);

        assertEquals(reply.get("script"), "foo();\nbar();\n");
    }
View Full Code Here

        linker.addScript(InitializationPriority.LATE, "late();");
        linker.addScript(InitializationPriority.NORMAL, "normal();");
        linker.addScript(InitializationPriority.IMMEDIATE, "immediate();");
        linker.addScript(InitializationPriority.EARLY, "early();");

        JSONObject reply = new JSONObject();

        linker.commit(reply);

        assertEquals(reply.get("script"), "immediate();\nearly();\nnormal();\nlate();\n");
    }
View Full Code Here

        PartialMarkupDocumentLinker linker = new PartialMarkupDocumentLinker();

        linker.addScriptLink("foo.js");
        linker.addScriptLink("bar.js");

        JSONObject reply = new JSONObject();

        linker.commit(reply);

        assertEquals(reply.toCompactString(), "{\"scripts\":[\"foo.js\",\"bar.js\"]}");

    }
View Full Code Here

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

        JSONObject expected = new JSONObject(
                "{\"stylesheets\":[{\"href\":\"foo.css\",\"media\":\"print\"},{\"href\":\"bar.css\"}]}");

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

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

        JSONObject spec1 = new JSONObject("order", "immediate");
        JSONObject spec2 = new JSONObject("order", "normal");

        JSONObject reply = new JSONObject();

        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

    void cleanupRender()
    {
        popContext();

        JSONObject spec = new JSONObject();

        spec.put("rowInjector", rowInjector.getClientId());
        spec.put("addRowTriggers", addRowTriggers);

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

        Object value = encoder.toValue(rowId);

        resources.triggerEvent(EventConstants.REMOVE_ROW, new Object[]
        { value }, null);

        return new JSONObject();
    }
View Full Code Here

TOP

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

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.