Revision 2524 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/pickercontroller/nullablespinner/NullableNumberEditor.java
NullableNumberEditor.java | ||
---|---|---|
30 | 30 |
return nf.toPattern(); |
31 | 31 |
} |
32 | 32 |
|
33 |
public NullableNumberEditor(JSpinner spinner) { |
|
34 |
this(spinner, getDefaultPattern(spinner.getLocale())); |
|
33 |
public NullableNumberEditor(JSpinner spinner, Class valueClass) {
|
|
34 |
this(spinner, getDefaultPattern(spinner.getLocale()),valueClass);
|
|
35 | 35 |
} |
36 | 36 |
|
37 |
public NullableNumberEditor(JSpinner spinner, String decimalFormatPattern) { |
|
38 |
this(spinner, new DecimalFormat(decimalFormatPattern)); |
|
37 |
public NullableNumberEditor(JSpinner spinner, String decimalFormatPattern, Class valueClass) {
|
|
38 |
this(spinner, new DecimalFormat(decimalFormatPattern), valueClass);
|
|
39 | 39 |
} |
40 | 40 |
|
41 |
private NullableNumberEditor(JSpinner spinner, DecimalFormat format) { |
|
41 |
private NullableNumberEditor(JSpinner spinner, DecimalFormat format, Class valueClass) {
|
|
42 | 42 |
super(spinner); |
43 | 43 |
if (!(spinner.getModel() instanceof NullableSpinnerNumberModel)) { |
44 | 44 |
throw new IllegalArgumentException( |
... | ... | |
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
NullableSpinnerNumberModel model = (NullableSpinnerNumberModel) spinner.getModel(); |
49 |
NumberFormatter formatter = new NullableNumberEditorFormatter(model,format, this.getTextField()); |
|
49 |
NumberFormatter formatter = new NullableNumberEditorFormatter(model,format, this.getTextField(), valueClass);
|
|
50 | 50 |
DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); |
51 | 51 |
JFormattedTextField ftf = getTextField(); |
52 | 52 |
ftf.setEditable(true); |
Also available in: Unified diff