Examples of DoubleConverter


Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  public void testThousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals((double)3000, dc.convertToObject("3 000", Locale.FRENCH));

  }
View Full Code Here

Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  /**
   * Test double conversions.
   */
  public void testDoubleConversions()
  {
    DoubleConverter converter = new DoubleConverter();
    assertEquals("7.1", converter.convertToString(7.1, Locale.US));
    assertEquals("7,1", converter.convertToString(7.1, DUTCH_LOCALE));
    assertNull(converter.convertToObject("", Locale.US));
    assertEquals(1.1, converter.convertToObject("1.1", Locale.US));
    assertEquals("1.1", converter.convertToString(1.1, Locale.US));
    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
    }
    try
    {
      converter.convertToObject("1.1whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  public void testThousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals(new Double(3000), dc.convertToObject("3 000", Locale.FRENCH));

  }
View Full Code Here

Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  /**
   * Test double conversions.
   */
  public void testDoubleConversions()
  {
    DoubleConverter converter = new DoubleConverter();
    assertEquals(new Double(1.1), converter.convertToObject("1.1", Locale.US));
    assertEquals("1.1", converter.convertToString(new Double(1.1), Locale.US));
    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
    }
    try
    {
      converter.convertToObject("1.1whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  public void testThousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals((double)3000, dc.convertToObject("3 000", Locale.FRENCH));

  }
View Full Code Here

Examples of org.apache.wicket.util.convert.converter.DoubleConverter

  /**
   * Test double conversions.
   */
  public void testDoubleConversions()
  {
    DoubleConverter converter = new DoubleConverter();
    assertEquals(1.1, converter.convertToObject("1.1", Locale.US));
    assertEquals("1.1", converter.convertToString(1.1, Locale.US));
    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
    }
    try
    {
      converter.convertToObject("1.1whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

Examples of org.apache.wicket.util.convert.converters.DoubleConverter

                         * needed (currently limited to six digits to the
                         * right of the decimal point).
                         */
                        textField = new TextField("field", Double.class) {
                            public org.apache.wicket.util.convert.IConverter getConverter(Class type) {
                                DoubleConverter converter = (DoubleConverter) DoubleConverter.INSTANCE;
                                java.text.NumberFormat numberFormat = converter.getNumberFormat(getLocale());
                                java.text.DecimalFormat decimalFormat = (java.text.DecimalFormat)numberFormat;
                                decimalFormat.applyPattern("###,##0.######");
                                converter.setNumberFormat(getLocale(), decimalFormat);
                                return converter;
                            };
                        };
                    }
                   
View Full Code Here

Examples of org.codehaus.plexus.component.configurator.converters.basic.DoubleConverter

        registerDefaultConverter( new ByteConverter() );

        registerDefaultConverter( new CharConverter() );

        registerDefaultConverter( new DoubleConverter() );

        registerDefaultConverter( new FloatConverter() );

        registerDefaultConverter( new IntConverter() );
View Full Code Here

Examples of org.codehaus.plexus.component.configurator.converters.basic.DoubleConverter

        registerDefaultConverter( new ByteConverter() );

        registerDefaultConverter( new CharConverter() );

        registerDefaultConverter( new DoubleConverter() );

        registerDefaultConverter( new FloatConverter() );

        registerDefaultConverter( new IntConverter() );
View Full Code Here

Examples of org.dmrad.view.util.type.DoubleConverter

      } else if (propertyClass == Double.class) {
        textField = new TextField("propertyValue", new PropertyModel(
            entity, propertyCode, propertyClass)) {
          static final long serialVersionUID = 200914L;
          public IConverter getConverter() {
            return new DoubleConverter();
          }
        };
        textField.setType(Double.class);
      } else if (propertyClass == Date.class) {
        textField = new TextField("propertyValue", new PropertyModel(
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.