use of org.activityinfo.legacy.shared.model.CountryDTO in project activityinfo by bedatadriven.
the class NewDbDetailsPage method loadCountries.
private void loadCountries() {
loadCountries.setEnabled(false);
countryField.setShowValidationMessage(false);
dispatcher.execute(new GetCountries(), new AsyncCallback<CountryResult>() {
@Override
public void onFailure(Throwable caught) {
loadCountries.setEnabled(true);
countryField.showValidationMessage(I18N.CONSTANTS.failedToLoadCountries());
loadCountries.setVisible(true);
}
@Override
public void onSuccess(CountryResult result) {
loadCountries.setVisible(false);
for (CountryDTO countryDTO : result.getData()) {
country.addItem(countryDTO.getName(), Integer.toString(countryDTO.getId()));
}
country.update();
}
});
}
use of org.activityinfo.legacy.shared.model.CountryDTO in project activityinfo by bedatadriven.
the class GetCountriesHandler method mapToDtos.
private ArrayList<CountryDTO> mapToDtos(List<Country> countries) {
ArrayList<CountryDTO> dtos = new ArrayList<CountryDTO>();
for (Country country : countries) {
CountryDTO dto = new CountryDTO();
dto.setId(country.getId());
dto.setName(country.getName());
dto.setCodeISO(country.getCodeISO());
dtos.add(dto);
}
return dtos;
}
use of org.activityinfo.legacy.shared.model.CountryDTO in project activityinfo by bedatadriven.
the class DbListPresenterTest method commandShouldBePreparedProperly.
@Test
public void commandShouldBePreparedProperly() {
Capture<CreateEntity> cmd = new Capture<CreateEntity>();
expectDispatch(new GetSchema(), schema);
captureDispatch(cmd);
replay(dispatcher);
UserDatabaseDTO newDb = new UserDatabaseDTO();
newDb.setCountry(new CountryDTO(31, "Haiti"));
newDb.setName("My Db");
createPresenter();
presenter.save(newDb, niceFormDialogMock());
assertTrue("command was dispatched", cmd.hasCaptured());
assertThat((Integer) cmd.getValue().getProperties().get("countryId"), is(equalTo(31)));
}
Aggregations