Project

General

Profile

« Previous | Next » 

Revision 07a39ef5

Added by Andreas Kohlbecker almost 6 years ago

fix #7382 disabling save button and showing message when type designations are missing

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java
49 49
public class SpecimenTypeDesignationWorkingsetPopupEditor
50 50
    extends AbstractPopupEditor<SpecimenTypeDesignationWorkingSetDTO, SpecimenTypeDesignationWorkingsetEditorPresenter>
51 51
    implements SpecimenTypeDesignationWorkingsetPopupEditorView, AccessRestrictedView, PerEntityAuthorityGrantingEditor {
52
    /**
53
     *
54
     */
55
    private static final String CAN_T_SAVE_AS_LONG_AS_TYPE_DESIGNATIONS_ARE_MISSING = "Can't save as long as type designations are missing.";
56

  
52 57
    /**
53 58
     * @param layout
54 59
     * @param dtoType
......
182 187
        typeDesignationsCollectionField.setPropertyHeader("preferredStableUri", "Stable URI");
183 188
        typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReference", "Image reference");
184 189
        typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReferenceDetail", "Reference detail");
190
        typeDesignationsCollectionField.addElementAddedListener( e -> updateAllowSave());
191
        typeDesignationsCollectionField.addElementRemovedListener( e -> updateAllowSave());
185 192

  
186 193
        // typeDesignationsCollectionField.getLayout().setMargin(false);
187 194
        // typeDesignationsCollectionField.addStyleName("composite-field-wrapper");
......
280 287
            ((CollectionRowRepresentative)item).updateRowItemsEnabledStates();
281 288
        }
282 289
        updateAllowDelete();
290
        updateAllowSave();
283 291
    }
284 292

  
285 293
    /**
......
296 304
        }
297 305
    }
298 306

  
307
    public void updateAllowSave(){
308
        boolean hasTypeDesignations = getBean().getSpecimenTypeDesignationDTOs().size() > 0;
309
        setSaveButtonEnabled(hasTypeDesignations);
310
        if(!hasTypeDesignations){
311
            addStatusMessage(CAN_T_SAVE_AS_LONG_AS_TYPE_DESIGNATIONS_ARE_MISSING);
312
        } else {
313
            removeStatusMessage(CAN_T_SAVE_AS_LONG_AS_TYPE_DESIGNATIONS_ARE_MISSING);
314
        }
315

  
316
    }
317

  
299 318
    /**
300 319
     * {@inheritDoc}
301 320
     */

Also available in: Unified diff