use of org.activityinfo.shared.dto.SiteDTO in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addTreeNameColumn.
public ColumnModelBuilder addTreeNameColumn() {
ColumnConfig name = new ColumnConfig("name", I18N.CONSTANTS.location(), 200);
name.setRenderer(new TreeGridCellRenderer<ModelData>() {
@Override
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
return super.render(model, propertyName(model), config, rowIndex, colIndex, store, grid);
}
private String propertyName(ModelData model) {
if (model instanceof SiteDTO) {
return "locationName";
} else {
return "name";
}
}
});
columns.add(name);
return this;
}
use of org.activityinfo.shared.dto.SiteDTO in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addActivityColumn.
public ColumnModelBuilder addActivityColumn(final UserDatabaseDTO database) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = database.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getName();
}
});
columns.add(config);
return this;
}
use of org.activityinfo.shared.dto.SiteDTO in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addDatabaseColumn.
public ColumnModelBuilder addDatabaseColumn(final SchemaDTO schema) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = schema.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getDatabase().getName();
}
});
columns.add(config);
return this;
}
use of org.activityinfo.shared.dto.SiteDTO in project activityinfo by bedatadriven.
the class SiteDialog method updateSite.
private void updateSite() {
final SiteDTO updated = new SiteDTO(site);
updateModel(updated);
dispatcher.execute(new UpdateSite(site, updated), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
showError(caught);
}
@Override
public void onSuccess(VoidResult result) {
hide();
callback.onSaved(updated);
}
});
}
use of org.activityinfo.shared.dto.SiteDTO in project activityinfo by bedatadriven.
the class SiteDialogLauncher method addNewSiteWithBoundLocation.
private void addNewSiteWithBoundLocation(ActivityDTO activity, SiteDialogCallback callback) {
SiteDTO newSite = new SiteDTO();
newSite.setActivityId(activity.getId());
LocationDTO location = new LocationDTO();
location.setId(new KeyGenerator().generateInt());
location.setLocationTypeId(activity.getLocationTypeId());
SiteDialog dialog = new SiteDialog(dispatcher, activity);
dialog.showNew(newSite, location, true, callback);
}
Aggregations