use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsShowVersionButtons method diff.
/**
* @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean)
*/
public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) {
Panel panel = new Panel("");
panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
HorizontalLayout hl = new HorizontalLayout();
panel.setContent(hl);
hl.addComponent(createButton(cms, v1));
hl.addComponent(createButton(cms, v2));
VerticalLayout outerContainer = new VerticalLayout();
outerContainer.addComponent(hl);
outerContainer.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT);
outerContainer.setMargin(true);
hl.setSpacing(true);
return Optional.fromNullable((Component) outerContainer);
}
use of com.vaadin.v7.ui.HorizontalLayout in project opencms-core by alkacon.
the class CmsPermissionDialog method addEntryTableToLayout.
/**
* Adds list of entries to layout.<p>
*
* @param entries the ace list
* @param layout layout
* @param editable boolean
* @param inheritedRes boolean
*/
private void addEntryTableToLayout(List<CmsAccessControlEntry> entries, VerticalLayout layout, boolean editable, boolean inheritedRes) {
final CmsPermissionViewTable table = new CmsPermissionViewTable(m_cms, entries, editable, inheritedRes, m_parents, this);
HorizontalLayout hl = new HorizontalLayout();
Label label = new Label(CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_COUNT_1, new Integer(table.getContainerDataSource().size())));
label.addStyleName("o-report");
hl.addComponent(label);
TextField tableFilter = new TextField();
tableFilter.setIcon(FontOpenCms.FILTER);
tableFilter.setInputPrompt(CmsVaadinUtils.getMessageText(org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
tableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tableFilter.setWidth("200px");
tableFilter.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
public void textChange(TextChangeEvent event) {
table.filterTable(event.getText());
}
});
hl.addComponent(tableFilter);
hl.setWidth("100%");
hl.setExpandRatio(label, 1);
hl.setMargin(true);
hl.setComponentAlignment(tableFilter, com.vaadin.ui.Alignment.MIDDLE_RIGHT);
if (table.getContainerDataSource().size() == 0) {
layout.addComponent(CmsVaadinUtils.getInfoLayout(Messages.GUI_PERMISSION_EMPTY_0));
} else {
layout.addComponent(hl);
layout.addComponent(table);
CmsVaadinUtils.centerWindow(this);
}
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class CaseContactsView method createStatusFilterBar.
public HorizontalLayout createStatusFilterBar() {
HorizontalLayout statusFilterLayout = new HorizontalLayout();
statusFilterLayout.setSpacing(true);
statusFilterLayout.setWidth("100%");
statusFilterLayout.addStyleName(CssStyles.VSPACE_3);
statusButtons = new HashMap<>();
Button statusAll = ButtonHelper.createButton(Captions.all, e -> {
criteria.contactStatus(null);
navigateTo(criteria);
}, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER);
statusAll.setCaptionAsHtml(true);
statusFilterLayout.addComponent(statusAll);
statusButtons.put(statusAll, I18nProperties.getCaption(Captions.all));
activeStatusButton = statusAll;
for (ContactStatus status : ContactStatus.values()) {
Button statusButton = ButtonHelper.createButton(status.toString(), e -> {
criteria.contactStatus(status);
navigateTo(criteria);
}, ValoTheme.BUTTON_BORDERLESS, CssStyles.BUTTON_FILTER, CssStyles.BUTTON_FILTER_LIGHT);
statusButton.setData(status);
statusButton.setCaptionAsHtml(true);
statusFilterLayout.addComponent(statusButton);
statusButtons.put(statusButton, status.toString());
}
statusFilterLayout.setExpandRatio(statusFilterLayout.getComponent(statusFilterLayout.getComponentCount() - 1), 1);
// Bulk operation dropdown
if (UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
statusFilterLayout.setWidth(100, Unit.PERCENTAGE);
MenuBar bulkOperationsDropdown = MenuBarHelper.createDropDown(Captions.bulkActions, new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkEdit), VaadinIcons.ELLIPSIS_H, selectedItem -> {
ControllerProvider.getContactController().showBulkContactDataEditComponent(grid.asMultiSelect().getSelectedItems(), getCaseRef().getUuid());
}), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkCancelFollowUp), VaadinIcons.CLOSE, selectedItem -> {
ControllerProvider.getContactController().cancelFollowUpOfAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
}), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkLostToFollowUp), VaadinIcons.UNLINK, selectedItem -> {
ControllerProvider.getContactController().setAllSelectedItemsToLostToFollowUp(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
}), new MenuBarHelper.MenuBarItem(I18nProperties.getCaption(Captions.bulkDelete), VaadinIcons.TRASH, selectedItem -> {
ControllerProvider.getContactController().deleteAllSelectedItems(grid.asMultiSelect().getSelectedItems(), () -> navigateTo(criteria));
}));
statusFilterLayout.addComponent(bulkOperationsDropdown);
statusFilterLayout.setComponentAlignment(bulkOperationsDropdown, Alignment.TOP_RIGHT);
statusFilterLayout.setExpandRatio(bulkOperationsDropdown, 1);
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_IMPORT)) {
Button importButton = ButtonHelper.createIconButton(Captions.actionImport, VaadinIcons.UPLOAD, e -> {
Window popupWindow = VaadinUiUtil.showPopupWindow(new CaseContactsImportLayout(FacadeProvider.getCaseFacade().getCaseDataByUuid(criteria.getCaze().getUuid())));
popupWindow.setCaption(I18nProperties.getString(Strings.headingImportCaseContacts));
popupWindow.addCloseListener(c -> {
grid.reload();
});
}, ValoTheme.BUTTON_PRIMARY);
statusFilterLayout.addComponent(importButton);
statusFilterLayout.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT);
if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
statusFilterLayout.setExpandRatio(importButton, 1);
}
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) {
VerticalLayout exportLayout = new VerticalLayout();
exportLayout.setSpacing(true);
exportLayout.setMargin(true);
exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
exportLayout.setWidth(200, Unit.PIXELS);
PopupButton exportButton = ButtonHelper.createIconPopupButton(Captions.export, VaadinIcons.DOWNLOAD, exportLayout);
statusFilterLayout.addComponent(exportButton);
statusFilterLayout.setComponentAlignment(exportButton, Alignment.MIDDLE_RIGHT);
if (!UserProvider.getCurrent().hasUserRight(UserRight.PERFORM_BULK_OPERATIONS)) {
statusFilterLayout.setExpandRatio(exportButton, 1);
}
StreamResource streamResource = GridExportStreamResource.createStreamResourceWithSelectedItems(grid, () -> viewConfiguration.isInEagerMode() ? this.grid.asMultiSelect().getSelectedItems() : null, ExportEntityName.CONTACTS);
addExportButton(streamResource, exportButton, exportLayout, VaadinIcons.TABLE, Captions.exportBasic, Descriptions.descExportButton);
StreamResource extendedExportStreamResource = ContactDownloadUtil.createContactExportResource(grid.getCriteria(), this::getSelectedRows, null);
addExportButton(extendedExportStreamResource, exportButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportDetailed, Descriptions.descDetailedExportButton);
Button btnCustomExport = ButtonHelper.createIconButton(Captions.exportCustom, VaadinIcons.FILE_TEXT, e -> {
ControllerProvider.getCustomExportController().openContactExportWindow(grid.getCriteria(), this::getSelectedRows);
}, ValoTheme.BUTTON_PRIMARY);
btnCustomExport.setDescription(I18nProperties.getString(Strings.infoCustomExport));
btnCustomExport.setWidth(100, Unit.PERCENTAGE);
exportLayout.addComponent(btnCustomExport);
// Warning if no filters have been selected
Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters));
warningLabel.setWidth(100, Unit.PERCENTAGE);
exportLayout.addComponent(warningLabel);
warningLabel.setVisible(false);
exportButton.addClickListener(e -> warningLabel.setVisible(!criteria.hasAnyFilterActive()));
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_CREATE)) {
final CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(this.getCaseRef().getUuid());
final ExpandableButton lineListingButton = new ExpandableButton(Captions.lineListing).expand(e -> ControllerProvider.getContactController().openLineListingWindow(caseDto));
statusFilterLayout.addComponent(lineListingButton);
final Button newButton = ButtonHelper.createIconButtonWithCaption(Captions.contactNewContact, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, Captions.contactNewContact), VaadinIcons.PLUS_CIRCLE, e -> ControllerProvider.getContactController().create(this.getCaseRef()), ValoTheme.BUTTON_PRIMARY);
statusFilterLayout.addComponent(newButton);
statusFilterLayout.setComponentAlignment(newButton, Alignment.MIDDLE_RIGHT);
}
statusFilterLayout.addStyleName("top-bar");
activeStatusButton = statusAll;
return statusFilterLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class CaseContactsView method createFilterBar.
public HorizontalLayout createFilterBar() {
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setSpacing(true);
topLayout.setSizeUndefined();
classificationFilter = ComboBoxHelper.createComboBoxV7();
classificationFilter.setWidth(240, Unit.PIXELS);
classificationFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.CONTACT_CLASSIFICATION));
classificationFilter.addValueChangeListener(e -> criteria.setContactClassification((ContactClassification) e.getProperty().getValue()));
topLayout.addComponent(classificationFilter);
UserDto user = UserProvider.getCurrent().getUser();
regionFilter = ComboBoxHelper.createComboBoxV7();
if (user.getRegion() == null) {
regionFilter.setWidth(240, Unit.PIXELS);
regionFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.REGION_UUID));
regionFilter.addItems(FacadeProvider.getRegionFacade().getAllActiveByServerCountry());
regionFilter.addValueChangeListener(e -> {
RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
if (region != null) {
officerFilter.addItems(FacadeProvider.getUserFacade().getUsersByRegionAndRights(region, criteria.getDisease(), UserRight.CONTACT_RESPONSIBLE));
} else {
officerFilter.removeAllItems();
}
criteria.region(region);
});
topLayout.addComponent(regionFilter);
}
districtFilter = ComboBoxHelper.createComboBoxV7();
districtFilter.setWidth(240, Unit.PIXELS);
districtFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.DISTRICT_UUID));
districtFilter.addValueChangeListener(e -> criteria.district((DistrictReferenceDto) e.getProperty().getValue()));
if (user.getRegion() != null && user.getDistrict() == null) {
districtFilter.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(user.getRegion().getUuid()));
districtFilter.setEnabled(true);
} else {
regionFilter.addValueChangeListener(e -> {
RegionReferenceDto region = (RegionReferenceDto) e.getProperty().getValue();
districtFilter.removeAllItems();
if (region != null) {
districtFilter.addItems(FacadeProvider.getDistrictFacade().getAllActiveByRegion(region.getUuid()));
districtFilter.setEnabled(true);
} else {
districtFilter.setEnabled(false);
}
});
districtFilter.setEnabled(false);
}
topLayout.addComponent(districtFilter);
Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML);
infoLabel.setSizeUndefined();
infoLabel.setDescription(I18nProperties.getString(Strings.infoContactsViewRegionDistrictFilter), ContentMode.HTML);
CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY);
topLayout.addComponent(infoLabel);
officerFilter = ComboBoxHelper.createComboBoxV7();
officerFilter.setWidth(240, Unit.PIXELS);
officerFilter.setInputPrompt(I18nProperties.getPrefixCaption(ContactIndexDto.I18N_PREFIX, ContactIndexDto.CONTACT_OFFICER_UUID));
officerFilter.addValueChangeListener(e -> criteria.setContactOfficer((UserReferenceDto) e.getProperty().getValue()));
if (user.getRegion() != null) {
officerFilter.addItems(FacadeProvider.getUserFacade().getUsersByRegionAndRights(user.getRegion(), criteria.getDisease(), UserRight.CONTACT_RESPONSIBLE));
}
topLayout.addComponent(officerFilter);
searchField = new TextField();
searchField.setWidth(150, Unit.PIXELS);
searchField.setNullRepresentation("");
searchField.setInputPrompt(I18nProperties.getString(Strings.promptContactsSearchField));
searchField.addTextChangeListener(e -> criteria.setContactOrCaseLike(e.getText()));
topLayout.addComponent(searchField);
personLikeField = new TextField();
personLikeField.setWidth(150, Unit.PIXELS);
personLikeField.setNullRepresentation("");
personLikeField.setInputPrompt(I18nProperties.getString(Strings.promptRelatedPersonLikeField));
personLikeField.addTextChangeListener(e -> criteria.setPersonLike(e.getText()));
topLayout.addComponent(personLikeField);
resetButton = ButtonHelper.createButton(Captions.actionResetFilters, event -> {
ViewModelProviders.of(CaseContactsView.class).remove(ContactCriteria.class);
navigateTo(null);
});
resetButton.setVisible(false);
topLayout.addComponent(resetButton);
applyButton = ButtonHelper.createButton(Captions.actionApplyFilters, event -> navigateTo(criteria));
applyButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
applyButton.setVisible(false);
topLayout.addComponent(applyButton);
classificationFilter.addValueChangeListener(e -> updateApplyResetButtons());
regionFilter.addValueChangeListener(e -> updateApplyResetButtons());
officerFilter.addValueChangeListener(e -> updateApplyResetButtons());
districtFilter.addValueChangeListener(e -> updateApplyResetButtons());
searchField.addValueChangeListener(e -> updateApplyResetButtons());
personLikeField.addValueChangeListener(e -> updateApplyResetButtons());
return topLayout;
}
use of com.vaadin.v7.ui.HorizontalLayout in project SORMAS-Project by hzi-braunschweig.
the class ClinicalCourseView method createClinicalVisitsHeader.
private VerticalLayout createClinicalVisitsHeader() {
VerticalLayout clinicalVisitsHeader = new VerticalLayout();
clinicalVisitsHeader.setMargin(false);
clinicalVisitsHeader.setSpacing(false);
clinicalVisitsHeader.setWidth(100, Unit.PERCENTAGE);
HorizontalLayout headlineRow = new HorizontalLayout();
headlineRow.setMargin(false);
headlineRow.setSpacing(true);
headlineRow.setWidth(100, Unit.PERCENTAGE);
{
Label clinicalVisitsLabel = new Label(I18nProperties.getString(Strings.entityClinicalVisits));
CssStyles.style(clinicalVisitsLabel, CssStyles.H3);
headlineRow.addComponent(clinicalVisitsLabel);
headlineRow.setExpandRatio(clinicalVisitsLabel, 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.getClinicalCourseController().deleteAllSelectedClinicalVisits(clinicalVisitGrid.getSelectedRows(), new Runnable() {
public void run() {
clinicalVisitGrid.reload();
}
});
}));
headlineRow.addComponent(bulkOperationsDropdown);
headlineRow.setComponentAlignment(bulkOperationsDropdown, Alignment.MIDDLE_RIGHT);
}
Button newClinicalVisitButton = ButtonHelper.createButton(Captions.clinicalVisitNewClinicalVisit, e -> {
ControllerProvider.getClinicalCourseController().openClinicalVisitCreateForm(clinicalVisitCriteria.getClinicalCourse(), getCaseRef().getUuid(), this::reloadClinicalVisitGrid);
}, ValoTheme.BUTTON_PRIMARY);
headlineRow.addComponent(newClinicalVisitButton);
headlineRow.setComponentAlignment(newClinicalVisitButton, Alignment.MIDDLE_RIGHT);
}
clinicalVisitsHeader.addComponent(headlineRow);
return clinicalVisitsHeader;
}
Aggregations