Examples of convertFromString()


Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

        Element initialValueElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "initial-value", false);
        if (initialValueElement != null) {
            String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
            Locale locale = localeValue == null ? null : I18nUtils.parseLocale(localeValue);
            String value = DomHelper.getElementText(initialValueElement);
            ConversionResult result = datatype.convertFromString(value, locale);
            if (!result.isSuccessful()) {
                throw new Exception("Cannot parse initial value '" + value + "' at " +
                        DomHelper.getLocation(initialValueElement));
            }
            initialValue = result.getResult();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

        if (this.currentWidget instanceof MultiValueField && isMultiValueItem) {
            MultiValueField field = (MultiValueField)this.currentWidget;
            Datatype type = field.getDatatype();
            ConversionResult conv =
                type.convertFromString(input, this.locale);
            if (conv.isSuccessful()) {
                Object[] values = (Object[])field.getValue();
                int valLen = values == null ? 0 : values.length;
                Object[] newValues = new Object[valLen + 1];
                for (int i = 0; i < valLen; i++)
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

                                       " to " + type.getTypeClass());
        } else if (this.currentWidget instanceof DataWidget) {
            DataWidget data = (DataWidget)this.currentWidget;
            Datatype type = data.getDatatype();
            ConversionResult conv =
                type.convertFromString(input, this.locale);
            if (conv.isSuccessful()) {
                data.setValue(conv.getResult());
            } else
                throw new SAXException("Could not convert: " + input +
                                       " to " + type.getTypeClass());
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
            if (initialValueElement != null) {
                String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
                Locale locale = localeValue == null ? Locale.getDefault() : I18nUtils.parseLocale(localeValue);
                String value = DomHelper.getElementText(initialValueElement);
                ConversionResult result = datatype.convertFromString(value, locale);
                if (!result.isSuccessful()) {
                    throw new FormsException("Cannot parse initial value '" + value + "'.",
                                             DomHelper.getLocationObject(initialValueElement));
                }
                initialValue = result.getResult();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
            if (initialValueElement != null) {
                String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
                Locale locale = localeValue == null ? Locale.getDefault() : I18nUtils.parseLocale(localeValue);
                String value = DomHelper.getElementText(initialValueElement);
                ConversionResult result = datatype.convertFromString(value, locale);
                if (!result.isSuccessful()) {
                    throw new FormsException("Cannot parse initial value '" + value + "'.",
                                             DomHelper.getLocationObject(initialValueElement));
                }
                initialValue = result.getResult();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            return;

        if (this.currentWidget instanceof MultiValueField && isMultiValueItem) {
            MultiValueField field = (MultiValueField) this.currentWidget;
            Datatype type = field.getDatatype();
            ConversionResult conv = type.convertFromString(input, this.locale);
            if (!conv.isSuccessful()) {
                throw new SAXException("Could not convert: " + input +
                                       " to " + type.getTypeClass());
            }
            Object[] values = (Object[]) field.getValue();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            newValues[valLen] = conv.getResult();
            field.setValues(newValues);
        } else if (this.currentWidget instanceof DataWidget) {
            DataWidget data = (DataWidget) this.currentWidget;
            Datatype type = data.getDatatype();
            ConversionResult conv = type.convertFromString(input, this.locale);
            if (!conv.isSuccessful()) {
                throw new SAXException("Could not convert: " + input +
                                       " to " + type.getTypeClass());
            }
            data.setValue(conv.getResult());
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
            if (initialValueElement != null) {
                String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
                Locale locale = localeValue == null ? Locale.getDefault() : I18nUtils.parseLocale(localeValue);
                String value = DomHelper.getElementText(initialValueElement);
                ConversionResult result = datatype.convertFromString(value, locale);
                if (!result.isSuccessful()) {
                    throw new FormsException("Cannot parse initial value '" + value + "'.",
                                             DomHelper.getLocationObject(initialValueElement));
                }
                initialValue = result.getResult();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            return;

        if (this.currentWidget instanceof MultiValueField && isMultiValueItem) {
            MultiValueField field = (MultiValueField) this.currentWidget;
            Datatype type = field.getDatatype();
            ConversionResult conv = type.convertFromString(input, this.locale);
            if (!conv.isSuccessful()) {
                throw new SAXException("Could not convert: " + input +
                                       " to " + type.getTypeClass());
            }
            Object[] values = (Object[]) field.getValue();
View Full Code Here

Examples of org.apache.cocoon.forms.datatype.Datatype.convertFromString()

            newValues[valLen] = conv.getResult();
            field.setValues(newValues);
        } else if (this.currentWidget instanceof DataWidget) {
            DataWidget data = (DataWidget) this.currentWidget;
            Datatype type = data.getDatatype();
            ConversionResult conv = type.convertFromString(input, this.locale);
            if (!conv.isSuccessful()) {
                throw new SAXException("Could not convert: " + input +
                                       " to " + type.getTypeClass());
            }
            data.setValue(conv.getResult());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.