List of usage examples for com.vaadin.ui Label setDescription
public void setDescription(String description)
From source file:de.catma.ui.tagger.TaggerView.java
License:Open Source License
private void initComponents(Application application) { setSizeFull();/* w w w. ja v a 2 s . c om*/ VerticalLayout taggerPanel = new VerticalLayout(); taggerPanel.setSpacing(true); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", application)); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tag this Source Document</h4>" + "<ol><li>First you have to tell CATMA which Tagset you want to use. " + "Open a Tag Library from the Repository Manager and drag a Tagset to the \"Active Tagsets\" section.</li>" + "<li>Now you can mark the text sequence you want to tag.</li><li>Click the colored button of the desired Tag to apply it to the marked sequence.</li></ol> " + "When you click on a tagged text, i. e. a text that is underlined with colored bars, you should see " + "the available Tag Instances in the section on the lower right of this view."); pager = new Pager(taggerID, 80, 30); tagger = new Tagger(taggerID, pager, this); tagger.addStyleName("tagger"); tagger.setWidth("550px"); taggerPanel.addComponent(tagger); // Panel actionPanel = new Panel(new HorizontalLayout()); // ((HorizontalLayout)actionPanel.getContent()).setSpacing(true); HorizontalLayout actionPanel = new HorizontalLayout(); actionPanel.setSpacing(true); taggerPanel.addComponent(actionPanel); pagerComponent = new PagerComponent(pager, new PageChangeListener() { public void pageChanged(int number) { tagger.setPage(number); } }); actionPanel.addComponent(helpLabel); actionPanel.addComponent(pagerComponent); btAnalyze = new Button("Analyze Document"); btAnalyze.setEnabled(repository instanceof IndexedRepository); actionPanel.addComponent(btAnalyze); linesPerPageSlider = new Slider("page size zoom", 1, 100, "%"); linesPerPageSlider.setImmediate(true); linesPerPageSlider.setWidth("150px"); actionPanel.addComponent(linesPerPageSlider); markupPanel = new MarkupPanel(repository, new ColorButtonListener() { private boolean enabled = false; public void colorButtonClicked(TagDefinition tagDefinition) { if (enabled) { tagger.addTagInstanceWith(tagDefinition); } else { getWindow().showNotification( "Information", "Please select a User Markup Collection " + " to store your markup first!<br>" + "See 'Active Markup Collections'.", Notification.TYPE_TRAY_NOTIFICATION); } } public void setEnabled(boolean enabled) { this.enabled = enabled; } }, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { boolean selected = evt.getNewValue() != null; @SuppressWarnings("unchecked") List<TagReference> tagReferences = (List<TagReference>) (selected ? evt.getNewValue() : evt.getOldValue()); tagger.setVisible(tagReferences, selected); } }, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { @SuppressWarnings("unchecked") Set<TagDefinition> removedTagDefinitions = (Set<TagDefinition>) evt.getOldValue(); pager.removeTagInstances(removedTagDefinitions); tagger.setPage(pager.getCurrentPageNumber()); } }); HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.addComponent(taggerPanel); splitPanel.addComponent(markupPanel); addComponent(splitPanel); }
From source file:de.datenhahn.vaadin.componentrenderer.demo.ResourceBundleComponentHeaderGenerator.java
License:Apache License
@Override public Component getHeader(Object propertyId) { Label headerLabel = new Label(resourceBundle.getString(propertyId + "")); headerLabel.setDescription(resourceBundle.getString(propertyId + "")); return headerLabel; }
From source file:de.symeda.sormas.ui.dashboard.contacts.ContactsDashboardStatisticsComponent.java
License:Open Source License
@Override protected void addThirdComponent() { thirdComponent = new DashboardStatisticsSubComponent(); // Header//from w ww . j a v a2s . c om thirdComponent.addHeader(I18nProperties.getString(Strings.headingFollowUpSituation), null, false); // Visit status of last visit thirdComponent.addMainContent(); CssLayout visitStatusCountLayout = thirdComponent.createCountLayout(true); cooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardCooperative), CountElementStyle.POSITIVE); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, cooperativeContacts); uncooperativeContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUncooperative), CountElementStyle.CRITICAL); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, uncooperativeContacts); unavailableContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardUnavailable), CountElementStyle.RELEVANT); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, unavailableContacts); neverVisitedContacts = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardNeverVisited), CountElementStyle.MINOR); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, neverVisitedContacts); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); infoLabel.setDescription(I18nProperties.getDescription(Descriptions.descDashboardFollowUpInfo)); CssStyles.style(infoLabel, CssStyles.LABEL_LARGE, CssStyles.LABEL_SECONDARY, "follow-up-status-info-button"); thirdComponent.addComponentToCountLayout(visitStatusCountLayout, infoLabel); thirdComponent.addComponentToContent(visitStatusCountLayout); // Number of missed visits Label missedVisitsLabel = new Label(I18nProperties.getCaption(Captions.dashboardNotVisitedFor)); CssStyles.style(missedVisitsLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_UPPERCASE, CssStyles.LABEL_BACKGROUND_FOCUS_LIGHT, CssStyles.LABEL_ROUNDED_CORNERS_SLIM); thirdComponent.addComponentToContent(missedVisitsLabel); CssLayout missedVisitsCountLayout = thirdComponent.createCountLayout(false); missedVisitsOneDay = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardOneDay), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsOneDay); missedVisitsTwoDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardTwoDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsTwoDays); missedVisitsThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsThreeDays); missedVisitsGtThreeDays = new DashboardStatisticsCountElement( I18nProperties.getCaption(Captions.dashboardGtThreeDays), CountElementStyle.PRIMARY); thirdComponent.addComponentToCountLayout(missedVisitsCountLayout, missedVisitsGtThreeDays); thirdComponent.addComponentToContent(missedVisitsCountLayout); subComponentsLayout.addComponent(thirdComponent, THIRD_LOC); }
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
private HorizontalLayout createFooter() { HorizontalLayout mapFooterLayout = new HorizontalLayout(); mapFooterLayout.setWidth(100, Unit.PERCENTAGE); mapFooterLayout.setSpacing(true);//from w w w. j a v a 2 s . c om CssStyles.style(mapFooterLayout, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_3); // Map key dropdown button legendDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapKey)); CssStyles.style(legendDropdown, CssStyles.BUTTON_SUBTLE); legendDropdown.setContent(createLegend()); mapFooterLayout.addComponent(legendDropdown); mapFooterLayout.setComponentAlignment(legendDropdown, Alignment.MIDDLE_RIGHT); mapFooterLayout.setExpandRatio(legendDropdown, 1); // Layers dropdown button PopupButton layersDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapLayers)); { CssStyles.style(layersDropdown, CssStyles.BUTTON_SUBTLE); VerticalLayout layersLayout = new VerticalLayout(); layersLayout.setMargin(true); layersLayout.setSpacing(false); layersLayout.setSizeUndefined(); layersDropdown.setContent(layersLayout); // Add check boxes and apply button { OptionGroup mapCaseDisplayModeSelect = new OptionGroup(); mapCaseDisplayModeSelect.setWidth(100, Unit.PERCENTAGE); mapCaseDisplayModeSelect.addItems((Object[]) MapCaseDisplayMode.values()); mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode); mapCaseDisplayModeSelect.addValueChangeListener(event -> { mapCaseDisplayMode = (MapCaseDisplayMode) event.getProperty().getValue(); refreshMap(); }); HorizontalLayout showCasesLayout = new HorizontalLayout(); { showCasesLayout.setMargin(false); showCasesLayout.setSpacing(false); CheckBox showCasesCheckBox = new CheckBox(); showCasesCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowCases)); showCasesCheckBox.setValue(showCases); showCasesCheckBox.addValueChangeListener(e -> { showCases = (boolean) e.getProperty().getValue(); mapCaseDisplayModeSelect.setEnabled(showCases); mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode); refreshMap(); }); showCasesLayout.addComponent(showCasesCheckBox); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseMap)); CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY, CssStyles.HSPACE_LEFT_3); infoLabel.setHeightUndefined(); showCasesLayout.addComponent(infoLabel); showCasesLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER); } layersLayout.addComponent(showCasesLayout); layersLayout.addComponent(mapCaseDisplayModeSelect); mapCaseDisplayModeSelect.setEnabled(showCases); CheckBox showConfirmedContactsCheckBox = new CheckBox(); CheckBox showUnconfirmedContactsCheckBox = new CheckBox(); CheckBox showContactsCheckBox = new CheckBox(); showContactsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowContacts)); showContactsCheckBox.setValue(showContacts); showContactsCheckBox.addValueChangeListener(e -> { showContacts = (boolean) e.getProperty().getValue(); showConfirmedContactsCheckBox.setEnabled(showContacts); showConfirmedContactsCheckBox.setValue(true); showUnconfirmedContactsCheckBox.setEnabled(showContacts); showUnconfirmedContactsCheckBox.setValue(true); refreshMap(); }); layersLayout.addComponent(showContactsCheckBox); showConfirmedContactsCheckBox .setCaption(I18nProperties.getCaption(Captions.dashboardShowConfirmedContacts)); showConfirmedContactsCheckBox.setValue(showConfirmedContacts); showConfirmedContactsCheckBox.addValueChangeListener(e -> { showConfirmedContacts = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showConfirmedContactsCheckBox); CssStyles.style(showUnconfirmedContactsCheckBox, CssStyles.VSPACE_3); showUnconfirmedContactsCheckBox .setCaption(I18nProperties.getCaption(Captions.dashboardShowUnconfirmedContacts)); showUnconfirmedContactsCheckBox.setValue(showUnconfirmedContacts); showUnconfirmedContactsCheckBox.addValueChangeListener(e -> { showUnconfirmedContacts = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showUnconfirmedContactsCheckBox); showConfirmedContactsCheckBox.setEnabled(showContacts); showUnconfirmedContactsCheckBox.setEnabled(showContacts); CheckBox showEventsCheckBox = new CheckBox(); CssStyles.style(showEventsCheckBox, CssStyles.VSPACE_3); showEventsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowEvents)); showEventsCheckBox.setValue(showEvents); showEventsCheckBox.addValueChangeListener(e -> { showEvents = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showEventsCheckBox); if (UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_USER) || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_CLINICIAN) || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_OBSERVER)) { OptionGroup regionMapVisualizationSelect = new OptionGroup(); regionMapVisualizationSelect.setWidth(100, Unit.PERCENTAGE); regionMapVisualizationSelect.addItems((Object[]) CaseMeasure.values()); regionMapVisualizationSelect.setValue(caseMeasure); regionMapVisualizationSelect.addValueChangeListener(event -> { caseMeasure = (CaseMeasure) event.getProperty().getValue(); refreshMap(); }); HorizontalLayout showRegionsLayout = new HorizontalLayout(); { showRegionsLayout.setMargin(false); showRegionsLayout.setSpacing(false); CheckBox showRegionsCheckBox = new CheckBox(); showRegionsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowRegions)); showRegionsCheckBox.setValue(showRegions); showRegionsCheckBox.addValueChangeListener(e -> { showRegions = (boolean) e.getProperty().getValue(); regionMapVisualizationSelect.setEnabled(showRegions); regionMapVisualizationSelect.setValue(caseMeasure); refreshMap(); }); showRegionsLayout.addComponent(showRegionsCheckBox); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseIncidence)); CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY, CssStyles.HSPACE_LEFT_3); infoLabel.setHeightUndefined(); showRegionsLayout.addComponent(infoLabel); showRegionsLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER); } layersLayout.addComponent(showRegionsLayout); layersLayout.addComponent(regionMapVisualizationSelect); regionMapVisualizationSelect.setEnabled(showRegions); } } } mapFooterLayout.addComponent(layersDropdown); mapFooterLayout.setComponentAlignment(layersDropdown, Alignment.MIDDLE_RIGHT); return mapFooterLayout; }
From source file:de.symeda.sormas.ui.reports.ReportsView.java
License:Open Source License
public HorizontalLayout createFilterBar() { HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false);//ww w.j a v a2 s . com filterLayout.setSpacing(true); filterLayout.addStyleName(CssStyles.VSPACE_3); filterLayout.setWidth(100, Unit.PERCENTAGE); EpiWeek prevEpiWeek = DateHelper.getPreviousEpiWeek(new Date()); int year = prevEpiWeek.getYear(); int week = prevEpiWeek.getWeek(); yearFilter = new ComboBox(); yearFilter.setWidth(200, Unit.PIXELS); yearFilter.addItems(DateHelper.getYearsToNow()); yearFilter.select(year); yearFilter.setCaption(I18nProperties.getString(Strings.year)); yearFilter.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING); yearFilter.addValueChangeListener(e -> { updateEpiWeeks((int) e.getProperty().getValue(), (int) epiWeekFilter.getValue()); reloadGrid(); }); filterLayout.addComponent(yearFilter); epiWeekFilter = new ComboBox(); epiWeekFilter.setWidth(200, Unit.PIXELS); updateEpiWeeks(year, week); epiWeekFilter.setCaption(I18nProperties.getString(Strings.epiWeek)); epiWeekFilter.addValueChangeListener(e -> { reloadGrid(); }); filterLayout.addComponent(epiWeekFilter); Button lastWeekButton = new Button(I18nProperties.getCaption(Captions.dashboardLastWeek)); lastWeekButton.addStyleName(CssStyles.FORCE_CAPTION); lastWeekButton.addClickListener(e -> { EpiWeek epiWeek = DateHelper.getPreviousEpiWeek(new Date()); yearFilter.select(epiWeek.getYear()); epiWeekFilter.select(epiWeek.getWeek()); }); filterLayout.addComponent(lastWeekButton); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoWeeklyReportsView)); infoLabel.setSizeUndefined(); CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY); filterLayout.addComponent(infoLabel); filterLayout.setComponentAlignment(infoLabel, Alignment.MIDDLE_RIGHT); filterLayout.setExpandRatio(infoLabel, 1); return filterLayout; }
From source file:de.symeda.sormas.ui.samples.PathogenTestListEntry.java
License:Open Source License
public PathogenTestListEntry(PathogenTestDto pathogenTest) { setSpacing(true);/*from w w w .j av a 2 s . c om*/ setMargin(false); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST_ENTRY); this.pathogenTest = pathogenTest; VerticalLayout labelLayout = new VerticalLayout(); labelLayout.setSpacing(false); labelLayout.setMargin(false); labelLayout.setWidth(100, Unit.PERCENTAGE); addComponent(labelLayout); setExpandRatio(labelLayout, 1); HorizontalLayout topLabelLayout = new HorizontalLayout(); topLabelLayout.setSpacing(false); topLabelLayout.setMargin(false); topLabelLayout.setWidth(100, Unit.PERCENTAGE); labelLayout.addComponent(topLabelLayout); Label labelTopLeft = new Label( PathogenTestType.toString(pathogenTest.getTestType(), pathogenTest.getTestTypeText())); CssStyles.style(labelTopLeft, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); topLabelLayout.addComponent(labelTopLeft); if (pathogenTest.getTestResultVerified()) { Label labelTopRight = new Label(VaadinIcons.CHECK_CIRCLE.getHtml(), ContentMode.HTML); labelTopRight.setSizeUndefined(); labelTopRight.addStyleName(CssStyles.LABEL_LARGE); labelTopRight.setDescription(I18nProperties.getPrefixCaption(PathogenTestDto.I18N_PREFIX, PathogenTestDto.TEST_RESULT_VERIFIED)); topLabelLayout.addComponent(labelTopRight); topLabelLayout.setComponentAlignment(labelTopRight, Alignment.TOP_RIGHT); } if (!DataHelper.isNullOrEmpty(pathogenTest.getTestResultText())) { Label resultTextLabel = new Label(pathogenTest.getTestResultText()); labelLayout.addComponent(resultTextLabel); } HorizontalLayout middleLabelLayout = new HorizontalLayout(); middleLabelLayout.setSpacing(false); middleLabelLayout.setMargin(false); middleLabelLayout.setWidth(100, Unit.PERCENTAGE); labelLayout.addComponent(middleLabelLayout); Label labelLeft = new Label(DataHelper.toStringNullable( DiseaseHelper.toString(pathogenTest.getTestedDisease(), pathogenTest.getTestedDiseaseDetails()))); middleLabelLayout.addComponent(labelLeft); Label labelRight = new Label(DateHelper.formatLocalShortDateTime(pathogenTest.getTestDateTime())); labelRight.addStyleName(CssStyles.ALIGN_RIGHT); middleLabelLayout.addComponent(labelRight); middleLabelLayout.setComponentAlignment(labelRight, Alignment.TOP_RIGHT); Label labelBottom = new Label(DataHelper.toStringNullable(pathogenTest.getTestResult())); CssStyles.style(labelBottom, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE); if (pathogenTest.getTestResult() == PathogenTestResultType.POSITIVE) CssStyles.style(labelBottom, CssStyles.LABEL_CRITICAL); else CssStyles.style(labelBottom, CssStyles.LABEL_WARNING); labelLayout.addComponent(labelBottom); }
From source file:de.symeda.sormas.ui.utils.EpiWeekAndDateFilterComponent.java
License:Open Source License
public EpiWeekAndDateFilterComponent(Button applyButton, boolean fillAutomatically, boolean showCaption, String infoText, Class<E> dateType, String dateTypePrompt, Enum<E> defaultDateType) { setSpacing(true);/*from w ww . j a va 2 s . c o m*/ Calendar c = Calendar.getInstance(); c.setTime(new Date()); dateFilterOptionFilter = new ComboBox(); dateTypeSelector = new ComboBox(); weekFromFilter = new ComboBox(); weekToFilter = new ComboBox(); dateFromFilter = new PopupDateField(); dateToFilter = new PopupDateField(); // Date filter options dateFilterOptionFilter.setWidth(200, Unit.PIXELS); dateFilterOptionFilter.addItems((Object[]) DateFilterOption.values()); dateFilterOptionFilter.setNullSelectionAllowed(false); dateFilterOptionFilter.select(DateFilterOption.EPI_WEEK); if (showCaption) { CssStyles.style(dateFilterOptionFilter, CssStyles.FORCE_CAPTION); } dateFilterOptionFilter.addValueChangeListener(e -> { if (e.getProperty().getValue() == DateFilterOption.DATE) { int newIndex = getComponentIndex(weekFromFilter); removeComponent(weekFromFilter); removeComponent(weekToFilter); addComponent(dateFromFilter, newIndex); addComponent(dateToFilter, newIndex + 1); if (fillAutomatically) { dateFromFilter.setValue(DateHelper.subtractDays(c.getTime(), 7)); } if (fillAutomatically) { dateToFilter.setValue(c.getTime()); } } else { int newIndex = getComponentIndex(dateFromFilter); removeComponent(dateFromFilter); removeComponent(dateToFilter); addComponent(weekFromFilter, newIndex); addComponent(weekToFilter, newIndex + 1); if (fillAutomatically) { weekFromFilter.setValue(DateHelper.getEpiWeek(c.getTime())); } if (fillAutomatically) { weekToFilter.setValue(DateHelper.getEpiWeek(c.getTime())); } } }); addComponent(dateFilterOptionFilter); // New case date type selector if (dateType != null) { dateTypeSelector.setWidth(200, Unit.PIXELS); dateTypeSelector.addItems((Object[]) dateType.getEnumConstants()); if (dateTypePrompt != null) { dateTypeSelector.setInputPrompt(dateTypePrompt); } if (defaultDateType != null) { dateTypeSelector.select(defaultDateType); } if (showCaption) { CssStyles.style(dateTypeSelector, CssStyles.FORCE_CAPTION); } addComponent(dateTypeSelector); if (!StringUtils.isEmpty(infoText)) { Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setSizeUndefined(); infoLabel.setDescription(infoText); CssStyles.style(infoLabel, CssStyles.LABEL_XLARGE, CssStyles.LABEL_SECONDARY); addComponent(infoLabel); } } // Epi week filter List<EpiWeek> epiWeekList = DateHelper.createEpiWeekList(c.get(Calendar.YEAR), c.get(Calendar.WEEK_OF_YEAR)); weekFromFilter.setWidth(200, Unit.PIXELS); for (EpiWeek week : epiWeekList) { weekFromFilter.addItem(week); } weekFromFilter.setNullSelectionAllowed(false); if (fillAutomatically) { weekFromFilter.setValue(DateHelper.getEpiWeek(c.getTime())); } if (showCaption) { weekFromFilter.setCaption(I18nProperties.getCaption(Captions.epiWeekFrom)); } if (applyButton != null) { weekFromFilter.addValueChangeListener(e -> { applyButton.addStyleName(ValoTheme.BUTTON_PRIMARY); }); } addComponent(weekFromFilter); weekToFilter.setWidth(200, Unit.PIXELS); for (EpiWeek week : epiWeekList) { weekToFilter.addItem(week); } weekToFilter.setNullSelectionAllowed(false); if (fillAutomatically) { weekToFilter.setValue(DateHelper.getEpiWeek(c.getTime())); } if (showCaption) { weekToFilter.setCaption(I18nProperties.getCaption(Captions.epiWeekTo)); } if (applyButton != null) { weekToFilter.addValueChangeListener(e -> { applyButton.addStyleName(ValoTheme.BUTTON_PRIMARY); }); } addComponent(weekToFilter); // Date filter dateFromFilter.setWidth(200, Unit.PIXELS); if (showCaption) { dateFromFilter.setCaption(I18nProperties.getCaption(Captions.from)); } if (applyButton != null) { dateFromFilter.addValueChangeListener(e -> { applyButton.addStyleName(ValoTheme.BUTTON_PRIMARY); }); } dateToFilter.setWidth(200, Unit.PIXELS); if (showCaption) { dateToFilter.setCaption(I18nProperties.getCaption(Captions.to)); } if (applyButton != null) { dateToFilter.addValueChangeListener(e -> { applyButton.addStyleName(ValoTheme.BUTTON_PRIMARY); }); } }
From source file:edu.kit.dama.ui.admin.administration.user.MembershipRoleEditorWindow.java
License:Apache License
/** * Get the memberships table./* w w w. ja v a 2 s.c o m*/ * * @return The memberships table. */ private Table getMembershipsTable() { if (membershipsTable == null) { String id = "membershipsTable"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); membershipsTable = new Table(); membershipsTable.setId(DEBUG_ID_PREFIX + id); membershipsTable.setSizeFull(); membershipsTable.setSelectable(true); membershipsTable.setMultiSelect(true); IndexedContainer c = new IndexedContainer(); c.addContainerProperty(NAME_COLUMN_ID, String.class, null); c.addContainerProperty(ROLE_COLUMN_ID, Role.class, null); c.addContainerProperty(INFO_COLUMN_ID, String.class, null); membershipsTable.setContainerDataSource(c); membershipsTable.setColumnHeader(NAME_COLUMN_ID, "Group Name"); membershipsTable.setColumnHeader(ROLE_COLUMN_ID, "Role"); membershipsTable.setColumnHeader(INFO_COLUMN_ID, "Info"); membershipsTable.addGeneratedColumn(ROLE_COLUMN_ID, (Table source, Object itemId, Object columnId) -> { Role role = (Role) source.getContainerDataSource().getContainerProperty(itemId, columnId) .getValue(); Label cellContent = new Label(); if (role != null && role.moreThan(Role.NO_ACCESS)) { cellContent.addStyleName(CSSTokenContainer.GREEN_BOLD_CENTERED_LABEL); cellContent.setValue(role.toString()); } else if (role != null && !role.moreThan(Role.NO_ACCESS)) { cellContent.addStyleName(CSSTokenContainer.RED_BOLD_CENTERED_LABEL); cellContent.setValue(role.toString()); } else { cellContent.addStyleName(CSSTokenContainer.ORANGE_BOLD_CENTERED_LABEL); cellContent.setValue("NO MEMBER"); } return cellContent; }); membershipsTable.addGeneratedColumn(INFO_COLUMN_ID, (Table source, Object itemId, Object columnId) -> { String value = (String) source.getContainerDataSource().getContainerProperty(itemId, columnId) .getValue(); Label cellContent = new Label(); cellContent.addStyleName(CSSTokenContainer.RED_BOLD_CENTERED_LABEL); if (value != null) { cellContent.setValue("!"); cellContent.setDescription(value); } else { cellContent.setValue(""); cellContent.setDescription(null); } return cellContent; }); } return membershipsTable; }
From source file:edu.kit.dama.ui.admin.administration.usergroup.GroupMembershipEditorWindow.java
License:Apache License
private Table getMembersTable() { if (membersTable == null) { String id = "membersTable"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); membersTable = new Table(); membersTable.setId(DEBUG_ID_PREFIX + id); membersTable.setSizeFull();/*from www. j a v a 2 s .c o m*/ membersTable.setSelectable(true); membersTable.setMultiSelect(true); IndexedContainer c = new IndexedContainer(); c.addContainerProperty(NAME_COLUMN_ID, String.class, null); c.addContainerProperty(ROLE_COLUMN_ID, Role.class, null); c.addContainerProperty(INFO_COLUMN_ID, String.class, null); membersTable.setContainerDataSource(c); membersTable.setColumnHeader(NAME_COLUMN_ID, "User Name"); membersTable.setColumnHeader(ROLE_COLUMN_ID, "Role"); membersTable.setColumnHeader(INFO_COLUMN_ID, "Info"); membersTable.addGeneratedColumn(ROLE_COLUMN_ID, (Table source, Object itemId, Object columnId) -> { Role role = (Role) source.getContainerDataSource().getContainerProperty(itemId, columnId) .getValue(); Label cellContent = new Label(); if (role != null && role.moreThan(Role.NO_ACCESS)) { cellContent.addStyleName(CSSTokenContainer.GREEN_BOLD_CENTERED_LABEL); cellContent.setValue(role.toString()); } else if (role != null && !role.moreThan(Role.NO_ACCESS)) { cellContent.addStyleName(CSSTokenContainer.RED_BOLD_CENTERED_LABEL); cellContent.setValue(role.toString()); } else { cellContent.addStyleName(CSSTokenContainer.ORANGE_BOLD_CENTERED_LABEL); cellContent.setValue("NO MEMBER"); } return cellContent; }); membersTable.addGeneratedColumn(INFO_COLUMN_ID, (Table source, Object itemId, Object columnId) -> { String value = (String) source.getContainerDataSource().getContainerProperty(itemId, columnId) .getValue(); Label cellContent = new Label(); cellContent.addStyleName(CSSTokenContainer.RED_BOLD_CENTERED_LABEL); if (value != null) { cellContent.setValue("!"); cellContent.setDescription(value); } else { cellContent.setValue(""); cellContent.setDescription(null); } return cellContent; }); } return membersTable; }
From source file:edu.kit.dama.ui.admin.AdminUIMainView.java
License:Apache License
private void doBasicSetup() { //configure SiMon try {// w ww . j av a 2 s. co m String path = DataManagerSettings.getSingleton() .getStringProperty(DataManagerSettings.SIMON_CONFIG_LOCATION_ID, null); if (path == null || !new File(path).exists()) { throw new ConfigurationException("Configuration element '" + DataManagerSettings.SIMON_CONFIG_LOCATION_ID + "' is not set or not a valid directory."); } File configLocation = new File(path); SimonConfigurator.getSingleton().setConfigLocation(configLocation); } catch (ConfigurationException ex) { LOGGER.error("Failed to initialize SimpleMonitoring", ex); } //set error handler in order to catch unhandled exceptions UI.getCurrent().setErrorHandler(new DefaultErrorHandler() { @Override public void error(com.vaadin.server.ErrorEvent event) { String cause = "<h3>An unexpected error has occured. Please reload the page.<br/>" + "If the error persists, please contact an administrator.</h3>"; Label errorLabel = new Label(cause, ContentMode.HTML); errorLabel.setDescription(StackTraceUtil.getCustomStackTrace(event.getThrowable(), false)); LOGGER.error("An unhandled exception has occured!", event.getThrowable()); // Display the error message in a custom fashion mainLayout.addComponent(errorLabel, 0); // Do the default error handling (optional) doDefault(event); } }); }