Package org.apache.tapestry.json

Examples of org.apache.tapestry.json.JSONArray


        if ( _methodArgumentsArray == null)
        {
            try
            {
                _methodArgumentsArray = _methodArguments != null
                                        ? new JSONArray( _methodArguments )
                                        : new JSONArray();
            }
            catch (ParseException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
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 = _selected;

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

        ValueEncoder encoder = _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 : _naturalOrder)
        {
            naturalOrder.put(value);
        }

        String clientId = getClientId();

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

        _dirty = true;
    }

    public void linkZone(String linkId, String elementId)
    {
        JSONArray spec = new JSONArray();
        spec.put(linkId);
        spec.put(elementId);

        _links.put(spec);

        _dirty = true;
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

    @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 = _selected;

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

        ValueEncoder encoder = _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 : _naturalOrder)
        {
            naturalOrder.put(value);
        }

        String clientId = getClientId();

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

     * {@inheritDoc}
     */
    public JSONArray array()
    {
        if (_array == null)
            _array = new JSONArray();
       
        return _array;
    }
View Full Code Here

        if (showFunctionName != null) spec.put(key, showFunctionName.toLowerCase());
    }

    public void linkZone(String linkId, String elementId)
    {
        JSONArray spec = new JSONArray();
        spec.put(linkId);
        spec.put(elementId);

        _links.put(spec);

        _zonesDirty = true;
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

TOP

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