use of com.vaadin.ui.DescriptionGenerator in project SORMAS-Project by hzi-braunschweig.
the class CaseFollowUpGrid method setVisitColumns.
public void setVisitColumns(CaseCriteria criteria) {
Date referenceDate = criteria.getFollowUpVisitsTo();
int interval = criteria.getFollowUpVisitsInterval();
setDataProvider(referenceDate, interval - 1);
setCriteria(criteria);
dates.forEach(date -> removeColumn(DateFormatHelper.formatDate(date)));
setDates(referenceDate, interval);
for (int i = 0; i < interval; i++) {
String columnId = DateFormatHelper.formatDate(dates.get(i));
addComponentColumn(followUpDto -> new Label("")).setId(columnId);
final int index = i;
getColumn(columnId).setCaption(columnId).setSortable(false).setStyleGenerator((StyleGenerator<CaseFollowUpDto>) item -> {
final VisitResultDto visitResult = item.getVisitResults()[index];
final Date date = dates.get(index);
return getVisitResultCssStyle(visitResult, date, item.getReportDate(), item.getFollowUpUntil());
}).setDescriptionGenerator((DescriptionGenerator<CaseFollowUpDto>) item -> {
final VisitResultDto visitResult = item.getVisitResults()[index];
final Date date = dates.get(index);
return getVisitResultDescription(visitResult, date, item.getReportDate(), item.getFollowUpUntil());
});
}
}
use of com.vaadin.ui.DescriptionGenerator in project SORMAS-Project by hzi-braunschweig.
the class ContactFollowUpGrid method setVisitColumns.
public void setVisitColumns(ContactCriteria criteria) {
Date referenceDate = criteria.getFollowUpVisitsTo();
int interval = criteria.getFollowUpVisitsInterval();
setDataProvider(referenceDate, interval - 1);
setCriteria(criteria);
dates.forEach(date -> removeColumn(DateFormatHelper.formatDate(date)));
setDates(referenceDate, interval);
dateColumnIds.clear();
for (int i = 0; i < interval; i++) {
String columnId = DateFormatHelper.formatDate(dates.get(i));
dateColumnIds.add(columnId);
addComponentColumn(followUpDto -> new Label("")).setId(columnId);
final int index = i;
getColumn(columnId).setCaption(columnId).setSortable(false).setStyleGenerator((StyleGenerator<ContactFollowUpDto>) item -> {
final VisitResultDto visitResult = item.getVisitResults()[index];
final Date date = dates.get(index);
return getVisitResultCssStyle(visitResult, date, ContactLogic.getStartDate(item.getLastContactDate(), item.getReportDate()), item.getFollowUpUntil());
}).setDescriptionGenerator((DescriptionGenerator<ContactFollowUpDto>) item -> {
final VisitResultDto visitResult = item.getVisitResults()[index];
final Date date = dates.get(index);
return getVisitResultDescription(visitResult, date, ContactLogic.getStartDate(item.getLastContactDate(), item.getReportDate()), item.getFollowUpUntil());
});
}
}
use of com.vaadin.ui.DescriptionGenerator in project catma by forTEXT.
the class AnnotationDetailsPanel method initComponents.
private void initComponents() {
setSpacing(true);
setMargin(false);
setSizeFull();
addStyleName("annotation-details-panel");
HorizontalLayout headerPanel = new HorizontalLayout();
headerPanel.setWidth("100%");
addComponent(headerPanel);
btClearSelected = new IconButton(VaadinIcons.ERASER);
btClearSelected.setDescription("Clear the list of selected Annotations");
headerPanel.addComponent(btClearSelected);
headerPanel.setComponentAlignment(btClearSelected, Alignment.TOP_RIGHT);
headerPanel.setExpandRatio(btClearSelected, 1.0f);
btMinimize = new IconButton(VaadinIcons.ANGLE_DOUBLE_DOWN);
headerPanel.addComponent(btMinimize);
headerPanel.setComponentAlignment(btMinimize, Alignment.TOP_RIGHT);
annotationDetailData = new TreeData<>();
annotationDetailsProvider = new TreeDataProvider<>(annotationDetailData);
annotationDetailsTree = TreeGridFactory.createDefaultGrid(annotationDetailsProvider);
annotationDetailsTree.setSizeFull();
annotationDetailsTree.addStyleNames("annotation-details-panel-annotation-details-grid", "flat-undecorated-icon-buttonrenderer");
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDetail(), new HtmlRenderer()).setCaption("Annotation").setWidth(200).setSortable(false);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTag()).setCaption("Tag").setSortable(false).setWidth(80);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAuthor()).setCaption("Author").setSortable(false).setWidth(60);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getCollection()).setCaption("Collection").setSortable(false).setWidth(60);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getTagset()).setCaption("Tagset").setSortable(false).setWidth(70);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getAnnotationId()).setCaption("Annotation ID").setHidable(true).setHidden(true).setSortable(false).setWidth(100);
ButtonRenderer<AnnotationTreeItem> editAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleEditAnnotationRequest(clickEvent));
editAnnotationRenderer.setHtmlContentAllowed(true);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getEditIcon(), editAnnotationRenderer).setWidth(50);
ButtonRenderer<AnnotationTreeItem> deleteAnnotationRenderer = new ButtonRenderer<AnnotationTreeItem>(clickEvent -> handleDeleteAnnotationRequest(clickEvent));
deleteAnnotationRenderer.setHtmlContentAllowed(true);
annotationDetailsTree.addColumn(annotationTreeItem -> annotationTreeItem.getDeleteIcon(), deleteAnnotationRenderer).setExpandRatio(1);
annotationDetailsTree.setDescriptionGenerator(new DescriptionGenerator<AnnotationTreeItem>() {
@Override
public String apply(AnnotationTreeItem annotationTreeItem) {
return annotationTreeItem.getDescription();
}
}, ContentMode.HTML);
ActionGridComponent<TreeGrid<AnnotationTreeItem>> annotationDetailsGridComponent = new ActionGridComponent<>(new Label("Selected Annotations"), annotationDetailsTree);
annotationDetailsGridComponent.setMargin(false);
addComponent(annotationDetailsGridComponent);
setExpandRatio(annotationDetailsGridComponent, 1.0f);
}
Aggregations