List of usage examples for com.vaadin.ui Label setWidthUndefined
@Override public void setWidthUndefined()
From source file:de.symeda.sormas.ui.configuration.outbreak.OutbreakRegionConfigurationForm.java
License:Open Source License
private HorizontalLayout createHeader() { HorizontalLayout headerLayout = new HorizontalLayout(); headerLayout.setWidth(100, Unit.PERCENTAGE); headerLayout.setSpacing(true);/*from www .j a v a2 s.com*/ CssStyles.style(headerLayout, CssStyles.VSPACE_2); // Headline and info text Label infoTextLabel = new Label(I18nProperties.getString(Strings.headingDefineOutbreakDistricts)); infoTextLabel.setWidthUndefined(); CssStyles.style(infoTextLabel, CssStyles.VSPACE_TOP_4); headerLayout.addComponent(infoTextLabel); // Number of affected districts and options to toggle outbreak mode for all districts HorizontalLayout allDistrictsLayout = new HorizontalLayout(); allDistrictsLayout.setWidthUndefined(); allDistrictsLayout.setSpacing(true); { Label allDistrictsLabel = new Label(I18nProperties.getString(Strings.headingSetOutbreakStatus)); allDistrictsLabel.setWidthUndefined(); CssStyles.style(allDistrictsLabel, CssStyles.VSPACE_TOP_4); allDistrictsLayout.addComponent(allDistrictsLabel); OptionGroup outbreakToggle = new OptionGroup(); CssStyles.style(outbreakToggle, ValoTheme.OPTIONGROUP_HORIZONTAL, CssStyles.OPTIONGROUP_HORIZONTAL_SWITCH_CRITICAL); outbreakToggle.addItem(OUTBREAK); outbreakToggle.addItem(NORMAL); if (affectedDistricts.isEmpty()) { outbreakToggle.setValue(NORMAL); } else if (affectedDistricts.size() == totalDistricts) { outbreakToggle.setValue(OUTBREAK); } outbreakToggle.addValueChangeListener(e -> { for (OptionGroup districtOutbreakToggle : outbreakToggles) { districtOutbreakToggle.setValue(e.getProperty().getValue()); } }); outbreakToggle.setWidthUndefined(); allDistrictsLayout.addComponent(outbreakToggle); affectedDistrictsNumberLabel = new Label(); affectedDistrictsNumberLabel.setWidthUndefined(); allDistrictsLayout.addComponent(affectedDistrictsNumberLabel); } headerLayout.addComponent(allDistrictsLayout); headerLayout.setComponentAlignment(allDistrictsLayout, Alignment.TOP_RIGHT); headerLayout.setExpandRatio(infoTextLabel, 1); return headerLayout; }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsDiseaseElement.java
License:Open Source License
public DashboardStatisticsDiseaseElement(String caption, int count, int previousCount) { setMargin(false);//from w w w. java 2s . c o m setSpacing(true); Label captionLabel = new Label(caption); captionLabel.setWidthUndefined(); CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD, CssStyles.LABEL_LARGE); addComponent(captionLabel); Label lineLabel = new Label(" ", ContentMode.HTML); CssStyles.style(lineLabel, CssStyles.LABEL_BOTTOM_LINE); addComponent(lineLabel); Label countLabel = new Label(Integer.toString(count)); countLabel.setWidthUndefined(); CssStyles.style(countLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD, CssStyles.LABEL_LARGE); addComponent(countLabel); Label growthLabel = new Label(); growthLabel.setContentMode(ContentMode.HTML); growthLabel.setWidth(15, Unit.PIXELS); CssStyles.removeStyles(growthLabel, CssStyles.LABEL_CRITICAL, CssStyles.LABEL_POSITIVE, CssStyles.LABEL_IMPORTANT); if (count > previousCount) { growthLabel.setValue(VaadinIcons.CHEVRON_UP.getHtml()); CssStyles.style(growthLabel, CssStyles.LABEL_CRITICAL); } else if (count == previousCount) { growthLabel.setValue(VaadinIcons.CHEVRON_RIGHT.getHtml()); CssStyles.style(growthLabel, CssStyles.LABEL_IMPORTANT, CssStyles.ALIGN_CENTER); } else { growthLabel.setValue(VaadinIcons.CHEVRON_DOWN.getHtml()); CssStyles.style(growthLabel, CssStyles.LABEL_POSITIVE); } CssStyles.style(growthLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_LARGE); addComponent(growthLabel); setExpandRatio(lineLabel, 1); }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsPercentageElement.java
License:Open Source License
public DashboardStatisticsPercentageElement(String caption, String svgFillClass) { this.setMargin(false); this.setSpacing(false); HorizontalLayout captionAndValueLayout = new HorizontalLayout(); captionAndValueLayout.setWidth(100, Unit.PERCENTAGE); Label captionLabel = new Label(caption); captionLabel.setWidthUndefined(); CssStyles.style(captionLabel, CssStyles.LABEL_SECONDARY, CssStyles.LABEL_BOLD); captionAndValueLayout.addComponent(captionLabel); percentageLabel = new Label(); CssStyles.style(percentageLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_BOLD); percentageLabel.setWidthUndefined(); captionAndValueLayout.addComponent(percentageLabel); captionAndValueLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT); captionAndValueLayout.setComponentAlignment(percentageLabel, Alignment.MIDDLE_RIGHT); addComponent(captionAndValueLayout); svgBarElement = new SvgBarElement(svgFillClass); svgBarElement.setWidth(100, Unit.PERCENTAGE); addComponent(svgBarElement);/* w ww . j a v a 2 s. c o m*/ }
From source file:de.symeda.sormas.ui.importer.ImportPersonSelectField.java
License:Open Source License
@Override protected Component initContent() { if (importedCase == null || importedPerson == null) { return null; }//from w w w . j a va 2 s . c o m VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined(); layout.setWidth(100, Unit.PERCENTAGE); // Info label Label infoLabel = new Label(I18nProperties.getString(Strings.infoImportSimilarity)); CssStyles.style(infoLabel, CssStyles.VSPACE_3); layout.addComponent(infoLabel); // Imported case info VerticalLayout outerCaseInfoLayout = new VerticalLayout(); outerCaseInfoLayout.setWidth(100, Unit.PERCENTAGE); CssStyles.style(outerCaseInfoLayout, CssStyles.BACKGROUND_ROUNDED_CORNERS, CssStyles.BACKGROUND_SUB_CRITERIA, CssStyles.VSPACE_3, "v-scrollable"); Label importedCaseLabel = new Label(I18nProperties.getString(Strings.headingImportedCaseInfo)); CssStyles.style(importedCaseLabel, CssStyles.LABEL_BOLD, CssStyles.VSPACE_4); outerCaseInfoLayout.addComponent(importedCaseLabel); 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(importedCase.getDisease(), importedCase.getDiseaseDetails())); diseaseField.setWidthUndefined(); caseInfoLayout.addComponent(diseaseField); Label caseDateField = new Label(); if (importedCase.getSymptoms().getOnsetDate() != null) { caseDateField.setCaption( I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, SymptomsDto.ONSET_DATE)); caseDateField.setValue(DateHelper.formatLocalShortDate(importedCase.getSymptoms().getOnsetDate())); } else { caseDateField.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REPORT_DATE)); caseDateField.setValue(DateHelper.formatLocalShortDate(importedCase.getReportDate())); } caseDateField.setWidthUndefined(); caseInfoLayout.addComponent(caseDateField); Label regionField = new Label(); regionField.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.REGION)); regionField.setValue(importedCase.getRegion().toString()); regionField.setWidthUndefined(); caseInfoLayout.addComponent(regionField); Label districtField = new Label(); districtField .setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.DISTRICT)); districtField.setValue(importedCase.getDistrict().toString()); districtField.setWidthUndefined(); caseInfoLayout.addComponent(districtField); Label communityField = new Label(); communityField .setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.COMMUNITY)); communityField .setValue(importedCase.getCommunity() != null ? importedCase.getCommunity().toString() : ""); communityField.setWidthUndefined(); caseInfoLayout.addComponent(communityField); Label facilityField = new Label(); facilityField.setCaption( I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.HEALTH_FACILITY)); facilityField.setValue(FacilityHelper.buildFacilityString(null, importedCase.getHealthFacility() != null ? importedCase.getHealthFacility().toString() : "", importedCase.getHealthFacilityDetails())); facilityField.setWidthUndefined(); caseInfoLayout.addComponent(facilityField); } outerCaseInfoLayout.addComponent(caseInfoLayout); layout.addComponent(outerCaseInfoLayout); // Imported person info VerticalLayout outerPersonInfoLayout = new VerticalLayout(); outerPersonInfoLayout.setWidth(100, Unit.PERCENTAGE); CssStyles.style(outerPersonInfoLayout, CssStyles.BACKGROUND_ROUNDED_CORNERS, CssStyles.BACKGROUND_SUB_CRITERIA, CssStyles.VSPACE_3, "v-scrollable"); Label importedPersonLabel = new Label(I18nProperties.getString(Strings.headingImportedPersonInfo)); CssStyles.style(importedPersonLabel, CssStyles.LABEL_BOLD, CssStyles.VSPACE_4); outerPersonInfoLayout.addComponent(importedPersonLabel); HorizontalLayout personInfoLayout = new HorizontalLayout(); personInfoLayout.setSpacing(true); personInfoLayout.setSizeUndefined(); { Label firstNameField = new Label(); firstNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.FIRST_NAME)); firstNameField.setValue(importedPerson.getFirstName()); firstNameField.setWidthUndefined(); personInfoLayout.addComponent(firstNameField); Label lastNameField = new Label(); lastNameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.LAST_NAME)); lastNameField.setValue(importedPerson.getLastName()); lastNameField.setWidthUndefined(); personInfoLayout.addComponent(lastNameField); Label nicknameField = new Label(); nicknameField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.NICKNAME)); nicknameField.setValue(importedPerson.getNickname()); nicknameField.setWidthUndefined(); personInfoLayout.addComponent(nicknameField); Label ageField = new Label(); ageField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.APPROXIMATE_AGE)); ageField.setValue(ApproximateAgeHelper.formatApproximateAge(importedPerson.getApproximateAge(), importedPerson.getApproximateAgeType())); ageField.setWidthUndefined(); personInfoLayout.addComponent(ageField); Label sexField = new Label(); sexField.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.SEX)); sexField.setValue(importedPerson.getSex() != null ? importedPerson.getSex().toString() : ""); sexField.setWidthUndefined(); personInfoLayout.addComponent(sexField); Label presentConditionField = new Label(); presentConditionField.setCaption( I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.PRESENT_CONDITION)); presentConditionField.setValue( importedPerson.getPresentCondition() != null ? importedPerson.getPresentCondition().toString() : null); presentConditionField.setWidthUndefined(); personInfoLayout.addComponent(presentConditionField); Label regionField = new Label(); regionField.setCaption(I18nProperties.getPrefixCaption(LocationDto.I18N_PREFIX, LocationDto.REGION)); regionField.setValue(importedPerson.getAddress().getRegion() != null ? importedPerson.getAddress().getRegion().toString() : ""); regionField.setWidthUndefined(); personInfoLayout.addComponent(regionField); Label districtField = new Label(); districtField .setCaption(I18nProperties.getPrefixCaption(LocationDto.I18N_PREFIX, LocationDto.DISTRICT)); districtField.setValue(importedPerson.getAddress().getDistrict() != null ? importedPerson.getAddress().getDistrict().toString() : ""); districtField.setWidthUndefined(); personInfoLayout.addComponent(districtField); Label communityField = new Label(); communityField .setCaption(I18nProperties.getPrefixCaption(LocationDto.I18N_PREFIX, LocationDto.COMMUNITY)); communityField.setValue(importedPerson.getAddress().getCommunity() != null ? importedPerson.getAddress().getCommunity().toString() : ""); communityField.setWidthUndefined(); personInfoLayout.addComponent(communityField); Label cityField = new Label(); cityField.setCaption(I18nProperties.getPrefixCaption(LocationDto.I18N_PREFIX, LocationDto.CITY)); cityField.setValue(importedPerson.getAddress().getCity()); cityField.setWidthUndefined(); personInfoLayout.addComponent(cityField); } outerPersonInfoLayout.addComponent(personInfoLayout); layout.addComponent(outerPersonInfoLayout); // Person selection/creation selectPerson = new OptionGroup(null); selectPerson.addItem(SELECT_PERSON); selectPerson.setItemCaption(SELECT_PERSON, I18nProperties.getCaption(Captions.personSelect)); CssStyles.style(selectPerson, CssStyles.VSPACE_NONE); selectPerson.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { createNewPerson.setValue(null); personGrid.setEnabled(true); mergeCheckBox.setEnabled(true); if (selectionChangeCallback != null) { selectionChangeCallback.accept(personGrid.getSelectedRow() != null); } } }); layout.addComponent(selectPerson); mergeCheckBox = new CheckBox(); mergeCheckBox.setCaption(I18nProperties.getCaption(Captions.caseImportMergeCase)); CssStyles.style(mergeCheckBox, CssStyles.VSPACE_3); layout.addComponent(mergeCheckBox); initPersonGrid(); // Deselect "create new" when person is selected personGrid.addSelectionListener(e -> { if (e.getSelected().size() > 0) { createNewPerson.setValue(null); } }); CssStyles.style(personGrid, CssStyles.VSPACE_3); layout.addComponent(personGrid); personGrid.addSelectionListener(e -> { if (selectionChangeCallback != null) { selectionChangeCallback.accept(!e.getSelected().isEmpty()); } }); createNewPerson = new OptionGroup(null); createNewPerson.addItem(CREATE_PERSON); createNewPerson.setItemCaption(CREATE_PERSON, I18nProperties.getCaption(Captions.personCreateNew)); // Deselect grid when "create new" is selected createNewPerson.addValueChangeListener(e -> { if (e.getProperty().getValue() != null) { selectPerson.setValue(null); personGrid.select(null); personGrid.setEnabled(false); mergeCheckBox.setEnabled(false); if (selectionChangeCallback != null) { selectionChangeCallback.accept(true); } } }); layout.addComponent(createNewPerson); // Set field values based on internal value setInternalValue(super.getInternalValue()); return layout; }
From source file:de.symeda.sormas.ui.samples.SampleEditForm.java
License:Open Source License
private void initializeRequestedTests() { // Yes/No fields for requesting pathogen/additional tests OptionGroup pathogenTestingRequestedField = addField(SampleDto.PATHOGEN_TESTING_REQUESTED, OptionGroup.class); CssStyles.style(pathogenTestingRequestedField, CssStyles.OPTIONGROUP_CAPTION_AREA_INLINE); pathogenTestingRequestedField.setWidthUndefined(); OptionGroup additionalTestingRequestedField = addField(SampleDto.ADDITIONAL_TESTING_REQUESTED, OptionGroup.class); CssStyles.style(additionalTestingRequestedField, CssStyles.OPTIONGROUP_CAPTION_AREA_INLINE); additionalTestingRequestedField.setWidthUndefined(); // CheckBox groups to select the requested pathogen/additional tests OptionGroup requestedPathogenTestsField = addField(SampleDto.REQUESTED_PATHOGEN_TESTS, OptionGroup.class); CssStyles.style(requestedPathogenTestsField, CssStyles.OPTIONGROUP_CHECKBOXES_HORIZONTAL); requestedPathogenTestsField.setMultiSelect(true); requestedPathogenTestsField.addItems((Object[]) PathogenTestType.values()); requestedPathogenTestsField.removeItem(PathogenTestType.OTHER); requestedPathogenTestsField.setCaption(null); OptionGroup requestedAdditionalTestsField = addField(SampleDto.REQUESTED_ADDITIONAL_TESTS, OptionGroup.class); CssStyles.style(requestedAdditionalTestsField, CssStyles.OPTIONGROUP_CHECKBOXES_HORIZONTAL); requestedAdditionalTestsField.setMultiSelect(true); requestedAdditionalTestsField.addItems((Object[]) AdditionalTestType.values()); requestedAdditionalTestsField.setCaption(null); // Text fields to type in other tests TextField requestedOtherPathogenTests = addField(SampleDto.REQUESTED_OTHER_PATHOGEN_TESTS, TextField.class); TextField requestedOtherAdditionalTests = addField(SampleDto.REQUESTED_OTHER_ADDITIONAL_TESTS, TextField.class); // The code below relies on getValue() to return the sample of the form and therefore has to be delayed until the sample is set addValueChangeListener(e -> {//from w w w .j a v a 2s. c om if (!requestedTestsInitialized) { if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_EDIT_NOT_OWNED) || UserProvider.getCurrent().getUuid().equals(getValue().getReportingUser().getUuid())) { // Information texts for users that can edit the requested tests Label requestedPathogenInfoLabel = new Label( I18nProperties.getString(Strings.infoSamplePathogenTesting)); getContent().addComponent(requestedPathogenInfoLabel, PATHOGEN_TESTING_INFO_LOC); Label requestedAdditionalInfoLabel = new Label( I18nProperties.getString(Strings.infoSampleAdditionalTesting)); getContent().addComponent(requestedAdditionalInfoLabel, ADDITIONAL_TESTING_INFO_LOC); // Set initial visibility requestedPathogenTestsField .setVisible(Boolean.TRUE.equals(getValue().getPathogenTestingRequested())); requestedPathogenInfoLabel .setVisible(Boolean.TRUE.equals(getValue().getPathogenTestingRequested())); requestedOtherPathogenTests .setVisible(Boolean.TRUE.equals(getValue().getPathogenTestingRequested())); // CheckBoxes should be hidden when no tests are requested pathogenTestingRequestedField.addValueChangeListener(f -> { requestedPathogenInfoLabel.setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); requestedPathogenTestsField.setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); requestedOtherPathogenTests.setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); }); if (!UserProvider.getCurrent().hasUserRight(UserRight.ADDITIONAL_TEST_VIEW)) { // Hide additional testing fields when user is not allowed to see them additionalTestingRequestedField.setVisible(false); requestedAdditionalTestsField.setVisible(false); requestedAdditionalInfoLabel.setVisible(false); requestedOtherAdditionalTests.setVisible(false); } else { requestedAdditionalTestsField .setVisible(Boolean.TRUE.equals(getValue().getAdditionalTestingRequested())); requestedAdditionalInfoLabel .setVisible(Boolean.TRUE.equals(getValue().getAdditionalTestingRequested())); requestedOtherAdditionalTests .setVisible(Boolean.TRUE.equals(getValue().getAdditionalTestingRequested())); additionalTestingRequestedField.addValueChangeListener(f -> { requestedAdditionalInfoLabel .setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); requestedAdditionalTestsField .setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); requestedOtherAdditionalTests .setVisible(f.getProperty().getValue().equals(Boolean.TRUE)); }); } } else { // If the user can't edit the sample, they see a read-only list of requested tests setVisible(false, SampleDto.PATHOGEN_TESTING_REQUESTED, SampleDto.ADDITIONAL_TESTING_REQUESTED, SampleDto.REQUESTED_PATHOGEN_TESTS, SampleDto.REQUESTED_ADDITIONAL_TESTS); // Display a label for every requested pathogen test or hide the whole section if no tests have been requested if (Boolean.TRUE.equals(getValue().getPathogenTestingRequested()) && !getValue().getRequestedPathogenTests().isEmpty()) { Label pathogenTestsHeading = new Label( I18nProperties.getString(Strings.headingRequestedPathogenTests)); CssStyles.style(pathogenTestsHeading, CssStyles.LABEL_BOLD, CssStyles.LABEL_SECONDARY, CssStyles.VSPACE_4); getContent().addComponent(pathogenTestsHeading, PATHOGEN_TESTING_READ_HEADLINE_LOC); CssLayout requestedPathogenTestsLayout = new CssLayout(); CssStyles.style(requestedPathogenTestsLayout, CssStyles.VSPACE_3); for (PathogenTestType testType : getValue().getRequestedPathogenTests()) { Label testLabel = new Label(testType.toString()); testLabel.setWidthUndefined(); CssStyles.style(testLabel, CssStyles.LABEL_ROUNDED_CORNERS, CssStyles.LABEL_BACKGROUND_FOCUS_LIGHT, CssStyles.VSPACE_4, CssStyles.HSPACE_RIGHT_4); requestedPathogenTestsLayout.addComponent(testLabel); } getContent().addComponent(requestedPathogenTestsLayout, REQUESTED_PATHOGEN_TESTS_READ_LOC); } // If the user can view additional tests, display a label for every requested additional test // or hide the whole section if no tests have been requested if (UserProvider.getCurrent().hasUserRight(UserRight.ADDITIONAL_TEST_VIEW) && Boolean.TRUE.equals(getValue().getAdditionalTestingRequested()) && !getValue().getRequestedAdditionalTests().isEmpty()) { Label additionalTestsHeading = new Label( I18nProperties.getString(Strings.headingRequestedAdditionalTests)); CssStyles.style(additionalTestsHeading, CssStyles.LABEL_BOLD, CssStyles.LABEL_SECONDARY, CssStyles.VSPACE_4); getContent().addComponent(additionalTestsHeading, ADDITIONAL_TESTING_READ_HEADLINE_LOC); CssLayout requestedAdditionalTestsLayout = new CssLayout(); CssStyles.style(requestedAdditionalTestsLayout, CssStyles.VSPACE_3); for (AdditionalTestType testType : getValue().getRequestedAdditionalTests()) { Label testLabel = new Label(testType.toString()); testLabel.setWidthUndefined(); CssStyles.style(testLabel, CssStyles.LABEL_ROUNDED_CORNERS, CssStyles.LABEL_BACKGROUND_FOCUS_LIGHT, CssStyles.VSPACE_4, CssStyles.HSPACE_RIGHT_4); requestedAdditionalTestsLayout.addComponent(testLabel); } getContent().addComponent(requestedAdditionalTestsLayout, REQUESTED_ADDITIONAL_TESTS_READ_LOC); } } } requestedTestsInitialized = true; }); }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
public StatisticsView() { super(VIEW_NAME); setWidth(100, Unit.PERCENTAGE);/*w ww. j a va2 s . c o m*/ emptyResultLabel = new Label(I18nProperties.getString(Strings.infoNoCasesFoundStatistics)); // Main layout VerticalLayout statisticsLayout = new VerticalLayout(); statisticsLayout.setMargin(true); statisticsLayout.setSpacing(true); statisticsLayout.setWidth(100, Unit.PERCENTAGE); // Filters layout addFiltersLayout(statisticsLayout); // Visualization layout Label visualizationTitle = new Label(I18nProperties.getString(Strings.headingVisualization)); visualizationTitle.setWidthUndefined(); CssStyles.style(visualizationTitle, CssStyles.STATISTICS_TITLE); statisticsLayout.addComponent(visualizationTitle); visualizationComponent = new StatisticsVisualizationComponent(); CssStyles.style(visualizationComponent, CssStyles.STATISTICS_TITLE_BOX); statisticsLayout.addComponent(visualizationComponent); // Options layout addOptionsLayout(statisticsLayout); // Generate button addGenerateButton(statisticsLayout); // Results layout addResultsLayout(statisticsLayout); // Disclaimer Label disclaimer = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " " + I18nProperties.getString(Strings.infoStatisticsDisclaimer), ContentMode.HTML); statisticsLayout.addComponent(disclaimer); addComponent(statisticsLayout); }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
private void addFiltersLayout(VerticalLayout statisticsLayout) { Label filtersLayoutTitle = new Label(I18nProperties.getString(Strings.headingFilters)); filtersLayoutTitle.setWidthUndefined(); CssStyles.style(filtersLayoutTitle, CssStyles.STATISTICS_TITLE); statisticsLayout.addComponent(filtersLayoutTitle); VerticalLayout filtersSectionLayout = new VerticalLayout(); CssStyles.style(filtersSectionLayout, CssStyles.STATISTICS_TITLE_BOX); filtersSectionLayout.setSpacing(true); filtersSectionLayout.setWidth(100, Unit.PERCENTAGE); Label filtersInfoText = new Label(I18nProperties.getString(Strings.infoStatisticsFilter), ContentMode.HTML); filtersSectionLayout.addComponent(filtersInfoText); filtersLayout = new VerticalLayout(); filtersLayout.setSpacing(true);/*from w ww. j ava 2 s. c o m*/ filtersLayout.setMargin(false); filtersSectionLayout.addComponent(filtersLayout); // Filters footer HorizontalLayout filtersSectionFooter = new HorizontalLayout(); { filtersSectionFooter.setSpacing(true); Button addFilterButton = new Button(I18nProperties.getCaption(Captions.statisticsAddFilter), VaadinIcons.PLUS); CssStyles.style(addFilterButton, ValoTheme.BUTTON_PRIMARY); addFilterButton.addClickListener(e -> { filtersLayout.addComponent(createFilterComponentLayout()); }); filtersSectionFooter.addComponent(addFilterButton); Button resetFiltersButton = new Button(I18nProperties.getCaption(Captions.statisticsResetFilters)); resetFiltersButton.addClickListener(e -> { filtersLayout.removeAllComponents(); filterComponents.clear(); }); filtersSectionFooter.addComponent(resetFiltersButton); } filtersSectionLayout.addComponent(filtersSectionFooter); statisticsLayout.addComponent(filtersSectionLayout); }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
private void addResultsLayout(VerticalLayout statisticsLayout) { Label resultsLayoutTitle = new Label(I18nProperties.getString(Strings.headingResults)); resultsLayoutTitle.setWidthUndefined(); CssStyles.style(resultsLayoutTitle, CssStyles.STATISTICS_TITLE); statisticsLayout.addComponent(resultsLayoutTitle); resultsLayout = new VerticalLayout(); resultsLayout.setWidth(100, Unit.PERCENTAGE); resultsLayout.setSpacing(true);/*from ww w . j a v a2s .c o m*/ CssStyles.style(resultsLayout, CssStyles.STATISTICS_TITLE_BOX); resultsLayout.addComponent(new Label(I18nProperties.getString(Strings.infoStatisticsResults))); statisticsLayout.addComponent(resultsLayout); }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
private void addOptionsLayout(VerticalLayout statisticsLayout) { Label optionsTitle = new Label(I18nProperties.getCaption(Captions.options)); optionsTitle.setWidthUndefined(); CssStyles.style(optionsTitle, CssStyles.STATISTICS_TITLE); statisticsLayout.addComponent(optionsTitle); HorizontalLayout optionsLayout = new HorizontalLayout(); optionsLayout.setWidth(100, Unit.PERCENTAGE); optionsLayout.setSpacing(true);/*w w w. j a v a2 s . co m*/ CssStyles.style(optionsLayout, CssStyles.STATISTICS_TITLE_BOX); { zeroValues = new CheckBox(I18nProperties.getCaption(Captions.statisticsShowZeroValues)); zeroValues.setValue(false); optionsLayout.addComponent(zeroValues); } statisticsLayout.addComponent(optionsLayout); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AuthorThisPlanPopup.java
License:Open Source License
@SuppressWarnings("serial") public AuthorThisPlanPopup(Object apPlnId) { super(null);/* w w w. j a v a 2 s. c o m*/ super.initGui(); this.apId = apPlnId; setListener(this); setTitleString("Author This Plan"); contentVLayout.setSpacing(true); Label lab; contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); contentVLayout.addComponent(lab = new Label("Become an author of this plan?")); lab.addStyleName("m-dialog-text"); lab.setWidthUndefined(); contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); HorizontalLayout buttHL = new HorizontalLayout(); contentVLayout.addComponent(buttHL); contentVLayout.setComponentAlignment(buttHL, Alignment.MIDDLE_CENTER); buttHL.setSpacing(true); buttHL.addComponent(okButt = new Button("Yes, I'm in.")); buttHL.addComponent(noButt = new Button("I'll pass.")); noButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed @HibernateUpdate @HibernateUserUpdate public void buttonClick(ClickEvent event) { HSess.init(); User me = Mmowgli2UI.getGlobals().getUserTL(); ActionPlan ap = ActionPlan.getTL(apId); if (usrContainsByIds(ap.getInvitees(), me)) ap.removeInvitee(me); if (!usrContainsByIds(ap.getDeclinees(), me)) ap.getDeclinees().add(me); ActionPlan.updateTL(ap); if (apContainsByIds(me.getActionPlansInvited(), ap)) me.getActionPlansInvited().remove(ap); User.updateTL(me); GameEventLogger.logActionPlanInvitationDeclinedTL(ap, me.getUserName()); HSess.close(); AuthorThisPlanPopup.this.buttonClick(event); } }); okButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed @HibernateUpdate @HibernateUserUpdate public void buttonClick(ClickEvent event) { HSess.init(); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); User me = globs.getUserTL(); //feb refactor DBGet.getUserFreshTL(globs.getUserID()); ActionPlan thisAp = ActionPlan.getTL(apId); Set<ActionPlan> myInvites = me.getActionPlansInvited(); Set<ActionPlan> myAuthored = me.getActionPlansAuthored(); boolean usrNeedsUpdate = false; if (apContainsByIds(myInvites, thisAp)) { //System.out.println("AP-AUTHOR_DEBUG: removing aplan from users invite list, AuthorThisPlanPopup.128"); myInvites.remove(thisAp); // Jam it in here //ScoreManager.userJoinsActionPlan(me); // replace by... globs.getScoreManager().actionPlanUserJoinsTL(thisAp, me); usrNeedsUpdate = true; } if (!apContainsByIds(myAuthored, thisAp)) {// if already there, causes exception //System.out.println("AP-AUTHOR_DEBUG: adding aplan to users authored list, AuthorThisPlanPopup.133"); myAuthored.add(thisAp); usrNeedsUpdate = true; } if (usrNeedsUpdate) { // User update here User.updateTL(me); } boolean apNeedsUpdate = false; if (usrContainsByIds(thisAp.getInvitees(), me)) { //System.out.println("AP-AUTHOR_DEBUG: removing user from ap invite list, AuthorThisPlanPopup.146"); thisAp.removeInvitee(me); //apInvitees.remove(me); apNeedsUpdate = true; } if (!usrContainsByIds(thisAp.getAuthors(), me)) { //System.out.println("AP-AUTHOR_DEBUG: adding user to ap authors list, AuthorThisPlanPopup.151"); thisAp.addAuthor(me); //apAuthors.add(me); apNeedsUpdate = true; } if (apNeedsUpdate) ActionPlan.updateTL(thisAp); GameEventLogger.logActionPlanInvitationAcceptedTL(thisAp, me.getUserName()); HSess.close(); AuthorThisPlanPopup.this.buttonClick(event); // sets up its own session return; } }); }