org.broadleafcommerce.openadmin.client.view.dynamic.form
Class NumericTypeFactory

java.lang.Object
  extended by org.broadleafcommerce.openadmin.client.view.dynamic.form.NumericTypeFactory

public final class NumericTypeFactory
extends Object

While it is fairly easy to display numeric and currency formats in SmartGWT (SimpleType has setShort/NormalDisplayFormatter()), I haven't been able to provide full locale format support including editing. Although FormItem class has setEditorValueFormatter() and setEditorValueParser() methods, and SimpleType class has setEditorType(FormItem editorType) method, that way goes nowhere because simpleType.setEditorType(editorType) fires exception - something is broken or not yet done here. Desperately seeking a workaround I finally wrote the following code putting together info I got from SmartGWT and SmartClient forums and other sources. This helper creates and registers custom numeric SimpleType based on GWT i18n NumericFormat. Such a SimpleType could be then used just as build-in types.

Author:
michalg, Jeff Fischer

Method Summary
static void registerNumericSimpleType(String name, com.google.gwt.i18n.client.NumberFormat format, SupportedFieldType supportedFieldType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerNumericSimpleType

public static void registerNumericSimpleType(String name,
                                             com.google.gwt.i18n.client.NumberFormat format,
                                             SupportedFieldType supportedFieldType)


Copyright © 2013. All Rights Reserved.