Package org.apache.tapestry.json

Examples of org.apache.tapestry.json.JSONObject


       
        writer.end();
        renderDelegateSuffix(writer, cycle);
       
        // now create widget parms
        JSONObject json = new JSONObject();
        json.put("inputId", getClientId());
        json.put("inputName", getName());
        json.put("iconAlt", getIconAlt());
        json.put("displayFormat", translator.getPattern(getPage().getLocale()));
        json.put("saveFormat", translator.getPattern(getPage().getLocale()));
       
        if (getValue() != null) {
            json.put("value", translator.formatRfc3339(getValue()));
        }
       
        json.put("disabled", isDisabled());
        if (getDisplayWeeks() > 0)
            json.put("displayWeeks", getDisplayWeeks());
        if (isAdjustWeeks())
            json.put("adjustWeeks", isAdjustWeeks());
        if (getStartDate() != null)
            json.put("startDate", translator.formatRfc3339(getStartDate()));
        if (getEndDate() != null)
            json.put("endDate", translator.formatRfc3339(getEndDate()));
        if (getWeekStartsOn() > -1)
            json.put("weekStartsOn", getWeekStartsOn());
        if (isStaticDisplay())
            json.put("staticDisplay", isStaticDisplay());

        Map parms = new HashMap();
        parms.put("clientId", getClientId());
        parms.put("props", json.toString());
        parms.put("widget", this);
       
        getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
    }
View Full Code Here


        ContentType contentType = new ContentType("text/javascript");
        contentType.setParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER, charset);

        MarkupWriter writer = _factory.newMarkupWriter(pageContentType);

        JSONObject reply = new JSONObject();

        // ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.

        _partialMarkupRenderer.renderMarkup(writer, reply);
View Full Code Here

                       "alt", "[Show]");
        writer.end(); // img

        // The setup parameters passed to Calendar.setup():

        JSONObject setup = new JSONObject();

        setup.put("field", clientId);

        // TODO: consolodate DatePicker initialization across the page.

        _support.addScript("new Tapestry.DateField(%s);", setup);
    }
View Full Code Here

        if (!_visible) e.addClassName("t-invisible");

        // And continue on to render the body

        JSONObject spec = new JSONObject();
        spec.put("div", _clientId);

        _zoneSetup.addZone(_clientId, _show, _update);
    }
View Full Code Here

        element.triggerContextEvent(parameters.getEventType(), parameters.getEventContext(), callback);

        if (callback.isAborted()) return;

        JSONObject reply = new JSONObject();

        _resultProcessor.processResultValue(reply);

    }
View Full Code Here

        _pageRenderSupport = pageRenderSupport;
    }

    public void addZone(String clientId, String showFunctionName, String updateFunctionName)
    {
        JSONObject spec = new JSONObject();
        spec.put("div", clientId);

        if (showFunctionName != null) spec.put("show", showFunctionName.toLowerCase());

        if (updateFunctionName != null) spec.put("update", updateFunctionName.toLowerCase());

        _zones.put(spec);

        _dirty = true;
    }
View Full Code Here

    @Test
    public void add_links()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject("{ zones: [], links: [['client1', 'zone1'], ['client2', 'zone2']] }");

        support.addScript(INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ZoneSetupImpl setup = new ZoneSetupImpl(support);
View Full Code Here

    @Test
    public void add_zones()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject("{ zones: [ {div:'client1'}, {div:'client2'} ], links:[] }");

        support.addScript(INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ZoneSetupImpl setup = new ZoneSetupImpl(support);
View Full Code Here

    public void zones_with_functions()
    {
        PageRenderSupport support = mockPageRenderSupport();


        JSONObject template = new JSONObject(
                "{ zones: [ {div:'client1', show:'showme'}, {div:'client2', update:'updateme'} ], links:[] }");

        support.addScript(INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ZoneSetupImpl setup = new ZoneSetupImpl(support);
View Full Code Here

    @Test
    public void zone_function_names_are_converted_to_lower_case()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject(
                "{ zones: [ {div:'client1', show:'showme'}, {div:'client2', update:'updateme'} ], links:[] }");

        support.addScript(INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ZoneSetupImpl setup = new ZoneSetupImpl(support);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.