catch up with development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/CustomDecimalFieldPresentation.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/CustomDecimalFieldPresentation.java
index d2a90b3..08f7858 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/CustomDecimalFieldPresentation.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/components/CustomDecimalFieldPresentation.java
@@ -40,7 +40,7 @@
import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
-import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalDoubleConverter;
import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
import com.vaadin.data.Property;
@@ -142,7 +142,7 @@
*/
@Override
protected Converter<?, ?> getDefaultConverter() {
- return new DecimalConverter();
+ return new DecimalDoubleConverter();
}
/* (non-Javadoc)
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/CustomDecimalConverter.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/CustomDecimalConverter.java
index b4a9ddf..948fe36 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/CustomDecimalConverter.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/CustomDecimalConverter.java
@@ -29,7 +29,7 @@
import org.eclipse.osbp.ecview.core.common.services.IServiceRegistry;
import org.eclipse.osbp.ecview.extension.model.converter.YCustomDecimalConverter;
import org.eclipse.osbp.ecview.extension.vaadin.components.utils.FunctionWrapper;
-import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalDoubleConverter;
import org.eclipse.osbp.ui.api.functionlibrary.IFunctionLibraryService;
import org.eclipse.osbp.utils.functionnormalizer.api.FunctionTypingAPI;
import org.eclipse.osbp.xtext.functionlibrary.common.uomo.DimensionlessUnit;
@@ -43,7 +43,7 @@
* The Class CustomDecimalConverter.
*/
@SuppressWarnings("serial")
-public class CustomDecimalConverter extends DecimalConverter {
+public class CustomDecimalConverter extends DecimalDoubleConverter {
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalFloatConverter.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalFloatConverter.java
deleted file mode 100644
index 3938f74..0000000
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalFloatConverter.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- *
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Florian Pirchner - Initial implementation
- *
- */
-package org.eclipse.osbp.ecview.extension.presentation.vaadin.converter;
-
-import java.math.RoundingMode;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.text.NumberFormat;
-import java.util.Locale;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-import com.vaadin.data.util.converter.StringToFloatConverter;
-
-/**
- * A converter used to format and parse Decimal values.
- */
-@SuppressWarnings("serial")
-public class DecimalFloatConverter extends StringToFloatConverter {
-
- /** The integer instance. */
- private boolean integerInstance;
-
- /** The number format pattern. */
- private String numberFormatPattern;
-
- /** The use grouping. */
- private boolean useGrouping;
-
- /** The decimal format symbols. */
- private DecimalFormatSymbols decimalFormatSymbols;
-
- /** The custom format symbols. */
- private boolean customFormatSymbols;
-
- /** The precision. */
- private int precision;
-
- /**
- * Instantiates a new decimal float converter.
- */
- public DecimalFloatConverter() {
- this(false);
- }
-
- /**
- * Instantiates a new decimal float converter.
- *
- * @param integerInstance
- * the integer instance
- */
- public DecimalFloatConverter(boolean integerInstance) {
- this.integerInstance = integerInstance;
- this.numberFormatPattern = getDefaultFormat();
- this.decimalFormatSymbols = getDefaultFormatSymbols();
- this.precision = getDefaultPrecision();
- this.useGrouping = getDefaultUseGrouping();
- }
-
- /**
- * Returns the default value for use grouping.
- *
- * @return the default use grouping
- */
- protected boolean getDefaultUseGrouping() {
- return true;
- }
-
- /**
- * Returns the default value for precision.
- *
- * @return the default precision
- */
- protected int getDefaultPrecision() {
- return 2;
- }
-
- /**
- * Returns the default value for format symbols.
- *
- * @return the default format symbols
- */
- protected DecimalFormatSymbols getDefaultFormatSymbols() {
- return new DecimalFormatSymbols();
- }
-
- /**
- * Returns the default value for default format.
- *
- * @return the default format
- */
- protected String getDefaultFormat() {
- return "##,##0.00";
- }
-
- /**
- * Sets the number format pattern that should be used to format the number.
- *
- * @param numberFormatPattern
- * the numberFormatPattern to set
- */
- protected void setNumberFormatPattern(String numberFormatPattern) {
- this.numberFormatPattern = numberFormatPattern;
- }
-
- /**
- * Sets the {@link DecimalFormatSymbols} that should be used by the
- * formatter.
- *
- * @param decimalFormatSymbols
- * the decimalFormatSymbols to set
- */
- public void setDecimalFormatSymbols(
- DecimalFormatSymbols decimalFormatSymbols) {
- this.decimalFormatSymbols = decimalFormatSymbols;
-
- if (decimalFormatSymbols != null) {
- customFormatSymbols = true;
- } else {
- customFormatSymbols = false;
- }
- }
-
- /**
- * Returns the currently used number format pattern.
- *
- * @return the number format pattern
- */
- public String getNumberFormatPattern() {
- return numberFormatPattern;
- }
-
- /**
- * Returns the currently used format symbols.
- *
- * @return the decimal format symbols
- */
- public DecimalFormatSymbols getDecimalFormatSymbols() {
- return decimalFormatSymbols;
- }
-
- /**
- * If true, then grouping should be used. False otherwise. Default is true.
- *
- * @return true, if is use grouping
- */
- public boolean isUseGrouping() {
- return useGrouping;
- }
-
- /**
- * If true, then grouping should be used. False otherwise. Default is true.
- *
- * @param useGrouping
- * the new use grouping
- */
- public void setUseGrouping(boolean useGrouping) {
- this.useGrouping = useGrouping;
- }
-
- /**
- * Returns the precision of that decimal field.
- *
- * @return the precision
- */
- public int getPrecision() {
- return precision;
- }
-
- /**
- * Sets the precision of that decimal field.
- *
- * @param precision
- * the new precision
- */
- public void setPrecision(int precision) {
- this.precision = precision;
-
- updateNumberFormat();
- }
-
- /**
- * Sets the number format pattern to be used for formatting.
- */
- protected void updateNumberFormat() {
- String format = "##,##0";
-
- if (precision > 0) {
- format = format.concat(".");
- }
- for (int i = 0; i < precision; i++) {
- format = format.concat("0");
- }
-
- setNumberFormatPattern(format);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.data.util.converter.AbstractStringToNumberConverter#getFormat
- * (java.util.Locale)
- */
- protected NumberFormat getFormat(Locale locale) {
- if (locale == null) {
- locale = Locale.getDefault();
- }
-
- NumberFormat result = null;
- if (numberFormatPattern != null && !numberFormatPattern.equals("")) {
- try {
- if (decimalFormatSymbols != null && customFormatSymbols) {
- result = new DecimalFormat(
- StringEscapeUtils.unescapeHtml(numberFormatPattern),
- decimalFormatSymbols);
- } else {
- result = new DecimalFormat(
- StringEscapeUtils.unescapeHtml(numberFormatPattern),
- DecimalFormatSymbols.getInstance(locale));
- }
- } catch (IllegalArgumentException e) {
- String msg = String.format(
- "formatter %s is invalid for decimal numbers: %s",
- numberFormatPattern, e.getLocalizedMessage());
- throw new ConversionException(msg);
- }
-
- if (integerInstance) {
- result.setParseIntegerOnly(true);
- result.setRoundingMode(RoundingMode.HALF_EVEN);
- }
- } else {
- if (integerInstance) {
- result = NumberFormat.getIntegerInstance(locale);
- } else {
- result = NumberFormat.getNumberInstance(locale);
- }
- }
-
- result.setGroupingUsed(useGrouping);
-
- return result;
- }
-
-}
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalToUomoConverter.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalToUomoConverter.java
index b5e095f..f3c094b 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalToUomoConverter.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/DecimalToUomoConverter.java
@@ -23,7 +23,7 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.eclipse.osbp.ecview.core.common.services.IServiceRegistry;
import org.eclipse.osbp.ecview.extension.model.converter.YDecimalToUomoConverter;
-import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalDoubleConverter;
//import org.eclipse.osbp.runtime.web.vaadin.components.converter.NumbericConverter;
@@ -31,7 +31,7 @@
* The Class DecimalToUomoConverter.
*/
@SuppressWarnings("serial")
-public class DecimalToUomoConverter extends DecimalConverter {
+public class DecimalToUomoConverter extends DecimalDoubleConverter {
// public class NumericToUomoConverter implements Converter<String, Number>
// {
diff --git a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/SimpleDecimalConverter.java b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/SimpleDecimalConverter.java
index 4316c85..fa08877 100644
--- a/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/SimpleDecimalConverter.java
+++ b/org.eclipse.osbp.ecview.extension.presentation.vaadin/src/org/eclipse/osbp/ecview/extension/presentation/vaadin/converter/SimpleDecimalConverter.java
@@ -25,7 +25,7 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.eclipse.osbp.ecview.core.common.services.IServiceRegistry;
import org.eclipse.osbp.ecview.extension.model.converter.YSimpleDecimalConverter;
-import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalDoubleConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@
* The Class SimpleDecimalConverter.
*/
@SuppressWarnings("serial")
-public class SimpleDecimalConverter extends DecimalConverter {
+public class SimpleDecimalConverter extends DecimalDoubleConverter {
private static final String CURRENCY_MASKED = "¤";