List of usage examples for com.vaadin.ui Alignment BOTTOM_CENTER
Alignment BOTTOM_CENTER
To view the source code for com.vaadin.ui Alignment BOTTOM_CENTER.
Click Source Link
From source file:org.jpos.qi.minigl.NewEntryForm.java
License:Open Source License
private void createAndBindFields(Binder binder) { TextField accountCode = createTextField("accountCode"); ComboBox layer = createLayersSelector(); TextField detail = createTextField("detail"); TextField tags = createTextField("tags"); TextField amount = createTextField("amount"); RadioButtonGroup credit = createCreditOrDebit(); binder.forField(accountCode).withNullRepresentation("").withConverter(new AccountConverter()) .withValidator((Validator<Account>) (value, context) -> { if (value != null && !(value instanceof FinalAccount)) return ValidationResult.error(app.getMessage("errorMessage.accountNotFinal")); else if (value == null) return ValidationResult.error(app.getMessage("errorMessage.req", StringUtils.capitalize(accountCode.getCaption()))); return ValidationResult.ok(); }).asRequired(app.getMessage("errorMessage.req", StringUtils.capitalize(layer.getCaption()))) .bind("account"); binder.forField(layer).withConverter(new ShortToLayerConverter(journal)) .asRequired(app.getMessage("errorMessage.req", StringUtils.capitalize(layer.getCaption()))) .bind("layer"); binder.forField(detail)/*from w w w.ja v a 2 s .co m*/ .withValidator(new StringLengthValidator( app.getMessage("errorMessage.invalidField", detail.getCaption()), 0, 255)) .withValidator(new RegexpValidator(app.getMessage("errorMessage.invalidField", detail.getCaption()), TEXT_REGEX)) .bind("detail"); binder.forField(tags) .withValidator(new StringLengthValidator( app.getMessage("errorMessage.invalidField", tags.getCaption()), 0, 255)) .withValidator(new RegexpValidator(app.getMessage("errorMessage.invalidField", tags.getCaption()), TEXT_REGEX)) .withConverter(new StringToTagConverter()).bind("tags"); binder.forField(amount) .asRequired(app.getMessage("errorMessage.req", StringUtils.capitalize(amount.getCaption()))) .withConverter(new StringToBigDecimalConverter(app.getMessage("errorMessage.invalidAmount"))) .withValidator(new BigDecimalRangeValidator(app.getMessage("errorMessage.invalidAmount"), new BigDecimal("1"), new BigDecimal("99999999999999"))) .withNullRepresentation(BigDecimal.ZERO).bind("amount"); binder.bind(credit, "credit"); addComponent(accountCode); addComponent(layer); addComponent(detail); addComponent(tags); addComponent(amount); addComponent(credit); setComponentAlignment(credit, Alignment.BOTTOM_CENTER); }
From source file:org.jumpmind.vaadin.ui.common.ReadOnlyTextAreaDialog.java
License:Open Source License
private void buildUploadButton(String title, final String value) { final Button uploadButton = new Button("Upload"); final Button viewTextButton = new Button("View Text"); LobUploader lobUploader = new LobUploader(); final Upload upload = new Upload("Upload new " + table.getColumnWithName(title).getMappedType(), lobUploader);//from w ww.j av a2s . co m upload.addSucceededListener(lobUploader); uploadButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { wrapper.replaceComponent(textField, upload); wrapper.setComponentAlignment(upload, Alignment.MIDDLE_CENTER); buttonLayout.replaceComponent(uploadButton, viewTextButton); } }); viewTextButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { wrapper.replaceComponent(upload, textField); wrapper.setComponentAlignment(textField, Alignment.TOP_LEFT); buttonLayout.replaceComponent(viewTextButton, uploadButton); } }); if (value != null) { buttonLayout.addComponent(uploadButton); buttonLayout.setComponentAlignment(uploadButton, Alignment.BOTTOM_CENTER); } else { wrapper.replaceComponent(textField, upload); wrapper.setComponentAlignment(upload, Alignment.MIDDLE_CENTER); } }
From source file:org.jumpmind.vaadin.ui.common.ReadOnlyTextAreaDialog.java
License:Open Source License
private void buildDownloadButton(String title) { downloadButton = new Button("Download"); final byte[] lobData = getLobData(title); if (lobData != null) { Resource resource = new StreamResource(new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { return new ByteArrayInputStream(lobData); }// w w w. ja v a2s.co m }, title); FileDownloader fileDownloader = new FileDownloader(resource); fileDownloader.extend(downloadButton); buttonLayout.addComponent(downloadButton); buttonLayout.setComponentAlignment(downloadButton, Alignment.BOTTOM_CENTER); long fileSize = lobData.length; String sizeText = fileSize + " Bytes"; if (fileSize / 1024 > 0) { sizeText = Math.round(fileSize / 1024.0) + " kB"; fileSize /= 1024; } if (fileSize / 1024 > 0) { sizeText = Math.round(fileSize / 1024.0) + " MB"; fileSize /= 1024; } if (fileSize / 1024 > 0) { sizeText = Math.round(fileSize / 1024.0) + " GB"; } Label sizeLabel = new Label(sizeText); buttonLayout.addComponent(sizeLabel); buttonLayout.setExpandRatio(sizeLabel, 1.0f); buttonLayout.setComponentAlignment(sizeLabel, Alignment.BOTTOM_CENTER); } }
From source file:org.lunifera.mobile.vaadin.ecview.presentation.internal.NavigationPagePresentation.java
License:Open Source License
/** * Sets the alignment to the component./*from ww w. j a v a 2s . c om*/ * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setSizeUndefined(); switch (yAlignment) { case BOTTOM_CENTER: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.FormLayoutPresentation.java
License:Open Source License
/** * Sets the alignment to the component./* www . j a v a 2 s .c om*/ * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setWidth("-1%"); child.setHeight("-1%"); switch (yAlignment) { case BOTTOM_CENTER: formLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: formLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: formLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: formLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: formLayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: formLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: formLayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: formLayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: formLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: formLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.GridLayoutPresentation.java
License:Open Source License
/** * Sets the alignment to the component./* w ww . j a v a 2 s .c o m*/ * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setWidth("-1%"); child.setHeight("-1%"); switch (yAlignment) { case BOTTOM_CENTER: gridlayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: gridlayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: gridlayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: gridlayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.HorizontalLayoutPresentation.java
License:Open Source License
/** * Sets the alignment to the component./* ww w . j a v a2 s . com*/ * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setWidth("-1%"); child.setHeight("-1%"); switch (yAlignment) { case BOTTOM_CENTER: horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.VerticalLayoutPresentation.java
License:Open Source License
/** * Sets the alignment to the component.//from w ww.ja va 2s .co m * * @param child * @param yAlignment */ protected void applyAlignment(Component child, YAlignment yAlignment) { if (yAlignment != null) { child.setWidth("-1%"); child.setHeight("-1%"); switch (yAlignment) { case BOTTOM_CENTER: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER); break; case BOTTOM_FILL: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); child.setWidth("100%"); break; case BOTTOM_LEFT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT); break; case BOTTOM_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT); break; case MIDDLE_CENTER: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER); break; case MIDDLE_FILL: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); child.setWidth("100%"); break; case MIDDLE_LEFT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT); break; case MIDDLE_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT); break; case TOP_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); break; case TOP_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); break; case TOP_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); break; case TOP_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); break; case FILL_CENTER: verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER); child.setHeight("100%"); break; case FILL_FILL: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setWidth("100%"); child.setHeight("100%"); break; case FILL_LEFT: verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT); child.setHeight("100%"); break; case FILL_RIGHT: verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT); child.setHeight("100%"); break; default: break; } } }
From source file:org.openeos.services.ui.vaadin.internal.UIApplicationImpl.java
License:Apache License
@Override public <U> UIDialog showGenericFormDialog(BForm<U> form, U bean) { Map<String, Object> extraObjects = new HashMap<String, Object>(); extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this); VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form, commonBindingToolkit, extraObjects, false);/*from w w w . j av a2 s . c o m*/ Window window = new Window(form.getName()); window.setModal(true); window.addComponent((ComponentContainer) formInstance.getImplementation()); formInstance.setValue(bean); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button buttonOk = new Button("Ok"); buttons.addComponent(buttonOk); Button buttonCancel = new Button("Cancel"); buttons.addComponent(buttonCancel); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); window.addComponent(footer); ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER); window.getContent().setSizeFull(); vaadinApplication.getMainWindow().addWindow(window); return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance); }
From source file:org.openeos.services.ui.vaadin.internal.UIApplicationImpl.java
License:Apache License
private <T> UIDialog showFormDialog(Class<T> modelClass, UIBean model, BindingFormCapability capability) { AbstractFormBindingForm<T> form = formRegistryService.getDefaultForm(modelClass, AbstractFormBindingForm.class, capability); Map<String, Object> extraObjects = new HashMap<String, Object>(); extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this); VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form.getAbstractBForm(), uiBeanBindingToolkit, extraObjects, false); Window window = new Window(form.getAbstractBForm().getName()); window.setModal(true);//from w w w . j ava2 s. c o m window.addComponent((ComponentContainer) formInstance.getImplementation()); formInstance.setValue(model); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button buttonOk = new Button("Ok"); buttons.addComponent(buttonOk); Button buttonCancel = new Button("Cancel"); buttons.addComponent(buttonCancel); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); window.addComponent(footer); ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER); window.getContent().setSizeFull(); vaadinApplication.getMainWindow().addWindow(window); return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance); }