use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class CasePreviewGrid method buildGrid.
private void buildGrid() {
setSizeFull();
setSelectionMode(SelectionMode.SINGLE);
setHeightMode(HeightMode.ROW);
Language userLanguage = I18nProperties.getUserLanguage();
removeColumn(SormasToSormasCasePreview.DISEASE);
addComponentColumn(casePreview -> {
String diseaseText = casePreview.getDisease().toString();
if (!StringUtils.isEmpty(casePreview.getDiseaseDetails())) {
diseaseText += " - " + casePreview.getDiseaseDetails();
}
if (casePreview.getDiseaseVariant() != null) {
diseaseText += diseaseText + " - " + casePreview.getDiseaseVariant().getCaption();
}
return new Label(diseaseText);
}).setId(SormasToSormasCasePreview.DISEASE);
removeColumn(SormasToSormasCasePreview.HEALTH_FACILITY);
addComponentColumn(casePreview -> {
FacilityReferenceDto healthFacility = casePreview.getHealthFacility();
if (healthFacility == null) {
return null;
}
return new Label(FacilityHelper.buildFacilityString(healthFacility.getUuid(), healthFacility.getCaption(), casePreview.getHealthFacilityDetails()));
}).setId(SormasToSormasCasePreview.HEALTH_FACILITY);
removeColumn(SormasToSormasCasePreview.POINT_OF_ENTRY);
addComponentColumn(casePreview -> {
PointOfEntryReferenceDto pointOfEntry = casePreview.getPointOfEntry();
if (pointOfEntry == null) {
return null;
}
return new Label(InfrastructureHelper.buildPointOfEntryString(pointOfEntry.getUuid(), pointOfEntry.getCaption(), casePreview.getPointOfEntryDetails()));
}).setId(SormasToSormasCasePreview.POINT_OF_ENTRY);
List<String> columnConfig = new ArrayList<>();
columnConfig.addAll(Arrays.asList(SormasToSormasCasePreview.UUID, SormasToSormasCasePreview.REPORT_DATE, SormasToSormasCasePreview.DISEASE, SormasToSormasCasePreview.CASE_CLASSIFICATION, SormasToSormasCasePreview.INVESTIGATION_STATUS, SormasToSormasCasePreview.OUTCOME));
columnConfig.addAll(PreviewGridHelper.createPersonColumns(this, SormasToSormasCasePreview::getPerson));
columnConfig.addAll(Arrays.asList(SormasToSormasCasePreview.REGION, SormasToSormasCasePreview.DISTRICT, SormasToSormasCasePreview.COMMUNITY, SormasToSormasCasePreview.HEALTH_FACILITY, SormasToSormasCasePreview.POINT_OF_ENTRY, SormasToSormasCasePreview.ONSET_DATE));
setColumns(columnConfig);
((Column<SormasToSormasCasePreview, String>) getColumn(SormasToSormasContactPreview.UUID)).setRenderer(new UuidRenderer());
((Column<SormasToSormasCasePreview, Date>) getColumn(SormasToSormasCasePreview.REPORT_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<SormasToSormasCasePreview, Date>) getColumn(SormasToSormasCasePreview.ONSET_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaption(column.getId(), SormasToSormasCasePreview.I18N_PREFIX, SormasToSormasPersonPreview.I18N_PREFIX));
}
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class CampaignDataGrid method addDefaultColumns.
protected void addDefaultColumns() {
addEditColumn(e -> {
ControllerProvider.getCampaignController().navigateToFormDataView(e.getUuid());
});
setColumns(EDIT_BTN_ID, CampaignFormDataIndexDto.CAMPAIGN, CampaignFormDataIndexDto.FORM, CampaignFormDataIndexDto.REGION, CampaignFormDataIndexDto.DISTRICT, CampaignFormDataIndexDto.COMMUNITY, CampaignFormDataIndexDto.FORM_DATE);
getColumn(EDIT_BTN_ID).setWidth(40).setStyleGenerator(item -> CssStyles.GRID_CELL_LINK);
((Column<CampaignFormDataIndexDto, Date>) getColumn(CampaignFormDataIndexDto.FORM_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateFormat(I18nProperties.getUserLanguage())));
for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.getPrefixCaption(CampaignFormDataIndexDto.I18N_PREFIX, column.getId(), column.getCaption()));
}
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class EventSelectionGrid method buildGrid.
private void buildGrid() {
setSizeFull();
setSelectionMode(SelectionMode.SINGLE);
setHeightMode(HeightMode.ROW);
Language userLanguage = I18nProperties.getUserLanguage();
setColumns(EventIndexDto.EVENT_LOCATION, EventIndexDto.EVENT_TITLE, EventGrid.createEventDateColumn(this), EventIndexDto.EVENT_STATUS, EventIndexDto.REPORT_DATE_TIME);
for (Column<EventIndexDto, ?> column : getColumns()) {
column.setCaption(I18nProperties.getPrefixCaption(EventIndexDto.I18N_PREFIX, column.getId(), column.getCaption()));
column.setStyleGenerator(FieldAccessColumnStyleGenerator.forSensitiveData(EventIndexDto.class, column.getId()));
}
getColumn(EventIndexDto.EVENT_TITLE).setMaximumWidth(300);
((Column<EventIndexDto, Date>) getColumn(EventIndexDto.REPORT_DATE_TIME)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
}
use of com.vaadin.ui.renderers.DateRenderer in project cuba by cuba-platform.
the class WebDateRenderer method createImplementation.
@Override
protected DateRenderer createImplementation() {
if (dateFormat == null) {
checkNotNullArgument(formatString, "Format string may not be null");
checkNotNullArgument(locale, "Locale may not be null");
dateFormat = new SimpleDateFormat(formatString, locale);
}
return new DateRenderer(dateFormat, getNullRepresentation());
}
use of com.vaadin.ui.renderers.DateRenderer in project jmix by jmix-framework.
the class DateRendererImpl method createImplementation.
@Override
protected DateRenderer createImplementation() {
if (dateFormat == null) {
checkNotNullArgument(formatString, "Format string may not be null");
checkNotNullArgument(locale, "Locale may not be null");
dateFormat = new SimpleDateFormat(formatString, locale);
}
return new DateRenderer(dateFormat, getNullRepresentation());
}
Aggregations