use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class LocationEditForm method createGeoButton.
private HorizontalLayout createGeoButton() {
HorizontalLayout geoButtonLayout = new HorizontalLayout();
geoButtonLayout.setMargin(false);
geoButtonLayout.setSpacing(false);
Button geocodeButton = ButtonHelper.createIconButtonWithCaption("geocodeButton", null, VaadinIcons.MAP_MARKER, e -> {
triggerGeocoding();
e.getButton().removeStyleName(CssStyles.GEOCODE_BUTTON_HIGHLIGHT);
}, ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_BORDERLESS, ValoTheme.BUTTON_LARGE);
Field[] locationGeoFields = Stream.of(LocationDto.STREET, LocationDto.POSTAL_CODE, LocationDto.CITY, LocationDto.HOUSE_NUMBER).map(field -> (Field) getField(field)).toArray(Field[]::new);
// Highlight geocode-button when the address changes
Stream.of(locationGeoFields).forEach(field -> field.addValueChangeListener(e -> {
if (isAllFieldsEmpty(locationGeoFields)) {
geocodeButton.removeStyleName(CssStyles.GEOCODE_BUTTON_HIGHLIGHT);
} else if (field.isModified()) {
geocodeButton.addStyleName(CssStyles.GEOCODE_BUTTON_HIGHLIGHT);
}
}));
geoButtonLayout.addComponent(geocodeButton);
geoButtonLayout.setComponentAlignment(geocodeButton, Alignment.BOTTOM_RIGHT);
leafletMapPopup = new MapPopupView();
leafletMapPopup.setCaption(" ");
leafletMapPopup.setEnabled(false);
leafletMapPopup.setStyleName(ValoTheme.BUTTON_LARGE);
leafletMapPopup.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
geoButtonLayout.addComponent(leafletMapPopup);
geoButtonLayout.setComponentAlignment(leafletMapPopup, Alignment.BOTTOM_RIGHT);
return geoButtonLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class SampleGridComponent method createShipmentFilterBar.
public HorizontalLayout createShipmentFilterBar() {
HorizontalLayout shipmentFilterLayout = new HorizontalLayout();
shipmentFilterLayout.setMargin(false);
shipmentFilterLayout.setSpacing(true);
shipmentFilterLayout.setWidth(100, Unit.PERCENTAGE);
shipmentFilterLayout.addStyleName(CssStyles.VSPACE_3);
statusButtons = new HashMap<>();
HorizontalLayout buttonFilterLayout = new HorizontalLayout();
buttonFilterLayout.setSpacing(true);
{
Button statusAll = ButtonHelper.createButton(Captions.all, e -> processStatusChange(null), ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
statusAll.setCaptionAsHtml(true);
buttonFilterLayout.addComponent(statusAll);
statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
activeStatusButton = statusAll;
createAndAddStatusButton(Captions.sampleNotShipped, NOT_SHIPPED, buttonFilterLayout);
createAndAddStatusButton(Captions.sampleShipped, SHIPPED, buttonFilterLayout);
createAndAddStatusButton(Captions.sampleReceived, RECEIVED, buttonFilterLayout);
createAndAddStatusButton(Captions.sampleReferred, REFERRED, buttonFilterLayout);
}
shipmentFilterLayout.addComponent(buttonFilterLayout);
HorizontalLayout actionButtonsLayout = new HorizontalLayout();
actionButtonsLayout.setSpacing(true);
{
// Show active/archived/all dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW)) {
relevanceStatusFilter = ComboBoxHelper.createComboBoxV7();
relevanceStatusFilter.setId("relevanceStatusFilter");
relevanceStatusFilter.setWidth(140, Unit.PERCENTAGE);
relevanceStatusFilter.setNullSelectionAllowed(false);
relevanceStatusFilter.addItems((Object[]) EntityRelevanceStatus.values());
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ACTIVE, I18nProperties.getCaption(Captions.sampleActiveSamples));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ARCHIVED, I18nProperties.getCaption(Captions.sampleArchivedSamples));
relevanceStatusFilter.setItemCaption(EntityRelevanceStatus.ALL, I18nProperties.getCaption(Captions.sampleAllSamples));
relevanceStatusFilter.addValueChangeListener(e -> {
criteria.relevanceStatus((EntityRelevanceStatus) e.getProperty().getValue());
samplesView.navigateTo(criteria);
});
actionButtonsLayout.addComponent(relevanceStatusFilter);
}
// Bulk operation dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS_CASE_SAMPLES)) {
shipmentFilterLayout.setWidth(100, Unit.PERCENTAGE);
bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
ControllerProvider.getSampleController().deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), new Runnable() {
public void run() {
samplesView.navigateTo(criteria);
}
});
}));
bulkOperationsDropdown.setVisible(samplesView.getViewConfiguration().isInEagerMode());
actionButtonsLayout.addComponent(bulkOperationsDropdown);
}
sampleTypeFilter = ComboBoxHelper.createComboBoxV7();
sampleTypeFilter.setWidth(140, Unit.PERCENTAGE);
sampleTypeFilter.setId("sampleTypeFilter");
sampleTypeFilter.setNullSelectionAllowed(false);
sampleTypeFilter.addItems((Object[]) SampleAssociationType.values());
sampleTypeFilter.setItemCaption(SampleAssociationType.ALL, I18nProperties.getEnumCaption(SampleAssociationType.ALL));
sampleTypeFilter.setItemCaption(SampleAssociationType.CASE, I18nProperties.getEnumCaption(SampleAssociationType.CASE));
sampleTypeFilter.setItemCaption(SampleAssociationType.CONTACT, I18nProperties.getEnumCaption(SampleAssociationType.CONTACT));
sampleTypeFilter.setItemCaption(SampleAssociationType.EVENT_PARTICIPANT, I18nProperties.getEnumCaption(SampleAssociationType.EVENT_PARTICIPANT));
sampleTypeFilter.addValueChangeListener(e -> {
criteria.sampleAssociationType(((SampleAssociationType) e.getProperty().getValue()));
samplesView.navigateTo(criteria);
});
actionButtonsLayout.addComponent(sampleTypeFilter);
}
shipmentFilterLayout.addComponent(actionButtonsLayout);
shipmentFilterLayout.setComponentAlignment(actionButtonsLayout, Alignment.TOP_RIGHT);
shipmentFilterLayout.setExpandRatio(actionButtonsLayout, 1);
return shipmentFilterLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class SampleGridFilterForm method applyDependenciesOnNewValue.
@Override
protected void applyDependenciesOnNewValue(SampleCriteria criteria) {
UserDto user = currentUserDto();
ComboBox districtField = (ComboBox) getField(SampleCriteria.DISTRICT);
if (user.getRegion() != null) {
districtField.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(user.getRegion().getUuid()));
districtField.setEnabled(true);
} else {
RegionReferenceDto region = criteria.getRegion();
if (region != null) {
districtField.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()));
districtField.setEnabled(true);
} else {
districtField.setEnabled(false);
}
}
HorizontalLayout dateFilterLayout = (HorizontalLayout) getMoreFiltersContainer().getComponent(WEEK_AND_DATE_FILTER);
EpiWeekAndDateFilterComponent<DateFilterOption> weekAndDateFilter;
weekAndDateFilter = (EpiWeekAndDateFilterComponent<DateFilterOption>) dateFilterLayout.getComponent(0);
weekAndDateFilter.getDateFilterOptionFilter().setValue(criteria.getDateFilterOption());
Date sampleDateFrom = criteria.getSampleReportDateFrom();
Date sampleDateTo = criteria.getSampleReportDateTo();
if (DateFilterOption.EPI_WEEK.equals(criteria.getDateFilterOption())) {
weekAndDateFilter.getWeekFromFilter().setValue(sampleDateFrom == null ? null : DateHelper.getEpiWeek(sampleDateFrom));
weekAndDateFilter.getWeekToFilter().setValue(sampleDateTo == null ? null : DateHelper.getEpiWeek(sampleDateTo));
} else {
weekAndDateFilter.getDateFromFilter().setValue(sampleDateFrom);
weekAndDateFilter.getDateToFilter().setValue(sampleDateTo);
}
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class AbstractEpiCurveComponent method createFooter.
private HorizontalLayout createFooter() {
HorizontalLayout epiCurveFooterLayout = new HorizontalLayout();
epiCurveFooterLayout.setWidth(100, Unit.PERCENTAGE);
epiCurveFooterLayout.setSpacing(true);
CssStyles.style(epiCurveFooterLayout, CssStyles.VSPACE_4);
// Grouping
VerticalLayout groupingLayout = new VerticalLayout();
{
groupingLayout.setMargin(true);
groupingLayout.setSizeUndefined();
// Grouping option group
OptionGroup groupingSelect = new OptionGroup();
groupingSelect.setWidth(100, Unit.PERCENTAGE);
groupingSelect.addItems((Object[]) EpiCurveGrouping.values());
groupingSelect.setValue(epiCurveGrouping);
groupingSelect.addValueChangeListener(e -> {
epiCurveGrouping = (EpiCurveGrouping) e.getProperty().getValue();
clearAndFillEpiCurveChart();
});
groupingLayout.addComponent(groupingSelect);
// "Always show at least 7 entries" checkbox
CheckBox minimumEntriesCheckbox = new CheckBox(I18nProperties.getCaption(Captions.dashboardShowMinimumEntries));
CssStyles.style(minimumEntriesCheckbox, CssStyles.VSPACE_NONE);
minimumEntriesCheckbox.setValue(showMinimumEntries);
minimumEntriesCheckbox.addValueChangeListener(e -> {
showMinimumEntries = (boolean) e.getProperty().getValue();
clearAndFillEpiCurveChart();
});
groupingLayout.addComponent(minimumEntriesCheckbox);
}
PopupButton groupingDropdown = ButtonHelper.createPopupButton(Captions.dashboardGrouping, groupingLayout, CssStyles.BUTTON_SUBTLE);
epiCurveFooterLayout.addComponent(groupingDropdown);
epiCurveFooterLayout.setComponentAlignment(groupingDropdown, Alignment.MIDDLE_RIGHT);
epiCurveFooterLayout.setExpandRatio(groupingDropdown, 1);
// Epi curve mode
AbstractComponent epiCurveModeSelector = createEpiCurveModeSelector();
epiCurveFooterLayout.addComponent(epiCurveModeSelector);
epiCurveFooterLayout.setComponentAlignment(epiCurveModeSelector, Alignment.MIDDLE_RIGHT);
epiCurveFooterLayout.setExpandRatio(epiCurveModeSelector, 0);
return epiCurveFooterLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class SurveillanceOverviewLayout method addShowMoreAndLessButtons.
private void addShowMoreAndLessButtons() {
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setHeightUndefined();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setMargin(new MarginInfo(false, true));
showMoreButton = ButtonHelper.createIconButton(Captions.dashboardShowAllDiseases, VaadinIcons.CHEVRON_DOWN, null, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4);
showLessButton = ButtonHelper.createIconButton(Captions.dashboardShowFirstDiseases, VaadinIcons.CHEVRON_UP, null, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4);
hideOverview = new CheckBox(I18nProperties.getCaption(Captions.dashboardHideOverview));
hideOverview.setId("hideOverview");
CssStyles.style(hideOverview, CssStyles.VSPACE_3);
showMoreButton.addClickListener(e -> {
isShowingAllDiseases = true;
refresh();
showMoreButton.setVisible(false);
showLessButton.setVisible(true);
});
showLessButton.addClickListener(e -> {
isShowingAllDiseases = false;
refresh();
showLessButton.setVisible(false);
showMoreButton.setVisible(true);
});
hideOverview.addValueChangeListener(e -> {
if (hideOverview.getValue()) {
diseaseOverviewComponent.setVisible(false);
diseaseDifferenceComponent.setVisible(false);
showLessButton.setVisible(false);
showMoreButton.setVisible(false);
} else {
diseaseOverviewComponent.setVisible(true);
diseaseDifferenceComponent.setVisible(true);
showLessButton.setVisible(isShowingAllDiseases);
showMoreButton.setVisible(!isShowingAllDiseases);
}
});
buttonsLayout.addComponent(showMoreButton);
buttonsLayout.addComponent(showLessButton);
buttonsLayout.setComponentAlignment(showMoreButton, Alignment.BOTTOM_CENTER);
buttonsLayout.setExpandRatio(showMoreButton, 1);
buttonsLayout.setComponentAlignment(showLessButton, Alignment.BOTTOM_CENTER);
buttonsLayout.setExpandRatio(showLessButton, 1);
buttonsLayout.addComponent(hideOverview);
buttonsLayout.setComponentAlignment(hideOverview, Alignment.BOTTOM_RIGHT);
buttonsLayout.setExpandRatio(hideOverview, 0);
addComponent(buttonsLayout, EXTEND_BUTTONS_LOC);
isShowingAllDiseases = false;
showLessButton.setVisible(false);
buttonsLayout.setExpandRatio(showLessButton, 1);
}
Aggregations