use of org.activityinfo.ui.client.page.common.columns.TimePeriodColumn in project activityinfo by bedatadriven.
the class DbTargetGrid method createColumnModel.
protected ColumnModel createColumnModel() {
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig projectColumn = new ColumnConfig("projectId", messages.project(), 150);
projectColumn.setRenderer(new GridCellRenderer() {
@Override
public SafeHtml render(ModelData modelData, String s, ColumnData columnData, int i, int i1, ListStore listStore, Grid grid) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Integer id = modelData.get(s);
if (id != null) {
ProjectDTO project = db.getProjectById(id);
if (project != null) {
sb.appendEscaped(project.getName());
}
}
return sb.toSafeHtml();
}
});
ColumnConfig partnerColumn = new ColumnConfig("partnerId", messages.partner(), 150);
partnerColumn.setRenderer(new GridCellRenderer() {
@Override
public SafeHtml render(ModelData modelData, String s, ColumnData columnData, int i, int i1, ListStore listStore, Grid grid) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
Integer id = modelData.get(s);
if (id != null) {
PartnerDTO partner = db.getPartnerById(id);
if (partner != null) {
sb.appendEscaped(partner.getName());
}
}
return sb.toSafeHtml();
}
});
columns.add(new ColumnConfig("name", messages.name(), 150));
columns.add(projectColumn);
columns.add(partnerColumn);
columns.add(new TimePeriodColumn("timePeriod", messages.timePeriod(), 300));
return new ColumnModel(columns);
}
Aggregations