Revision 477 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.serv/org.gvsig.tools.swing.serv.field/src/main/java/org/gvsig/tools/swing/serv/field/component/JNumberDynFieldComponent.java
JNumberDynFieldComponent.java | ||
---|---|---|
31 | 31 |
import javax.swing.ImageIcon; |
32 | 32 |
import javax.swing.JComponent; |
33 | 33 |
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
37 | 34 |
import org.gvsig.tools.dynobject.DynObject; |
38 |
import org.gvsig.tools.dynobject.exception.DynFieldValidateException; |
|
39 | 35 |
import org.gvsig.tools.service.ServiceException; |
40 | 36 |
import org.gvsig.tools.swing.api.dynobject.ValueChangedListener; |
41 | 37 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent; |
... | ... | |
52 | 48 |
|
53 | 49 |
private static final long serialVersionUID = -8120715001446683582L; |
54 | 50 |
|
55 |
private final static Logger LOG = LoggerFactory |
|
56 |
.getLogger(JNumberDynFieldComponent.class); |
|
57 |
|
|
58 | 51 |
private static Object NULL_VALUE = null; |
59 |
private static final String BTN_EMPTY_IMG_PATH = "editdelete.png";
|
|
52 |
private static final String BTN_EMPTY_IMG_PATH = "editdelete.png";
|
|
60 | 53 |
|
61 | 54 |
private JNullValueMuttableTextField pane; |
62 | 55 |
|
... | ... | |
65 | 58 |
* @throws ServiceException |
66 | 59 |
* @see JDynFieldComponent#JDynFieldComponent(DynField, DynObject). |
67 | 60 |
*/ |
68 |
public JNumberDynFieldComponent(ValueField parent) throws ServiceException { |
|
69 |
super(parent); |
|
61 |
public JNumberDynFieldComponent(ValueField parent) |
|
62 |
throws ServiceException { |
|
63 |
super(parent); |
|
70 | 64 |
} |
71 | 65 |
|
72 | 66 |
/* |
... | ... | |
89 | 83 |
} |
90 | 84 |
|
91 | 85 |
protected ImageIcon getBtnEmptyImageIcon() { |
92 |
return new ImageIcon(this.getClass().getResource(BTN_EMPTY_IMG_PATH));
|
|
86 |
return new ImageIcon(this.getClass().getResource(BTN_EMPTY_IMG_PATH));
|
|
93 | 87 |
} |
94 | 88 |
|
95 | 89 |
private JNullValueMuttableTextField getModel() { |
... | ... | |
127 | 121 |
@Override |
128 | 122 |
protected void initUI() { |
129 | 123 |
this.pane = |
130 |
new JNullValueMuttableTextField(this.getDynField(), |
|
131 |
this.getInitialValue(), Locale.getDefault(), |
|
132 |
getBtnEmptyImageIcon()); |
|
124 |
new JNullValueMuttableTextField(this.getDynField(), this |
|
125 |
.getInitialValue(), Locale.getDefault(), getBtnEmptyImageIcon()); |
|
133 | 126 |
this.pane.addValueChangedListener(this); |
134 | 127 |
} |
135 | 128 |
|
... | ... | |
161 | 154 |
@Override |
162 | 155 |
public void saveStatus() { |
163 | 156 |
if (getModel() != null) { |
164 |
try { |
|
165 |
this.setFieldValue(getModel().getValue()); |
|
166 |
} catch (DynFieldValidateException e) { |
|
167 |
// LOG.warn("Value validation error: " |
|
168 |
// + this.getDynField().getName(), getModel().getValue()); |
|
169 |
} |
|
157 |
this.setFieldValue(getModel().getValue()); |
|
170 | 158 |
} |
171 | 159 |
} |
172 | 160 |
|
Also available in: Unified diff