Package org.apache.tapestry.json

Examples of org.apache.tapestry.json.JSONObject


        // with translators during client side validation as well
        DateTranslator translator = (DateTranslator) getFieldTranslator(field, DateTranslator.class);
        if (translator == null)
            return;
       
        JSONObject profile = context.getProfile();
       
        context.addInitializationScript(field, "dojo.require(\"tapestry.form.datetime\");");
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        accumulateProperty(cons, field.getClientId(),
                new JSONLiteral("[tapestry.form.datetime.isValidDate,{"
                        + "min:"
                        + JSONObject.quote(translator.format(field, context.getLocale(), _minDate))
View Full Code Here


     */
    public void accumulateProfileProperty(IFormComponent field, JSONObject profile,
            String key, Object property)
    {
        if (!profile.has(field.getClientId()))
            profile.put(field.getClientId(), new JSONObject());
       
        JSONObject fieldProps = profile.getJSONObject(field.getClientId());
       
        accumulateProperty(fieldProps, key, property);
    }
View Full Code Here

       
        _rewinding = cycle.isRewound(form);
        _allocatedIdIndex = 0;
       
        _pageRenderSupport = TapestryUtils.getOptionalPageRenderSupport(cycle);
        _profile = new JSONObject();
    }
View Full Code Here

        // with translators during client side validation as well
        DateTranslator translator = (DateTranslator) getFieldTranslator(field, DateTranslator.class);
        if (translator == null)
            return;
       
        JSONObject profile = context.getProfile();
       
        context.addInitializationScript(field, "dojo.require(\"tapestry.form.datetime\");");
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        accumulateProperty(cons, field.getClientId(),
                new JSONLiteral("[tapestry.form.datetime.isValidDate,{"
                        + "max:"
                        + JSONObject.quote(translator.format(field, context.getLocale(), _maxDate))
View Full Code Here

    }

    public void renderContribution(IMarkupWriter writer, IRequestCycle cycle,
            FormComponentContributorContext context, IFormComponent field)
    {
        JSONObject profile = context.getProfile();
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        accumulateProperty(cons, field.getClientId(),
                new JSONLiteral("[dojo.validate.isText,{"
                        + "minlength:" + _minLength + "}]"));
       
View Full Code Here

            FormComponentContributorContext context, IFormComponent field)
    {
        super.renderContribution(writer, cycle, context, field);
       
        if (_trim) {
            JSONObject profile = context.getProfile();
           
            accumulateProperty(profile, ValidationConstants.TRIM, field.getClientId());
        }
    }
View Full Code Here

    public void renderContribution(IMarkupWriter writer, IRequestCycle cycle,
            FormComponentContributorContext context, IFormComponent field)
    {
        context.registerForFocus(ValidationConstants.REQUIRED_FIELD);
       
        JSONObject profile = context.getProfile();
       
        accumulateProperty(profile, ValidationConstants.REQUIRED, field.getClientId());
       
        accumulateProfileProperty(field, profile,
                ValidationConstants.REQUIRED, buildMessage(context, field));
View Full Code Here

    {
        super.renderContribution(writer, cycle, context, field);
       
        String message = buildMessage(context, field, getMessageKey());
       
        JSONObject profile = context.getProfile();
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
       
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        DecimalFormat format = getDecimalFormat(context.getLocale());
       
        cons.accumulate(field.getClientId(),
                new JSONLiteral("[dojo.validate.isRealNumber,{"
                        + ((format.getMaximumFractionDigits() > 0)
                        ? "" : "places:" + format.getMaximumFractionDigits() + ",")
                        + "decimal:"
                        + JSONObject.quote(format.getDecimalFormatSymbols().getDecimalSeparator()) + ","
View Full Code Here

    }
   
    public void renderContribution(IMarkupWriter writer, IRequestCycle cycle,
            FormComponentContributorContext context, IFormComponent field)
    {
        JSONObject profile = context.getProfile();
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        // TODO: Should find some way to provide this globally and cache.
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(context.getLocale());
       
        accumulateProperty(cons, field.getClientId(),
View Full Code Here

     */
    public void accumulateProfileProperty(IFormComponent field, JSONObject profile,
            String key, Object property)
    {
        if (!profile.has(field.getClientId()))
            profile.put(field.getClientId(), new JSONObject());
       
        JSONObject fieldProps = profile.getJSONObject(field.getClientId());
       
        accumulateProperty(fieldProps, key, property);
    }
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.