Project

General

Profile

Revision d6244300

IDd6244300ebaa16d3f70127d8ce96e7244316075b
Parent 5420c5f6
Child 62b8daac

Added by Andreas Kohlbecker over 3 years ago

ref #6169 ReferenceEditor correctly updating view and internal data

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/TimePeriodField.java
12 12
import java.util.Set;
13 13

  
14 14
import com.vaadin.data.fieldgroup.BeanFieldGroup;
15
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
15 16
import com.vaadin.data.util.BeanItem;
16 17
import com.vaadin.event.FieldEvents.TextChangeEvent;
17 18
import com.vaadin.server.FontAwesome;
......
131 132
        parseField.setWidth(100, Unit.PERCENTAGE);
132 133

  
133 134
        Button closeDetailsButton = new Button(FontAwesome.CLOSE);
134
        closeDetailsButton.addClickListener(e -> showSimple());
135
        closeDetailsButton.addClickListener(e -> {
136
            try {
137
                fieldGroup.commit();
138
            } catch (CommitException e1) {
139
                // TODO Auto-generated catch block
140
                e1.printStackTrace();
141
            }
142
            updateCacheField();
143
            showSimple();
144
        });
135 145

  
136 146
        buttonTextField.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
137 147
        buttonTextField.setWidth(100, Unit.PERCENTAGE);
......
215 225
        super.setInternalValue(newValue);
216 226
        fieldGroup.setItemDataSource(new BeanItem<TimePeriod>(newValue));
217 227

  
228
        updateCacheField();
229
    }
230

  
231
    /**
232
     * @param newValue
233
     */
234
    private void updateCacheField() {
235
        TimePeriod newValue = fieldGroup.getItemDataSource().getBean();
218 236
        cacheField.setReadOnly(false);
219 237
        cacheField.setValue(timePeriodFormatter.print(newValue));
220 238
        cacheField.setReadOnly(true);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)