Example usage for com.vaadin.v7.ui AbstractSelect setValue

List of usage examples for com.vaadin.v7.ui AbstractSelect setValue

Introduction

In this page you can find the example usage for com.vaadin.v7.ui AbstractSelect setValue.

Prototype

@Override
public void setValue(Object newValue) throws Property.ReadOnlyException 

Source Link

Document

Sets the visible value of the property.

Usage

From source file:de.symeda.sormas.ui.person.PersonEditForm.java

License:Open Source License

private void updateApproximateAge() {

    Date birthDate = calcBirthDateValue();

    if (birthDate != null) {
        Pair<Integer, ApproximateAgeType> pair = ApproximateAgeHelper.getApproximateAge(birthDate,
                (Date) getFieldGroup().getField(PersonDto.DEATH_DATE).getValue());

        TextField approximateAgeField = (TextField) getFieldGroup().getField(PersonDto.APPROXIMATE_AGE);
        approximateAgeField.setReadOnly(false);
        approximateAgeField.setValue(pair.getElement0() != null ? String.valueOf(pair.getElement0()) : null);
        approximateAgeField.setReadOnly(true);

        AbstractSelect approximateAgeTypeSelect = (AbstractSelect) getFieldGroup()
                .getField(PersonDto.APPROXIMATE_AGE_TYPE);
        approximateAgeTypeSelect.setReadOnly(false);
        approximateAgeTypeSelect.setValue(pair.getElement1());
        approximateAgeTypeSelect.setReadOnly(true);
    }/*from  ww w .  j  ava  2s. c  o m*/
}

From source file:de.symeda.sormas.ui.person.PersonEditForm.java

License:Open Source License

private void fillDeathAndBurialFields(AbstractSelect deathPlaceType, TextField deathPlaceDesc,
        TextField burialPlaceDesc) {
    if (deathPlaceType.isVisible() && deathPlaceType.getValue() == null) {
        deathPlaceType.setValue(DeathPlaceType.OTHER);
        if (deathPlaceDesc.isVisible()
                && (deathPlaceDesc.getValue() == null || deathPlaceDesc.getValue().isEmpty())) {
            deathPlaceDesc.setValue(getValue().getAddress().toString());
        }//w  w w.  java 2  s  .  co m
    }

    if (burialPlaceDesc.isVisible()
            && (burialPlaceDesc.getValue() == null || deathPlaceDesc.getValue().isEmpty())) {
        burialPlaceDesc.setValue(getValue().getAddress().toString());
    }
}

From source file:de.symeda.sormas.ui.utils.FieldHelper.java

License:Open Source License

public static void updateItems(AbstractSelect select, List<?> items) {
    Object value = select.getValue();
    boolean readOnly = select.isReadOnly();
    select.setReadOnly(false);//w w w  .  j a v  a 2  s.  com
    select.removeAllItems();
    if (items != null) {
        select.addItems(items);
    }
    select.setValue(value);
    select.setReadOnly(readOnly);
}