Package org.apache.tapestry5.json

Examples of org.apache.tapestry5.json.JSONArray


        {
            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


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

        StringBuilder master = new StringBuilder();
        JSONArray inits = new JSONArray();

        for (InitializationPriority p : InitializationPriority.values())
        {
            StringBuilder builder = priorityToScript.get(p);

            if (builder != null)
                master.append(builder);

            JSONObject init = priorityToInits.get(p);

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

        if (master.length() > 0)
            reply.put("script", master.toString());

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

        javascriptSupport.addInitializerCall(functionName, parameter);
    }

    public void addInit(String functionName, String... parameters)
    {
        JSONArray array = new JSONArray();

        for (String parameter : parameters)
        {
            array.put(parameter);
        }

        addInit(functionName, array);
    }
View Full Code Here

    private void addInitFunctionInvocation(String functionName, Object parameters)
    {
        assert InternalUtils.isNonBlank(functionName);
        assert parameters != null;

        JSONArray list = new JSONArray().put(parameters);
        JSONObject wrapper = new JSONObject().put(functionName, list);

        addScript("Tapestry.init(%s);", wrapper);
    }
View Full Code Here

    }


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

        pushContext();

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

        {
            addInitFunctionInvocation(functionName, parameters[0]);
            return;
        }

        JSONArray array = new JSONArray();

        for (String parameter : parameters)
        {
            array.put(parameter);
        }

        addInitFunctionInvocation(functionName, array);
    }
View Full Code Here

    private void addInitFunctionInvocation(String functionName, Object parameters)
    {
        Defense.notBlank(functionName, "functionName");
        Defense.notNull(parameters, "parameters");

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

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

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

    @Override
    protected void processSubmission(String elementName)
    {
        String parameterValue = request.getParameter(elementName + ":values");
        JSONArray values = new JSONArray(parameterValue);

        // Use a couple of local variables to cut down on access via bindings

        List<Object> selected = this.selected;

        if (selected == null) selected = newList();
        else selected.clear();

        ValueEncoder encoder = this.encoder;


        int count = values.length();
        for (int i = 0; i < count; i++)
        {
            String value = values.getString(i);

            Object objectValue = encoder.toValue(value);

            selected.add(objectValue);
        }
View Full Code Here

        if (disabled) writer.attributes("disabled", "disabled");
    }

    void beginRender(MarkupWriter writer)
    {
        JSONArray selectedValues = new JSONArray();

        for (OptionModel selected : selectedOptions)
        {

            Object value = selected.getValue();
            String clientValue = encoder.toClient(value);

            selectedValues.put(clientValue);
        }

        JSONArray naturalOrder = new JSONArray();

        for (String value : this.naturalOrder)
        {
            naturalOrder.put(value);
        }

        String clientId = getClientId();

        renderSupport.addScript("new Tapestry.Palette('%s', %s, %s);", clientId, reorder, naturalOrder);
View Full Code Here

/**
* @since 5.3
*/
public class StringToJSONArray implements Coercion<String,JSONArray> {
    public JSONArray coerce(String input) {
        return new JSONArray(input);
    }
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.