Package org.apache.tapestry5.json

Examples of org.apache.tapestry5.json.JSONArray


        public void with(Object... arguments)
        {
            assert arguments != null;

            this.arguments = new JSONArray(arguments);
        }
View Full Code Here


        // Case #1: via JavaScript, the client id is passed up.

        String raw = request.getParameter(Form.SUBMITTING_ELEMENT_ID);

        if (InternalUtils.isNonBlank(raw) &&
                new JSONArray(raw).getString(0).equals(clientId))
        {
            return true;
        }

        // Case #2: No JavaScript, look for normal semantic (non-null value for the element's name).
View Full Code Here

        hasScriptsOrInitializations = true;
    }

    public void addScript(InitializationPriority priority, String script)
    {
        addInitialization(priority, "t5/core/pageinit", "evalJavaScript", new JSONArray().put(script));
    }
View Full Code Here

                convert(inits)));
    }

    private String convert(List<?> input)
    {
        return new JSONArray().putAll(input).toString(compactJSON);
    }
View Full Code Here

        }
    };

    public String getInitialJSON()
    {
        JSONArray array = new JSONArray();

        for (Object o : selected)
        {
            String value = encoder.toClient(o);
            array.put(value);
        }

        return array.toString(compactJSON);
    }
View Full Code Here

    @Override
    protected void processSubmission(String controlName)
    {
        String parameterValue = request.getParameter(controlName);

        JSONArray values = new JSONArray(parameterValue);

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

        Collection<Object> selected = this.selected;

        selected.clear();

        ValueEncoder encoder = this.encoder;

        // TODO: Validation error if the model does not contain a value.

        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

        // an opportunity to get the submitting element's value into the request properly.

        String raw = request.getParameter(SUBMITTING_ELEMENT_ID);

        if (InternalUtils.isNonBlank(raw) &&
                new JSONArray(raw).getString(1).equals(InternalConstants.CANCEL_NAME))
        {
            return true;
        }

        return false;
View Full Code Here

    private void addClasses(final String property, List<String> classes, Type type,
            final ComponentLibraryInfo info, JSONObject object)
    {
        if (classes.size() > 0)
        {
            JSONArray classesJsonArray = new JSONArray();
            for (String logicalName : classes)
            {
                logicalName = logicalName.replace("core/", "");
                final String className = getClassName(logicalName, type, componentClassResolver);
                JSONObject classJsonObject = new JSONObject();
                classJsonObject.put("logicalName", logicalName);
                classJsonObject.put("class", className);
                if (info != null)
                {
                    putIfNotNull("sourceUrl", info.getSourceUrl(className), classJsonObject);
                    putIfNotNull("javadocUrl", info.getJavadocUrl(className), classJsonObject);
                }
                try
                {
                    final Description description = getClass(className);
                    if (description != null)
                    {
                        putIfNotNull("description", description.text(), classJsonObject);
                        if (description.tags().length > 0)
                        {
                            for (String tag : description.tags())
                            {
                                classJsonObject.accumulate("tag", tag);
                            }
                        }
                    }
                }
                catch (ClassNotFoundException e)
                {
                    throw new RuntimeException(e);
                }
                classesJsonArray.put(classJsonObject);
            }
            object.put(property, classesJsonArray);
        }
    }
View Full Code Here

* @since 5.3
*/
public class StringToJSONArray implements Coercion<String,JSONArray> {
    @Override
    public JSONArray coerce(String input) {
        return new JSONArray(input);
    }
View Full Code Here

    }


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

        pushContext();

        iterator = source == null
                   ? Collections.EMPTY_LIST.iterator()
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.