use of com.vaadin.v7.ui.VerticalLayout 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.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class CampaignDashboardView method refreshSubTabs.
@SuppressWarnings("deprecation")
private void refreshSubTabs(Page page, String tabId, VerticalLayout subTabLayout) {
final List<String> subTabs = new ArrayList<>(dataProvider.getSubTabIds(tabId));
final SubMenu subTabSwitcher = new SubMenu();
final VerticalLayout subTabSwitcherLayout = new VerticalLayout(subTabSwitcher);
subTabSwitcherLayout.setMargin(new MarginInfo(false, false, false, true));
subTabSwitcherLayout.setSpacing(false);
subTabSwitcherLayout.setId("subTabsOf" + tabId);
currentSubTabsWrapper = subTabSwitcherLayout;
subTabLayout.addComponent(subTabSwitcherLayout);
subTabLayout.setExpandRatio(subTabSwitcherLayout, 0);
subTabSwitcherLayout.addStyleNames("statistics-sublayout", CssStyles.VSPACE_3);
subTabs.forEach(subTabId -> subTabSwitcher.addView(subTabId, subTabId, (e) -> {
subTabLayout.removeComponent(currentDiagramsWrapper);
if (lastSubTabIdForTabIdAndCampaign.containsKey(dataProvider.getCampaign())) {
lastSubTabIdForTabIdAndCampaign.get(dataProvider.getCampaign()).put(tabId, subTabId);
} else {
final HashMap<String, String> subTabMap = new HashMap<>();
subTabMap.put(tabId, subTabId);
lastSubTabIdForTabIdAndCampaign.put(dataProvider.getCampaign(), subTabMap);
}
refreshDiagrams(page, subTabLayout, tabId, subTabId);
}));
if (!(subTabs.size() > 1)) {
subTabSwitcherLayout.setVisible(false);
}
final Map<String, String> subTabMap = lastSubTabIdForTabIdAndCampaign.get(dataProvider.getCampaign());
final String lastSubTabId = subTabMap != null ? subTabMap.get(tabId) : null;
final String activeSubTab = subTabs.isEmpty() ? StringUtils.EMPTY : lastSubTabId != null ? lastSubTabId : subTabs.get(0);
subTabSwitcher.setActiveView(activeSubTab);
refreshDiagrams(page, subTabLayout, tabId, activeSubTab);
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class OutbreakRegionConfigurationForm method createAffectedDistrictsComponent.
private HorizontalLayout createAffectedDistrictsComponent() {
HorizontalLayout affectedDistrictsComponent = new HorizontalLayout();
affectedDistrictsComponent.setWidth(100, Unit.PERCENTAGE);
affectedDistrictsComponent.setMargin(false);
style(affectedDistrictsComponent, VSPACE_3);
// Create two columns to display the districts
VerticalLayout leftColumn = new VerticalLayout();
leftColumn.setMargin(false);
VerticalLayout middleColumn = new VerticalLayout();
middleColumn.setMargin(false);
VerticalLayout rightColumn = new VerticalLayout();
rightColumn.setMargin(false);
affectedDistrictsComponent.addComponent(leftColumn);
// Add spacer label
affectedDistrictsComponent.addComponent(new Label());
affectedDistrictsComponent.addComponent(middleColumn);
// Add spacer label
affectedDistrictsComponent.addComponent(new Label());
affectedDistrictsComponent.addComponent(rightColumn);
affectedDistrictsComponent.setExpandRatio(leftColumn, 1);
affectedDistrictsComponent.setExpandRatio(middleColumn, 1);
affectedDistrictsComponent.setExpandRatio(rightColumn, 1);
List<DistrictReferenceDto> districts = FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid());
int index = 1;
for (DistrictReferenceDto district : districts) {
OptionGroup outbreakToggle = createOutbreakToggle(district);
outbreakToggle.setWidth(100, Unit.PERCENTAGE);
outbreakToggles[index - 1] = outbreakToggle;
// Split districts evenly to all three columns
if ((districts.size() % 3 == 0 && index <= districts.size() / 3) || (districts.size() % 3 != 0 && index <= (districts.size() / 3) + 1)) {
leftColumn.addComponent(outbreakToggle);
} else if ((districts.size() % 3 == 0 && index <= districts.size() / 1.5f) || ((districts.size() % 3 == 1 || districts.size() % 3 == 2) && index <= (districts.size() / 1.5f) + 1)) {
middleColumn.addComponent(outbreakToggle);
} else {
rightColumn.addComponent(outbreakToggle);
}
index++;
}
return affectedDistrictsComponent;
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class DatabaseExportView method createDatabaseTablesLayout.
private HorizontalLayout createDatabaseTablesLayout() {
HorizontalLayout databaseTablesLayout = new HorizontalLayout();
databaseTablesLayout.setMargin(false);
databaseTablesLayout.setSpacing(true);
VerticalLayout sormasDataLayout = new VerticalLayout();
sormasDataLayout.setMargin(false);
sormasDataLayout.setSpacing(false);
Label sormasDataHeadline = new Label(I18nProperties.getCaption(Captions.exportSormasData));
CssStyles.style(sormasDataHeadline, CssStyles.H4);
sormasDataLayout.addComponent(sormasDataHeadline);
VerticalLayout infrastructureDataLayout = new VerticalLayout();
infrastructureDataLayout.setMargin(false);
infrastructureDataLayout.setSpacing(false);
Label infrastructureDataHeadline = new Label(I18nProperties.getCaption(Captions.exportInfrastructureData));
CssStyles.style(infrastructureDataHeadline, CssStyles.H4);
infrastructureDataLayout.addComponent(infrastructureDataHeadline);
VerticalLayout configurationDataLayout = new VerticalLayout();
configurationDataLayout.setMargin(false);
configurationDataLayout.setSpacing(false);
Label configurationDataHeadline = new Label(I18nProperties.getCaption(Captions.exportConfigurationData));
CssStyles.style(configurationDataHeadline, CssStyles.H4);
configurationDataLayout.addComponent(configurationDataHeadline);
VerticalLayout externalDataLayout = new VerticalLayout();
externalDataLayout.setMargin(false);
externalDataLayout.setSpacing(false);
Label externalDataHeadline = new Label(I18nProperties.getCaption(Captions.exportExternalData));
CssStyles.style(externalDataHeadline, CssStyles.H4);
externalDataLayout.addComponent(externalDataHeadline);
List<FeatureConfigurationDto> featureConfigurations = FacadeProvider.getFeatureConfigurationFacade().getActiveServerFeatureConfigurations();
ConfigFacade configFacade = FacadeProvider.getConfigFacade();
for (DatabaseTable databaseTable : DatabaseTable.values()) {
if (!databaseTable.isEnabled(featureConfigurations, configFacade)) {
continue;
}
CheckBox checkBox = new CheckBox(databaseTable.toString());
int indent = getIndent(databaseTable);
if (indent == 1) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_1);
} else if (indent == 2) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_2);
} else if (indent == 3) {
CssStyles.style(checkBox, CssStyles.INDENT_LEFT_3);
}
switch(databaseTable.getDatabaseTableType()) {
case SORMAS:
sormasDataLayout.addComponent(checkBox);
break;
case INFRASTRUCTURE:
infrastructureDataLayout.addComponent(checkBox);
break;
case CONFIGURATION:
configurationDataLayout.addComponent(checkBox);
break;
case EXTERNAL:
externalDataLayout.addComponent(checkBox);
break;
default:
throw new IllegalArgumentException(databaseTable.getDatabaseTableType().toString());
}
databaseTableToggles.put(checkBox, databaseTable);
}
databaseTablesLayout.addComponent(sormasDataLayout);
databaseTablesLayout.addComponent(infrastructureDataLayout);
databaseTablesLayout.addComponent(configurationDataLayout);
databaseTablesLayout.addComponent(externalDataLayout);
return databaseTablesLayout;
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class TherapyView method createTreatmentsHeader.
private VerticalLayout createTreatmentsHeader() {
VerticalLayout treatmentsHeader = new VerticalLayout();
treatmentsHeader.setMargin(false);
treatmentsHeader.setSpacing(false);
treatmentsHeader.setWidth(100, Unit.PERCENTAGE);
HorizontalLayout headlineRow = new HorizontalLayout();
headlineRow.setMargin(false);
headlineRow.setSpacing(true);
headlineRow.setWidth(100, Unit.PERCENTAGE);
{
Label treatmentsLabel = new Label(I18nProperties.getString(Strings.headingTreatments));
CssStyles.style(treatmentsLabel, CssStyles.H3);
headlineRow.addComponent(treatmentsLabel);
headlineRow.setExpandRatio(treatmentsLabel, 1);
// Bulk operations
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
ControllerProvider.getTherapyController().deleteAllSelectedTreatments(treatmentGrid.getSelectedRows(), new Runnable() {
public void run() {
reloadTreatmentGrid();
}
});
}));
headlineRow.addComponent(bulkOperationsDropdown);
headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
}
Button newTreatmentButton = ButtonHelper.createButton(Captions.treatmentNewTreatment, e -> {
ControllerProvider.getTherapyController().openTreatmentCreateForm(treatmentCriteria.getTherapy(), this::reloadTreatmentGrid);
});
headlineRow.addComponent(newTreatmentButton);
headlineRow.setComponentAlignment(newTreatmentButton, Alignment.MIDDLE_RIGHT);
}
treatmentsHeader.addComponent(headlineRow);
HorizontalLayout filterRow = new HorizontalLayout();
filterRow.setMargin(false);
filterRow.setSpacing(true);
{
treatmentTypeFilter = ComboBoxHelper.createComboBoxV7();
treatmentTypeFilter.setWidth(140, Unit.PIXELS);
treatmentTypeFilter.setInputPrompt(I18nProperties.getPrefixCaption(TreatmentDto.I18N_PREFIX, TreatmentDto.TREATMENT_TYPE));
treatmentTypeFilter.addItems((Object[]) TreatmentType.values());
treatmentTypeFilter.addValueChangeListener(e -> {
treatmentCriteria.treatmentType(((TreatmentType) e.getProperty().getValue()));
navigateTo(treatmentCriteria);
});
filterRow.addComponent(treatmentTypeFilter);
treatmentTextFilter = new TextField();
treatmentTextFilter.setWidth(300, Unit.PIXELS);
treatmentTextFilter.setNullRepresentation("");
treatmentTextFilter.setInputPrompt(I18nProperties.getString(Strings.promptTreatmentTextFilter));
treatmentTextFilter.addTextChangeListener(e -> {
treatmentCriteria.textFilter(e.getText());
reloadTreatmentGrid();
});
filterRow.addComponent(treatmentTextFilter);
}
treatmentsHeader.addComponent(filterRow);
return treatmentsHeader;
}
Aggregations