use of com.vaadin.v7.ui.VerticalLayout in project charts by vaadin.
the class TListUi method loadTestClasses.
private void loadTestClasses(TListUi aThis) {
if (testClassess != null) {
return;
}
testClassess = new IndexedContainer();
testClassess.addContainerProperty("name", String.class, "");
testClassess.addContainerProperty("description", String.class, "");
testClassess.addContainerProperty("package", String.class, "");
listTestClasses(testClassess, "area");
listTestClasses(testClassess, "columnandbar");
listTestClasses(testClassess, "combinations");
listTestClasses(testClassess, "container");
listTestClasses(testClassess, "dynamic");
listTestClasses(testClassess, "lineandscatter");
listTestClasses(testClassess, "other");
listTestClasses(testClassess, "pie");
listTestClasses(testClassess, "themes");
listTestClasses(testClassess, "librarydata");
listTestClasses(testClassess, "timeline");
listTestClasses(testClassess, "threed");
listTestClasses(testClassess, "declarative");
listTestClasses(testClassess, "dataprovider");
Table table = new Table("Test cases", testClassess);
table.addGeneratedColumn("name", new Table.ColumnGenerator() {
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
String pack = (String) source.getItem(itemId).getItemProperty("package").getValue();
Link link = new Link();
link.setResource(new ExternalResource("/" + (pack != null ? pack + "/" : "") + name));
link.setCaption(name);
link.setTargetName("_new");
return link;
}
});
table.addGeneratedColumn("description", new Table.ColumnGenerator() {
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
return new Label(description);
}
});
table.setSizeFull();
table.setColumnExpandRatio("description", 1);
VerticalLayout verticalLayout = new VerticalLayout();
TextField filter = new TextField();
filter.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
String text = event.getText();
testClassess.removeAllContainerFilters();
testClassess.addContainerFilter("name", text, true, false);
}
});
verticalLayout.addComponent(filter);
filter.focus();
verticalLayout.addComponent(table);
setContent(verticalLayout);
}
use of com.vaadin.v7.ui.VerticalLayout in project ANNIS by korpling.
the class FlatQueryBuilder method launch.
private void launch(QueryController cp) {
this.cp = cp;
rsc = new ReducingStringComparator();
mainLayout = new VerticalLayout();
// tracking lists for vertical nodes, edgeboxes and metaboxes
vnodes = new ArrayList<>();
eboxes = new ArrayList<>();
mboxes = new ArrayList<>();
spbox = null;
// buttons and checks
btGo = new Button(BUTTON_GO_LABEL, this);
btGo.setStyleName(ChameleonTheme.BUTTON_SMALL);
btClear = new Button(BUTTON_CLEAR_LABEL, this);
btClear.setStyleName(ChameleonTheme.BUTTON_SMALL);
btInitLanguage = new Button("Initialize", this);
btInitLanguage.setDescription(INFO_INIT_LANG);
btInitSpan = new Button("Initialize", this);
btInitSpan.setDescription(INFO_INIT_SPAN);
btInitMeta = new Button("Initialize", this);
btInitMeta.setDescription(INFO_INIT_META);
filtering = new NativeSelect("Filtering mechanisms");
filtering.setDescription(INFO_FILTER);
ReducingStringComparator rdc = new ReducingStringComparator();
Set mappings = rdc.getMappings().keySet();
int i;
for (i = 0; i < mappings.size(); i++) {
String mapname = (String) mappings.toArray()[i];
filtering.addItem(i);
filtering.setItemCaption(i, mapname);
}
filtering.addItem(i + 1);
filtering.setItemCaption(i + 1, "generic");
filtering.select(i + 1);
filtering.setNullSelectionAllowed(false);
filtering.setImmediate(true);
// language layout
language = new HorizontalLayout();
languagenodes = new HorizontalLayout();
language.addComponent(languagenodes);
language.addComponent(btInitLanguage);
language.setMargin(true);
language.setCaption(LANG_CAPTION);
language.addStyleName("linguistics-panel");
// span layout
span = new HorizontalLayout();
span.setSpacing(true);
span.addComponent(btInitSpan);
span.setMargin(true);
span.setCaption(SPAN_CAPTION);
span.addStyleName("span-panel");
// meta layout
meta = new HorizontalLayout();
meta.setSpacing(true);
meta.addComponent(btInitMeta);
meta.setMargin(true);
meta.setCaption(META_CAPTION);
meta.addStyleName("meta-panel");
// toolbar layout
toolbar = new HorizontalLayout();
toolbar.setSpacing(true);
toolbar.addComponent(btGo);
toolbar.addComponent(btClear);
toolbar.setMargin(true);
toolbar.setCaption(TOOLBAR_CAPTION);
toolbar.addStyleName("toolbar-panel");
// advanced
advanced = new HorizontalLayout();
advanced.setSpacing(true);
advanced.addComponent(filtering);
advanced.setMargin(true);
advanced.setCaption(ADVANCED_CAPTION);
advanced.addStyleName("advanced-panel");
// put everything on the layout
mainLayout.setSpacing(true);
mainLayout.addComponent(language);
mainLayout.addComponent(span);
mainLayout.addComponent(meta);
mainLayout.addComponent(toolbar);
mainLayout.addComponent(advanced);
setContent(mainLayout);
getContent().setWidth("100%");
getContent().setHeight("-1px");
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class ExposuresField method showMultipleInfectionEnvironmentsPopup.
private void showMultipleInfectionEnvironmentsPopup(ExposureDto entry) {
VerticalLayout warningLayout = VaadinUiUtil.createWarningLayout();
Window popupWindow = VaadinUiUtil.showPopupWindow(warningLayout);
com.vaadin.ui.Label infoLabel = new com.vaadin.ui.Label(I18nProperties.getValidationError(Validations.caseMultipleInfectionEnvironments));
CssStyles.style(infoLabel, CssStyles.LABEL_LARGE, CssStyles.LABEL_WHITE_SPACE_NORMAL);
warningLayout.addComponent(infoLabel);
ConfirmationComponent yesNo = VaadinUiUtil.buildYesNoConfirmationComponent();
yesNo.getConfirmButton().addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(Button.ClickEvent event) {
popupWindow.close();
for (ExposureDto exposure : getValue()) {
if (exposure.isProbableInfectionEnvironment() && !exposure.getUuid().equals(entry.getUuid())) {
exposure.setProbableInfectionEnvironment(false);
}
}
getTable().refreshRowCache();
}
});
yesNo.getCancelButton().addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(Button.ClickEvent event) {
popupWindow.close();
entry.setProbableInfectionEnvironment(false);
getTable().refreshRowCache();
}
});
warningLayout.addComponent(yesNo);
popupWindow.setWidth(800, Sizeable.Unit.PIXELS);
popupWindow.setClosable(false);
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class CasesView method addCommonCasesOverviewToolbar.
private void addCommonCasesOverviewToolbar() {
final PopupMenu moreButton = new PopupMenu(I18nProperties.getCaption(Captions.moreActions));
Button openGuideButton = ButtonHelper.createIconButton(Captions.caseOpenCasesGuide, VaadinIcons.QUESTION, e -> buildAndOpenCasesInstructions(), ValoTheme.BUTTON_PRIMARY);
openGuideButton.setWidth(100, Unit.PERCENTAGE);
moreButton.addMenuEntry(openGuideButton);
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) {
VerticalLayout importLayout = new VerticalLayout();
{
importLayout.setSpacing(true);
importLayout.setMargin(true);
importLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
importLayout.setWidth(250, Unit.PIXELS);
PopupButton importButton = ButtonHelper.createIconPopupButton(Captions.actionImport, VaadinIcons.UPLOAD, importLayout);
addHeaderComponent(importButton);
}
addImportButton(importLayout, Captions.importLineListing, Strings.headingLineListingImport, LineListingImportLayout::new);
addImportButton(importLayout, Captions.importDetailed, Strings.headingImportCases, CaseImportLayout::new);
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_EXPORT)) {
VerticalLayout exportLayout = new VerticalLayout();
{
exportLayout.setSpacing(true);
exportLayout.setMargin(true);
exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL);
exportLayout.setWidth(250, Unit.PIXELS);
}
PopupButton exportPopupButton = ButtonHelper.createIconPopupButton(Captions.export, VaadinIcons.DOWNLOAD, exportLayout);
addHeaderComponent(exportPopupButton);
{
StreamResource streamResource = GridExportStreamResource.createStreamResourceWithSelectedItems(grid, () -> this.viewConfiguration.isInEagerMode() ? this.grid.asMultiSelect().getSelectedItems() : Collections.emptySet(), ExportEntityName.CASES);
addExportButton(streamResource, exportPopupButton, exportLayout, VaadinIcons.TABLE, Captions.exportBasic, Strings.infoBasicExport);
}
{
StreamResource exportStreamResource = CaseDownloadUtil.createCaseExportResource(grid.getCriteria(), this::getSelectedRows, CaseExportType.CASE_SURVEILLANCE, detailedExportConfiguration);
addExportButton(exportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportDetailed, Strings.infoDetailedExport);
}
if (hasClinicalCourseRight || hasTherapyRight) {
StreamResource caseManagementExportStreamResource = DownloadUtil.createCaseManagementExportResource(grid.getCriteria(), this::getSelectedRows, ExportEntityName.CONTACTS);
addExportButton(caseManagementExportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportCaseManagement, Strings.infoCaseManagementExport);
}
{
StreamResource sampleExportStreamResource = DownloadUtil.createCsvExportStreamResource(SampleExportDto.class, null, (Integer start, Integer max) -> FacadeProvider.getSampleFacade().getExportList(grid.getCriteria(), this.getSelectedRows(), start, max), (propertyId, type) -> {
String caption = I18nProperties.findPrefixCaption(propertyId, SampleExportDto.I18N_PREFIX, SampleDto.I18N_PREFIX, CaseDataDto.I18N_PREFIX, PersonDto.I18N_PREFIX, AdditionalTestDto.I18N_PREFIX);
if (Date.class.isAssignableFrom(type)) {
caption += " (" + DateFormatHelper.getDateFormatPattern() + ")";
}
return caption;
}, ExportEntityName.SAMPLES, null);
addExportButton(sampleExportStreamResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.exportSamples, Strings.infoSampleExport);
}
if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_SWITZERLAND) && UserProvider.getCurrent().hasUserRight(UserRight.BAG_EXPORT)) {
StreamResource bagExportResource = DownloadUtil.createCsvExportStreamResource(BAGExportCaseDto.class, null, (Integer start, Integer max) -> FacadeProvider.getBAGExportFacade().getCaseExportList(this.getSelectedRows(), start, max), (propertyId, type) -> propertyId, ExportEntityName.BAG_CASES, null);
addExportButton(bagExportResource, exportPopupButton, exportLayout, VaadinIcons.FILE_TEXT, Captions.BAGExport, Strings.infoBAGExport);
}
{
Button btnCustomCaseExport = ButtonHelper.createIconButton(Captions.exportCaseCustom, VaadinIcons.FILE_TEXT, e -> {
Window customExportWindow = VaadinUiUtil.createPopupWindow();
ExportConfigurationsLayout customExportsLayout = new ExportConfigurationsLayout(ExportType.CASE, ImportExportUtils.getCaseExportProperties(CaseDownloadUtil::getPropertyCaption, caseFollowUpEnabled, hasClinicalCourseRight, hasTherapyRight, FacadeProvider.getConfigFacade().getCountryLocale()), customExportWindow::close);
customExportsLayout.setExportCallback((exportConfig) -> Page.getCurrent().open(CaseDownloadUtil.createCaseExportResource(grid.getCriteria(), this::getSelectedRows, null, exportConfig), null, true));
customExportWindow.setWidth(1024, Unit.PIXELS);
customExportWindow.setCaption(I18nProperties.getCaption(Captions.exportCaseCustom));
customExportWindow.setContent(customExportsLayout);
UI.getCurrent().addWindow(customExportWindow);
exportPopupButton.setPopupVisible(false);
}, ValoTheme.BUTTON_PRIMARY);
btnCustomCaseExport.setDescription(I18nProperties.getString(Strings.infoCustomExport));
btnCustomCaseExport.setWidth(100, Unit.PERCENTAGE);
exportLayout.addComponent(btnCustomCaseExport);
}
{
// Warning if no filters have been selected
Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters), ContentMode.HTML);
warningLabel.setWidth(100, Unit.PERCENTAGE);
exportLayout.addComponent(warningLabel);
warningLabel.setVisible(false);
exportPopupButton.addClickListener(e -> warningLabel.setVisible(!criteria.hasAnyFilterActive()));
}
}
if (isBulkEditAllowed()) {
btnEnterBulkEditMode = ButtonHelper.createIconButton(Captions.actionEnterBulkEditMode, VaadinIcons.CHECK_SQUARE_O, e -> {
if (grid.getItemCount() > BULK_EDIT_MODE_WARNING_THRESHOLD) {
VaadinUiUtil.showConfirmationPopup(I18nProperties.getCaption(Captions.actionEnterBulkEditMode), new Label(String.format(I18nProperties.getString(Strings.confirmationEnterBulkEditMode), BULK_EDIT_MODE_WARNING_THRESHOLD)), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), 640, (result) -> {
if (result == true) {
enterBulkEditMode();
}
});
} else {
enterBulkEditMode();
}
}, ValoTheme.BUTTON_PRIMARY);
btnEnterBulkEditMode.setVisible(!viewConfiguration.isInEagerMode());
btnEnterBulkEditMode.setWidth(100, Unit.PERCENTAGE);
moreButton.addMenuEntry(btnEnterBulkEditMode);
btnLeaveBulkEditMode = ButtonHelper.createIconButton(Captions.actionLeaveBulkEditMode, VaadinIcons.CLOSE, e -> {
bulkOperationsDropdown.setVisible(false);
ViewModelProviders.of(CasesView.class).get(CasesViewConfiguration.class).setInEagerMode(false);
btnLeaveBulkEditMode.setVisible(false);
btnEnterBulkEditMode.setVisible(true);
this.filterForm.enableSearchAndReportingUser();
navigateTo(criteria);
}, ValoTheme.BUTTON_PRIMARY);
btnLeaveBulkEditMode.setVisible(viewConfiguration.isInEagerMode());
addHeaderComponent(btnLeaveBulkEditMode);
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_MERGE)) {
Button mergeDuplicatesButton = ButtonHelper.createIconButton(Captions.caseMergeDuplicates, VaadinIcons.COMPRESS_SQUARE, e -> ControllerProvider.getCaseController().navigateToMergeCasesView(), ValoTheme.BUTTON_PRIMARY);
mergeDuplicatesButton.setWidth(100, Unit.PERCENTAGE);
moreButton.addMenuEntry(mergeDuplicatesButton);
}
Button searchSpecificCaseButton = ButtonHelper.createIconButton(Captions.caseSearchSpecificCase, VaadinIcons.SEARCH, e -> buildAndOpenSearchSpecificCaseWindow(), ValoTheme.BUTTON_PRIMARY);
searchSpecificCaseButton.setWidth(100, Unit.PERCENTAGE);
moreButton.addMenuEntry(searchSpecificCaseButton);
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_CREATE)) {
final ExpandableButton lineListingButton = new ExpandableButton(Captions.lineListing).expand(e -> ControllerProvider.getCaseController().openLineListingWindow());
addHeaderComponent(lineListingButton);
final ExpandableButton createButton = new ExpandableButton(Captions.caseNewCase).expand(e -> ControllerProvider.getCaseController().create());
addHeaderComponent(createButton);
}
if (moreButton.hasMenuEntries()) {
addHeaderComponent(moreButton);
}
}
use of com.vaadin.v7.ui.VerticalLayout in project SORMAS-Project by hzi-braunschweig.
the class CasePickOrImportField method addInfoComponent.
@Override
protected void addInfoComponent() {
HorizontalLayout infoLayout = new HorizontalLayout();
infoLayout.setWidth(100, Unit.PERCENTAGE);
infoLayout.setSpacing(true);
Image icon = new Image(null, new ThemeResource("img/info-icon.png"));
icon.setHeight(35, Unit.PIXELS);
icon.setWidth(35, Unit.PIXELS);
infoLayout.addComponent(icon);
Label infoLabel = new Label(I18nProperties.getString(Strings.infoImportSimilarity));
infoLayout.addComponent(infoLabel);
infoLayout.setExpandRatio(infoLabel, 1);
mainLayout.addComponent(infoLayout);
CssStyles.style(infoLayout, CssStyles.VSPACE_3);
// Imported case info
VerticalLayout caseInfoContainer = new VerticalLayout();
caseInfoContainer.setWidth(100, Unit.PERCENTAGE);
CssStyles.style(caseInfoContainer, CssStyles.BACKGROUND_ROUNDED_CORNERS, CssStyles.BACKGROUND_SUB_CRITERIA, CssStyles.VSPACE_3, "v-scrollable");
Label newCaseLabel = new Label(I18nProperties.getString(Strings.headingImportedCaseInfo));
CssStyles.style(newCaseLabel, CssStyles.LABEL_BOLD, CssStyles.VSPACE_4);
caseInfoContainer.addComponent(newCaseLabel);
HorizontalLayout caseInfoLayout = new HorizontalLayout();
caseInfoLayout.setSpacing(true);
caseInfoLayout.setSizeUndefined();
{
Label diseaseField = new Label();
diseaseField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISEASE));
diseaseField.setValue(DiseaseHelper.toString(newCase.getDisease(), newCase.getDiseaseDetails()));
diseaseField.setWidthUndefined();
caseInfoLayout.addComponent(diseaseField);
Label reportDateField = new Label();
reportDateField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REPORT_DATE));
reportDateField.setValue(DateFormatHelper.formatDate(newCase.getReportDate()));
reportDateField.setWidthUndefined();
caseInfoLayout.addComponent(reportDateField);
Label responsibleRegionField = new Label();
responsibleRegionField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.RESPONSIBLE_REGION));
responsibleRegionField.setValue(newCase.getResponsibleRegion().toString());
responsibleRegionField.setWidthUndefined();
caseInfoLayout.addComponent(responsibleRegionField);
Label responsibleDistrictField = new Label();
responsibleDistrictField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.RESPONSIBLE_DISTRICT));
responsibleDistrictField.setValue(newCase.getResponsibleDistrict().toString());
responsibleDistrictField.setWidthUndefined();
caseInfoLayout.addComponent(responsibleDistrictField);
if (newCase.getRegion() != null) {
Label regionField = new Label();
regionField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REGION));
regionField.setValue(newCase.getRegion().toString());
regionField.setWidthUndefined();
caseInfoLayout.addComponent(regionField);
}
if (newCase.getDistrict() != null) {
Label districtField = new Label();
districtField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISTRICT));
districtField.setValue(newCase.getDistrict().toString());
districtField.setWidthUndefined();
caseInfoLayout.addComponent(districtField);
}
Label facilityField = new Label();
facilityField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY));
facilityField.setValue(FacilityHelper.buildFacilityString(null, newCase.getHealthFacility() != null ? newCase.getHealthFacility().toString() : "", newCase.getHealthFacilityDetails()));
facilityField.setWidthUndefined();
caseInfoLayout.addComponent(facilityField);
Label firstNameField = new Label();
firstNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.FIRST_NAME));
firstNameField.setValue(newPerson.getFirstName());
firstNameField.setWidthUndefined();
caseInfoLayout.addComponent(firstNameField);
Label lastNameField = new Label();
lastNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.LAST_NAME));
lastNameField.setValue(newPerson.getLastName());
lastNameField.setWidthUndefined();
caseInfoLayout.addComponent(lastNameField);
Label ageAndBirthDateField = new Label();
ageAndBirthDateField.setCaption(I18nProperties.getCaption(Captions.personAgeAndBirthdate));
ageAndBirthDateField.setValue(PersonHelper.getAgeAndBirthdateString(newPerson.getApproximateAge(), newPerson.getApproximateAgeType(), newPerson.getBirthdateDD(), newPerson.getBirthdateMM(), newPerson.getBirthdateYYYY()));
ageAndBirthDateField.setWidthUndefined();
caseInfoLayout.addComponent(ageAndBirthDateField);
Label sexField = new Label();
sexField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.SEX));
sexField.setValue(newPerson.getSex() != null ? newPerson.getSex().toString() : "");
sexField.setWidthUndefined();
caseInfoLayout.addComponent(sexField);
}
caseInfoContainer.addComponent(caseInfoLayout);
mainLayout.addComponent(caseInfoContainer);
}
Aggregations