use of com.haulmont.cuba.gui.components.OptionsList in project cuba by cuba-platform.
the class OptionsListDsTest method testUnsubscribeSubscribeDsListener.
@Test
public void testUnsubscribeSubscribeDsListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.DENYING);
optionsList.setDatasource(roleDs, "type");
optionsList.setDatasource(null, null);
boolean[] valueWasChanged = { false };
Datasource.ItemPropertyChangeListener<Role> listener = e -> valueWasChanged[0] = true;
roleDs.addItemPropertyChangeListener(listener);
optionsList.setDatasource(roleDs, "type");
optionsList.setValue(RoleType.STANDARD);
assertTrue(valueWasChanged[0]);
}
Aggregations