1 package be
.nikiroo
.utils
.ui
;
3 import javax
.swing
.JComponent
;
4 import javax
.swing
.JTextField
;
6 import be
.nikiroo
.utils
.resources
.MetaInfo
;
8 class ConfigItemString
<E
extends Enum
<E
>> extends ConfigItem
<E
> {
9 private static final long serialVersionUID
= 1L;
12 * Create a new {@link ConfigItemString} for the given {@link MetaInfo}.
15 * the {@link MetaInfo}
17 public ConfigItemString(MetaInfo
<E
> info
) {
22 protected Object
getFromField(int item
) {
23 JTextField field
= (JTextField
) getField(item
);
25 return field
.getText();
32 protected Object
getFromInfo(int item
) {
33 return getInfo().getString(item
, false);
37 protected void setToField(Object value
, int item
) {
38 JTextField field
= (JTextField
) getField(item
);
40 field
.setText(value
== null ?
"" : value
.toString());
45 protected void setToInfo(Object value
, int item
) {
46 getInfo().setString((String
) value
, item
);
50 protected JComponent
createEmptyField(int item
) {
51 return new JTextField();