Examples of convertFromString()


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 ? 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 ? 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 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()

                throw new SAXException("Unkown boolean: " + input);
        } else 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()

            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.convertor.Convertor.convertFromString()

                Object value;
                if ("".equals(stringValue)) {
                    // Empty value translates into the null object
                    value = null;
                } else {
                    ConversionResult conversionResult = convertor.convertFromString(stringValue, Locale.US, formatCache);
                    if (!conversionResult.isSuccessful()) {
                        throw new Exception("Could not convert the value \"" + stringValue +
                                            "\" to the type " + datatype.getDescriptiveName() +
                                            ", defined at " + DomHelper.getLocation(element));
                    }
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.