List of usage examples for com.vaadin.ui Alignment BOTTOM_RIGHT
Alignment BOTTOM_RIGHT
To view the source code for com.vaadin.ui Alignment BOTTOM_RIGHT.
Click Source Link
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method. Puts a blank in front of a component. Two labels with different size in front of two components. * /*from w w w . j a v a 2s . co m*/ * @param labelLeft * the left (leading) label. * @param labelRight * the right (leading) label. * @param compLeft * the left component. * @param compRight * the right component. * @param widthLeft * the width of the left label. * @param widthRight * the width of the right label. * @param required * true if the component is required, otherwise false. * @return the customized component placed in a horizontal layout. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Component compLeft, final Component compRight, final int widthLeft, final int widthRight, final boolean required) { // foo final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(Constants.DEFAULT_HEIGHT); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + labelLeft + Constants.P; Label ll, lr; hor.addComponent(ll = new Label(text, Label.CONTENT_XHTML)); ll.setSizeUndefined(); ll.setWidth(widthLeft + Constants.PX); hor.setComponentAlignment(ll, Alignment.MIDDLE_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(compLeft); hor.setComponentAlignment(compLeft, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); final String text2 = Constants.P_ALIGN_RIGHT + labelRight + Constants.P; hor.addComponent(lr = new Label(text2, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(widthRight + Constants.PX); hor.setComponentAlignment(lr, Alignment.BOTTOM_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(compRight); hor.setComponentAlignment(compRight, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * //w w w.j a v a2s.c o m * @param labelLeft * @param labelRight * @param compLeft * @param compRight * @param widthLeft * @param widthRight * @param required * @return the constructed result. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Label compLeft, final Label compRight, final int widthLeft, final int widthRight, final boolean required) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setHeight(Constants.DEFAULT_HEIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final Label leftLabel = new Label(Constants.P_ALIGN_RIGHT + labelLeft + Constants.P, Label.CONTENT_XHTML); leftLabel.setWidth(111, Sizeable.UNITS_PIXELS); hLayout.addComponent(leftLabel); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); hLayout.addComponent(compLeft); hLayout.setComponentAlignment(compLeft, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); final Label c = new Label(Constants.P_ALIGN_RIGHT + labelRight + Constants.P, Label.CONTENT_XHTML); hLayout.addComponent(c); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); hLayout.addComponent(compRight); hLayout.setComponentAlignment(compRight, Alignment.BOTTOM_RIGHT); return hLayout; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * Helper method for placing components. * //from ww w. j av a2s. c om * @param labelLeft * the left (leading) label. * @param labelRight * the right (leading) label. * @param compLeft * the left component. * @param compRight * the right component. * @param width * the width of the label. * @param required * true if the component is required, otherwise false. * @return the customized component placed in a horizontal layout. */ public static synchronized HorizontalLayout create(final String labelLeft, final String labelRight, final Component compLeft, final Component compRight, final int width, final boolean required) { final HorizontalLayout hor = new HorizontalLayout(); hor.setHeight(Constants.DEFAULT_HEIGHT); hor.addComponent(new Label(" ")); final String text = Constants.P_ALIGN_RIGHT + labelLeft + Constants.P; Label ll, lr; hor.addComponent(ll = new Label(text, Label.CONTENT_XHTML)); ll.setSizeUndefined(); ll.setWidth(width + Constants.PX); hor.setComponentAlignment(ll, Alignment.MIDDLE_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(compLeft); hor.setComponentAlignment(compLeft, Alignment.MIDDLE_RIGHT); hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); final String text2 = Constants.P_ALIGN_RIGHT + labelRight + Constants.P; hor.addComponent(lr = new Label(text2, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(width + Constants.PX); hor.setComponentAlignment(lr, Alignment.MIDDLE_RIGHT); if (required) { hor.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hor.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hor.addComponent(compRight); hor.setComponentAlignment(compRight, Alignment.BOTTOM_RIGHT); hor.addComponent(new Label(" ")); hor.setSpacing(false); return hor; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
public static Component foo(final String captionForleftLabel, final String captionForRightLabel, final Label leftLabel, final Label rightLabel, final int widthLeft, final int widthRight, final boolean required) { final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setHeight("30px"); hLayout.addComponent(new Label(" ")); final Label ll = new Label(Constants.P_ALIGN_RIGHT + captionForleftLabel + Constants.P, Label.CONTENT_XHTML); ll.setSizeUndefined();/*from ww w . j ava2 s . com*/ ll.setWidth(widthLeft + Constants.PX); hLayout.addComponent(ll); hLayout.setComponentAlignment(ll, Alignment.MIDDLE_RIGHT); if (required) { hLayout.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hLayout.addComponent(leftLabel); hLayout.setComponentAlignment(leftLabel, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Label lr; hLayout.addComponent( lr = new Label(Constants.P_ALIGN_RIGHT + captionForRightLabel + Constants.P, Label.CONTENT_XHTML)); lr.setSizeUndefined(); lr.setWidth(widthRight + Constants.PX); hLayout.setComponentAlignment(lr, Alignment.BOTTOM_RIGHT); if (required) { hLayout.addComponent(new Label(" <span style=\"color:red; position:relative; top:13px;\">*</span>", Label.CONTENT_XHTML)); } else { hLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); } hLayout.addComponent(rightLabel); hLayout.setComponentAlignment(rightLabel, Alignment.BOTTOM_RIGHT); hLayout.addComponent(new Label(" ")); hLayout.setSpacing(false); return hLayout; }
From source file:de.symeda.sormas.ui.caze.AbstractTableField.java
License:Open Source License
@Override protected Component initContent() { this.addStyleName(CssStyles.CAPTION_HIDDEN); this.addStyleName(CssStyles.VSPACE_2); layout = new VerticalLayout(); layout.setSpacing(false);/*from w w w . j av a2 s .c om*/ HorizontalLayout headerLayout = new HorizontalLayout(); { headerLayout.setWidth(100, Unit.PERCENTAGE); captionLabel = new Label(getCaption()); captionLabel.setSizeUndefined(); headerLayout.addComponent(captionLabel); headerLayout.setComponentAlignment(captionLabel, Alignment.BOTTOM_LEFT); headerLayout.setExpandRatio(captionLabel, 0); addButton = createAddButton(); headerLayout.addComponent(addButton); headerLayout.setComponentAlignment(addButton, Alignment.BOTTOM_RIGHT); headerLayout.setExpandRatio(addButton, 1); } layout.addComponent(headerLayout); table = createTable(); table.addItemSetChangeListener(new ItemSetChangeListener() { @Override public void containerItemSetChange(ItemSetChangeEvent event) { applyTablePageLength(); } }); layout.addComponent(table); return layout; }
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceOverviewLayout.java
License:Open Source License
private void addShowMoreAndLessButtons() { HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setHeightUndefined();/*from ww w .j a v a 2 s. c o m*/ buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setMargin(new MarginInfo(false, true)); showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases), VaadinIcons.CHEVRON_DOWN); CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases), VaadinIcons.CHEVRON_UP); CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); hideOverview = new CheckBox(I18nProperties.getCaption(Captions.dashboardHideOverview)); CssStyles.style(hideOverview, CssStyles.VSPACE_3); showMoreButton.addClickListener(e -> { isShowingAllDiseases = true; refresh(); showMoreButton.setVisible(false); showLessButton.setVisible(true); }); showLessButton.addClickListener(e -> { isShowingAllDiseases = false; refresh(); showLessButton.setVisible(false); showMoreButton.setVisible(true); }); hideOverview.addValueChangeListener(e -> { if (hideOverview.getValue()) { diseaseBurdenView.setVisible(false); diseaseDifferenceComponent.setVisible(false); showLessButton.setVisible(false); showMoreButton.setVisible(false); } else { diseaseBurdenView.setVisible(true); diseaseDifferenceComponent.setVisible(true); showLessButton.setVisible(isShowingAllDiseases); showMoreButton.setVisible(!isShowingAllDiseases); } }); buttonsLayout.addComponent(showMoreButton); buttonsLayout.addComponent(showLessButton); buttonsLayout.setComponentAlignment(showMoreButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showMoreButton, 1); buttonsLayout.setComponentAlignment(showLessButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showLessButton, 1); buttonsLayout.addComponent(hideOverview); buttonsLayout.setComponentAlignment(hideOverview, Alignment.BOTTOM_RIGHT); buttonsLayout.setExpandRatio(hideOverview, 0); addComponent(buttonsLayout, EXTEND_BUTTONS_LOC); isShowingAllDiseases = false; showLessButton.setVisible(false); buttonsLayout.setExpandRatio(showLessButton, 1); }
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);//w w w . ja 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);// ww w . j a v a2 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.utils.CommitDiscardWrapperComponent.java
License:Open Source License
protected void setWrappedComponent(C component, FieldGroup... fieldGroups) { this.wrappedComponent = component; this.fieldGroups = fieldGroups; if (contentPanel != null) { contentPanel.setContent(wrappedComponent); return;//from w ww .ja v a 2 s .c om } setSpacing(false); setMargin(true); setSizeUndefined(); contentPanel = new Panel(component); updateInternalWidth(); updateInternalHeight(); addComponent(contentPanel); setExpandRatio(contentPanel, 1); buttonsPanel = new HorizontalLayout(); buttonsPanel.setMargin(false); buttonsPanel.setSpacing(true); buttonsPanel.setWidth(100, Unit.PERCENTAGE); Button discardButton = getDiscardButton(); buttonsPanel.addComponent(discardButton); buttonsPanel.setComponentAlignment(discardButton, Alignment.BOTTOM_RIGHT); buttonsPanel.setExpandRatio(discardButton, 1); Button commitButton = getCommitButton(); buttonsPanel.addComponent(commitButton); buttonsPanel.setComponentAlignment(commitButton, Alignment.BOTTOM_RIGHT); buttonsPanel.setExpandRatio(commitButton, 0); addComponent(buttonsPanel); setComponentAlignment(buttonsPanel, Alignment.BOTTOM_RIGHT); setShortcutsEnabled(shortcutsEnabled); if (fieldGroups != null && fieldGroups.length > 0) { // convention: set wrapper to read-only when all wrapped field groups are read-only boolean allReadOnly = true; for (FieldGroup fieldGroup : fieldGroups) { if (!fieldGroup.isReadOnly()) { allReadOnly = false; break; } } if (allReadOnly) { setReadOnly(true); } } else if (wrappedComponent != null) { if (wrappedComponent instanceof AbstractLegacyComponent && ((AbstractLegacyComponent) wrappedComponent).isReadOnly()) { setReadOnly(true); } } }
From source file:de.symeda.sormas.ui.utils.PaginationList.java
License:Open Source License
public PaginationList(int maxDisplayedEntries) { setMargin(false);//from www . ja v a 2s. co m setSpacing(false); this.maxDisplayedEntries = maxDisplayedEntries; this.currentPage = 1; this.listLayout = new VerticalLayout(); listLayout.setMargin(false); listLayout.setSpacing(false); this.paginationLayout = new HorizontalLayout(); paginationLayout.setMargin(false); paginationLayout.setSpacing(true); CssStyles.style(paginationLayout, CssStyles.SPACING_SMALL, CssStyles.VSPACE_TOP_4); initializePaginationLayout(); addComponent(listLayout); addComponent(paginationLayout); setComponentAlignment(paginationLayout, Alignment.BOTTOM_RIGHT); setWidth(100, Unit.PERCENTAGE); addStyleName(CssStyles.SORMAS_LIST); }