List of usage examples for com.vaadin.ui VerticalLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:de.symeda.sormas.ui.reports.WeeklyReportOfficersGrid.java
License:Open Source License
@Override public void itemClick(ItemClickEvent event) { if (event.getPropertyId().equals(VIEW_DETAILS_BTN_ID)) { WeeklyReportOfficerSummaryDto summaryDto = (WeeklyReportOfficerSummaryDto) event.getItemId(); if (summaryDto.getInformants() > 0) { VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined(); layout.setMargin(true);/* w w w .jav a2 s . c o m*/ Window window = VaadinUiUtil.showPopupWindow(layout); WeeklyReportInformantsGrid grid = new WeeklyReportInformantsGrid(summaryDto.getOfficer(), new EpiWeek(year, week)); grid.setWidth(960, Unit.PIXELS); grid.setHeightMode(HeightMode.ROW); grid.setHeightUndefined(); layout.addComponent(grid); window.setCaption(String.format(I18nProperties.getCaption(Captions.weeklyReportsInDistrict), summaryDto.getDistrict().toString()) + " - " + I18nProperties.getString(Strings.epiWeek) + " " + week + "/" + year); } } }
From source file:de.symeda.sormas.ui.reports.WeeklyReportRegionsGrid.java
License:Open Source License
@Override public void itemClick(ItemClickEvent event) { if (event.getPropertyId().equals(VIEW_DETAILS_BTN_ID)) { WeeklyReportRegionSummaryDto summaryDto = (WeeklyReportRegionSummaryDto) event.getItemId(); VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined(); layout.setMargin(true);/*from ww w. ja v a 2s . c o m*/ Window window = VaadinUiUtil.showPopupWindow(layout); WeeklyReportOfficersGrid grid = new WeeklyReportOfficersGrid(); grid.reload(summaryDto.getRegion(), year, week); grid.setWidth(1600, Unit.PIXELS); grid.setHeightMode(HeightMode.ROW); grid.setHeightUndefined(); layout.addComponent(grid); window.setCaption(String.format(I18nProperties.getCaption(Captions.weeklyReportsInDistrict), summaryDto.getRegion().toString()) + " - " + I18nProperties.getString(Strings.epiWeek) + " " + week + "/" + year); } }
From source file:de.symeda.sormas.ui.samples.SampleController.java
License:Open Source License
private void requestSampleCollectionTaskCreation(SampleDto dto, SampleEditForm form) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);//from w w w. j a v a 2 s . c o m ConfirmationComponent requestTaskComponent = VaadinUiUtil.buildYesNoConfirmationComponent(); Label description = new Label(I18nProperties.getString(Strings.messageCreateCollectionTask), ContentMode.HTML); description.setWidth(100, Unit.PERCENTAGE); layout.addComponent(description); layout.addComponent(requestTaskComponent); layout.setComponentAlignment(requestTaskComponent, Alignment.BOTTOM_RIGHT); layout.setSizeUndefined(); layout.setSpacing(true); Window popupWindow = VaadinUiUtil.showPopupWindow(layout); popupWindow.setSizeUndefined(); popupWindow.setCaption(I18nProperties.getString(Strings.headingCreateNewTaskQuestion)); requestTaskComponent.getConfirmButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); ControllerProvider.getTaskController().createSampleCollectionTask(TaskContext.CASE, dto.getAssociatedCase(), dto); } }); requestTaskComponent.getCancelButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); } }); }
From source file:de.symeda.sormas.ui.samples.SampleController.java
License:Open Source License
public void showChangePathogenTestResultWindow(CommitDiscardWrapperComponent<SampleEditForm> editComponent, String sampleUuid, PathogenTestResultType newResult) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);// w w w . j a v a 2 s.co m ConfirmationComponent confirmationComponent = VaadinUiUtil.buildYesNoConfirmationComponent(); Label description = new Label(String .format(I18nProperties.getString(Strings.messageChangePathogenTestResult), newResult.toString())); description.setWidth(100, Unit.PERCENTAGE); layout.addComponent(description); layout.addComponent(confirmationComponent); layout.setComponentAlignment(confirmationComponent, Alignment.BOTTOM_RIGHT); layout.setSizeUndefined(); layout.setSpacing(true); Window popupWindow = VaadinUiUtil.showPopupWindow(layout); popupWindow.setSizeUndefined(); popupWindow.setCaption(I18nProperties.getString(Strings.headingChangePathogenTestResult)); confirmationComponent.getConfirmButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { editComponent.commit(); SampleDto sample = FacadeProvider.getSampleFacade().getSampleByUuid(sampleUuid); sample.setPathogenTestResult(newResult); FacadeProvider.getSampleFacade().saveSample(sample); popupWindow.close(); SormasUI.refreshView(); } }); confirmationComponent.getCancelButton().addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { popupWindow.close(); } }); }
From source file:de.symeda.sormas.ui.statistics.StatisticsFilterValuesElement.java
License:Open Source License
private VerticalLayout createUtilityButtonsLayout() { VerticalLayout utilityButtonsLayout = new VerticalLayout(); utilityButtonsLayout.setMargin(false); utilityButtonsLayout.setSpacing(false); utilityButtonsLayout.setSizeUndefined(); Button addAllButton = new Button(I18nProperties.getCaption(Captions.all), VaadinIcons.PLUS_CIRCLE); CssStyles.style(addAllButton, ValoTheme.BUTTON_LINK); addAllButton.addClickListener(e -> { for (TokenizableValue tokenizable : getFilterValues()) { tokenField.addTokenizable(tokenizable); }//from w w w . j ava 2 s .c o m }); Button removeAllButton = new Button(I18nProperties.getCaption(Captions.actionClear), VaadinIcons.CLOSE_CIRCLE); CssStyles.style(removeAllButton, ValoTheme.BUTTON_LINK); removeAllButton.addClickListener(e -> { for (Tokenizable tokenizable : tokenField.getValue()) { tokenField.removeTokenizable(tokenizable); } }); utilityButtonsLayout.addComponent(addAllButton); utilityButtonsLayout.addComponent(removeAllButton); return utilityButtonsLayout; }
From source file:de.symeda.sormas.ui.utils.AbstractSubNavigationView.java
License:Open Source License
protected Optional<VerticalLayout> createInfoLayout() { VerticalLayout infoLayout = new VerticalLayout(); infoLayout.setMargin(false);/*w w w . j av a2s . c om*/ infoLayout.setSpacing(false); infoLayout.setSizeUndefined(); CssStyles.stylePrimary(infoLayout, CssStyles.CALLOUT); infoLabel = new Label(""); infoLabelSub = new Label(""); CssStyles.style(infoLabelSub, ValoTheme.LABEL_SMALL); infoLayout.addComponent(infoLabel); infoLayout.addComponent(infoLabelSub); return Optional.of(infoLayout); }
From source file:de.symeda.sormas.ui.utils.AbstractView.java
License:Open Source License
protected AbstractView(String viewName) { this.viewName = viewName; setSizeFull();//from w ww . ja v a2s. co m setMargin(false); setSpacing(false); viewHeader = new HorizontalLayout(); viewHeader.setWidth(100, Unit.PERCENTAGE); viewHeader.setHeightUndefined(); viewHeader.setMargin(new MarginInfo(false, true)); viewHeader.setSpacing(true); CssStyles.style(viewHeader, "view-header"); VerticalLayout viewTitleLayout = new VerticalLayout(); { viewTitleLayout.setSizeUndefined(); viewTitleLayout.setSpacing(false); viewTitleLayout.setMargin(false); // note: splitting title and subtitle into labels does not work with the css String viewTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".")); String viewSubTitle = I18nProperties.getPrefixCaption("View", viewName.replaceAll("/", ".") + ".sub", ""); viewTitleLabel = new Label(viewTitle); viewTitleLabel.setSizeUndefined(); CssStyles.style(viewTitleLabel, CssStyles.H1, CssStyles.VSPACE_NONE); viewTitleLayout.addComponent(viewTitleLabel); Label viewSubTitleLabel = new Label(viewSubTitle); viewSubTitleLabel.setSizeUndefined(); CssStyles.style(viewSubTitleLabel, CssStyles.H4, CssStyles.VSPACE_TOP_NONE); viewTitleLayout.addComponent(viewSubTitleLabel); } viewHeader.addComponent(viewTitleLayout); viewHeader.setExpandRatio(viewTitleLayout, 1); addComponent(viewHeader); setExpandRatio(viewHeader, 0); }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showSimplePopupWindow(String caption, String contentText) { Window window = new Window(null); window.setModal(true);/*from w ww .ja v a 2 s .c o m*/ window.setSizeUndefined(); window.setResizable(false); window.center(); VerticalLayout popupLayout = new VerticalLayout(); popupLayout.setMargin(true); popupLayout.setSpacing(true); popupLayout.setSizeUndefined(); Label contentLabel = new Label(contentText); contentLabel.setWidth(100, Unit.PERCENTAGE); popupLayout.addComponent(contentLabel); Button okayButton = new Button(I18nProperties.getCaption(Captions.actionOkay)); okayButton.addClickListener(e -> { window.close(); }); CssStyles.style(okayButton, ValoTheme.BUTTON_PRIMARY); popupLayout.addComponent(okayButton); popupLayout.setComponentAlignment(okayButton, Alignment.BOTTOM_RIGHT); window.setCaption(caption); window.setContent(popupLayout); UI.getCurrent().addWindow(window); return window; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showDeleteConfirmationWindow(String content, Runnable callback) { Window popupWindow = VaadinUiUtil.createPopupWindow(); VerticalLayout deleteLayout = new VerticalLayout(); deleteLayout.setMargin(true);//from w ww . j a v a 2s . c o m deleteLayout.setSizeUndefined(); deleteLayout.setSpacing(true); Label description = new Label(content); description.setWidth(100, Unit.PERCENTAGE); deleteLayout.addComponent(description); ConfirmationComponent deleteConfirmationComponent = new ConfirmationComponent(false) { private static final long serialVersionUID = 1L; @Override protected void onConfirm() { popupWindow.close(); onDone(); callback.run(); } @Override protected void onCancel() { popupWindow.close(); } }; deleteConfirmationComponent.getConfirmButton().setCaption(I18nProperties.getString(Strings.yes)); deleteConfirmationComponent.getCancelButton().setCaption(I18nProperties.getString(Strings.no)); deleteLayout.addComponent(deleteConfirmationComponent); deleteLayout.setComponentAlignment(deleteConfirmationComponent, Alignment.BOTTOM_RIGHT); popupWindow.setCaption(I18nProperties.getString(Strings.headingConfirmDeletion)); popupWindow.setContent(deleteLayout); UI.getCurrent().addWindow(popupWindow); return popupWindow; }
From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java
License:Open Source License
/** * The constructor should first build the main layout, set the composition * root and then do any custom initialization. * /*w ww. j a va 2 s . co m*/ * The constructor will not be automatically regenerated by the visual * editor. */ public GoldstandardGUI() { buildMainLayout(); setCompositionRoot(mainLayout); // user code for (Type t : BoaAnnotation.Type.values()) { comboBoxTypes.addItem(t); } comboBoxTypes.setTextInputAllowed(false); listSelectAnnotations.setMultiSelect(false); comboBoxTypes.setNullSelectionAllowed(false); listSelectAnnotations.setNullSelectionAllowed(false); // with this layout components will get wrapped cssLayoutTokens = new CssLayout() { @Override protected String getCss(Component c) { return "float:left;margin-right:5px;"; } }; cssLayoutTokens.setWidth("100%"); // auto; becomes vertical scroll-able since verticalLayout_tokens height // is also auto cssLayoutTokens.setHeight(SIZE_UNDEFINED, 0); verticalLayoutTokens.addComponent(cssLayoutTokens); resetComponents(); buttonNext.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (sentence != null) { SentenceServer.returnSentence(sentence); } resetComponents(); sentence = SentenceServer.getSentence(); if (sentence == null) { getWindow().showNotification("No more senentences.", Notification.TYPE_ERROR_MESSAGE); return; } // create new check boxes for tokens CheckBox checkbox; Label label; VerticalLayout vertLayout; for (int i = 0; i < sentence.getTokens().size(); i++) { checkbox = new CheckBox(); checkbox.setImmediate(true); checkbox.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { Iterator<Component> iterator = cssLayoutTokens.getComponentIterator(); Label l; CheckBox cb; VerticalLayout vl; String s = ""; while (iterator.hasNext()) { vl = (VerticalLayout) iterator.next(); l = (Label) vl.getComponent(0); cb = (CheckBox) vl.getComponent(1); if (cb.booleanValue()) { s += l.getValue(); } } if (s.isEmpty()) s = ""; textFieldLabel.setReadOnly(false); textFieldLabel.setValue(s); textFieldLabel.setReadOnly(true); } }); label = new Label(sentence.getTokens().get(i)); label.setSizeUndefined(); vertLayout = new VerticalLayout(); vertLayout.addComponent(label); vertLayout.addComponent(checkbox); vertLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); vertLayout.setComponentAlignment(checkbox, Alignment.MIDDLE_CENTER); vertLayout.setSizeUndefined(); cssLayoutTokens.addComponent(vertLayout); } } }); buttonDiscard.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (sentence != null) { SentenceServer.discardSentence(sentence); resetComponents(); } } }); buttonAddAnno.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (!textFieldLabel.getValue().equals("") && comboBoxTypes.getValue() != null) { Iterator<Component> iterator = cssLayoutTokens.getComponentIterator(); Label l; CheckBox cb; VerticalLayout vl; ArrayList<String> selected = new ArrayList<String>(); while (iterator.hasNext()) { vl = (VerticalLayout) iterator.next(); l = (Label) vl.getComponent(0); cb = (CheckBox) vl.getComponent(1); if (cb.booleanValue()) { selected.add((String) l.getValue()); cb.setValue(false); } } BoaAnnotation anno = new BoaAnnotation((Type) comboBoxTypes.getValue(), selected); boolean isDuplicate = false; boolean isColliding = false; for (BoaAnnotation a : sentence.getAnnotations()) { if (a.getTokens().size() == anno.getTokens().size()) { boolean sameTokens = true; for (int i = 0; i < a.getTokens().size(); i++) { sameTokens = a.getTokens().get(i) == anno.getTokens().get(i); if (!sameTokens) break; } if (sameTokens) { isColliding = !(isDuplicate = a.getType().equals(anno.getType())); break; } } } if (isDuplicate) { getWindow().showNotification("Duplicate was dismissed.", Notification.TYPE_WARNING_MESSAGE); } else if (isColliding) { getWindow().showNotification("Label is already assigned to<br/> a different type.", Notification.TYPE_ERROR_MESSAGE); } else { sentence.getAnnotations().add(anno); listSelectAnnotations.addItem(anno); } } else getWindow().showNotification("Label or type is inavlid.", Notification.TYPE_ERROR_MESSAGE); } }); buttonDelAnno.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (listSelectAnnotations.getValue() != null) { sentence.getAnnotations().remove(listSelectAnnotations.getValue()); listSelectAnnotations.removeItem(listSelectAnnotations.getValue()); } } }); }