List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
private void refreshProfiles(Group g, Layout layoutProfiles) { layoutProfiles.removeAllComponents(); GroupUtils.getAllInterestProfiles(g, UserUtils.getCurrent()).forEach((p, enabled) -> { HorizontalLayout layoutProfile = new HorizontalLayout(); layoutProfile.setWidth("100%"); CheckBox checkBoxEnabled = new CheckBox(); checkBoxEnabled.setValue(enabled); checkBoxEnabled.addValueChangeListener(v -> { GroupInterestProfileUtils.changeEnabled(p, UserUtils.getCurrent(), v.getValue()); refreshAll(g);//from w w w. j a v a2s . c o m }); long subscribers = p.getEnabledUsers().values().stream().filter(v -> v).count(); Label labelProfileInfo = new Label(); Language.setCustom(Word.SUBSCRIBERS, s -> { String info = p.getName() + " (" + subscribers + " "; info += subscribers == 1 ? Language.get(Word.SUBSCRIBER) + ")" : Language.get(Word.SUBSCRIBERS) + ")"; labelProfileInfo.setValue(info); }); boolean isAdmin = g.getUsers().getOrDefault(UserUtils.getCurrent(), false); Button buttonOpen = new Button(VaadinIcons.EXTERNAL_LINK); buttonOpen.addClickListener(ce -> { UI.getCurrent().addWindow(GroupProfileWindow.show(p, isAdmin, () -> { })); }); if (isAdmin) { Button buttonRemove = new Button(VaadinIcons.MINUS); buttonRemove.addStyleName(ValoTheme.BUTTON_DANGER); buttonRemove.addClickListener(ce -> { ConfirmationDialog.show( Language.get(Word.REALLY_DELETE_PROFILE).replace("[PROFILE]", p.getName()), () -> { GroupInterestProfileUtils.delete(p); refreshAll(g); }); }); layoutProfile.addComponents(checkBoxEnabled, labelProfileInfo, buttonOpen, buttonRemove); } else { layoutProfile.addComponents(checkBoxEnabled, labelProfileInfo, buttonOpen); } layoutProfile.setExpandRatio(labelProfileInfo, 5); layoutProfile.setComponentAlignment(checkBoxEnabled, Alignment.MIDDLE_CENTER); layoutProfile.setComponentAlignment(labelProfileInfo, Alignment.MIDDLE_LEFT); layoutProfiles.addComponent(layoutProfile); }); }
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
public void refreshMembers(Group g, Layout layoutMembers) { layoutMembers.removeAllComponents(); Map<User, Boolean> allMembers = GroupUtils.getAllMembers(g); boolean isAdmin = GroupUtils.isAdmin(g, UserUtils.getCurrent()); if (!isAdmin) { if (allMembers.size() < 2) { buttonLeave.setVisible(false); } else {//from w w w .j ava 2 s. co m buttonLeave.setVisible(true); } } else { if (allMembers.entrySet().stream().map(e -> e.getValue()).filter(b -> b == true).count() > 1) { buttonLeave.setVisible(true); } else { buttonLeave.setVisible(false); } } allMembers.forEach((u, admin) -> { HorizontalLayout layoutMember = new HorizontalLayout(); layoutMember.setWidth("100%"); VaadinIcons iconRole = admin ? VaadinIcons.KEY : VaadinIcons.USER; Label labelMemberName = new Label(iconRole.getHtml() + " " + u.getUsername(), ContentMode.HTML); //labelMemberName.setWidth("50%"); layoutMember.addComponents(labelMemberName); layoutMember.setComponentAlignment(labelMemberName, Alignment.MIDDLE_LEFT); layoutMember.setExpandRatio(labelMemberName, 5); if (isAdmin) { if (g.getUsers().size() > 1) { Button buttonChangeRole = new Button(admin ? VaadinIcons.ARROW_DOWN : VaadinIcons.ARROW_UP); buttonChangeRole.addClickListener(ce -> { if (g.getUsers().get(u)) {//Downgrade long amountAdmins = g.getUsers().entrySet().stream().filter(e -> e.getValue()).count(); if (amountAdmins > 1) { if (UserUtils.getCurrent() == u) { ConfirmationDialog.show(Language.get(Word.REALLY_DEADMIN_YOURSELF), () -> { GroupUtils.makeNormalMember(g, u); refreshAll(g); }); } else { GroupUtils.makeNormalMember(g, u); refreshAll(g); } } else { VaadinUtils.errorNotification(Language.get(Word.NOT_ENOUGH_ADMINS_IN_GROUP)); buttonLeave.setVisible(false); } } else {//Upgrade GroupUtils.makeAdmin(g, u); refreshAll(g); } }); layoutMember.addComponent(buttonChangeRole); if (g.getUsers().values().stream().filter(v -> v).count() > 1 || !GroupUtils.isAdmin(g, u)) { Button buttonRemoveUser = new Button(VaadinIcons.MINUS); buttonRemoveUser.addStyleName(ValoTheme.BUTTON_DANGER); buttonRemoveUser.addClickListener(ce -> { ConfirmationDialog.show( Language.get(Word.REALLY_REMOVE_USER_FROM_GROUP) .replace("[USER]", u.getUsername()).replace("[GROUP]", g.getName()), () -> { GroupUtils.removeUser(g, u); refreshAll(g); }); }); layoutMember.addComponents(buttonRemoveUser); } } } layoutMembers.addComponent(layoutMember); }); }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
private Component buildClippingsTab(User user) { HorizontalLayout root = new HorizontalLayout(); root.setCaption(Language.get(Word.CLIPPINGS)); root.setIcon(VaadinIcons.NEWSPAPER); root.setWidth("100%"); root.setSpacing(true);/*from w ww . j a v a 2 s.com*/ root.setMargin(true); FormLayout formLayoutClippingDetails = new FormLayout(); formLayoutClippingDetails.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); root.addComponent(formLayoutClippingDetails); CheckBox checkBoxReceiveEmails = new CheckBox(); checkBoxReceiveEmails.setValue(UserUtils.getEmailNewsletter(user)); checkBoxReceiveEmails.addValueChangeListener(v -> UserUtils.setEmailNewsletter(user, v.getValue())); HorizontalLayout layoutCheckBoxReceiveEmails = new HorizontalLayout(checkBoxReceiveEmails); layoutCheckBoxReceiveEmails.setCaption(Language.get(Word.EMAIL_SUBSCRIPTION)); layoutCheckBoxReceiveEmails.setMargin(false); layoutCheckBoxReceiveEmails.setSpacing(false); HorizontalLayout layoutAddNewClippingTime = new HorizontalLayout(); layoutAddNewClippingTime.setMargin(false); layoutAddNewClippingTime.setCaption(Language.get(Word.ADD_CLIPPING_TIME)); layoutAddNewClippingTime.setWidth("100%"); InlineDateTimeField dateFieldNewClippingTime = new InlineDateTimeField(); LocalDateTime value = LocalDateTime.now(ZoneId.of("Europe/Berlin")); dateFieldNewClippingTime.setValue(value); dateFieldNewClippingTime.setLocale(VaadinSession.getCurrent().getLocale()); dateFieldNewClippingTime.setResolution(DateTimeResolution.MINUTE); dateFieldNewClippingTime.addStyleName("time-only"); Button buttonAddClippingTime = new Button(); buttonAddClippingTime.setIcon(VaadinIcons.PLUS); buttonAddClippingTime.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddClippingTime.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); buttonAddClippingTime.addClickListener(e -> { LocalTime generalTime = dateFieldNewClippingTime.getValue().toLocalTime(); layoutClippingTimes.addComponent(getTimeRow(user, generalTime)); UserUtils.addClippingSendTime(user, generalTime); }); layoutAddNewClippingTime.addComponents(dateFieldNewClippingTime, buttonAddClippingTime); layoutAddNewClippingTime.setComponentAlignment(dateFieldNewClippingTime, Alignment.MIDDLE_LEFT); layoutAddNewClippingTime.setComponentAlignment(buttonAddClippingTime, Alignment.MIDDLE_CENTER); layoutAddNewClippingTime.setExpandRatio(dateFieldNewClippingTime, 5); layoutClippingTimes = new VerticalLayout(); layoutClippingTimes.setMargin(new MarginInfo(true, false, false, true)); layoutClippingTimes.setCaption(Language.get(Word.CLIPPING_TIMES)); layoutClippingTimes.setWidth("100%"); layoutClippingTimes.addStyleName("times"); Set<LocalTime> userTimes = user.getClippingTime(); userTimes.forEach(t -> layoutClippingTimes.addComponent(getTimeRow(user, t))); formLayoutClippingDetails.addComponents(layoutCheckBoxReceiveEmails, layoutAddNewClippingTime, layoutClippingTimes); return root; }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
private Component getTimeRow(User user, LocalTime time) { HorizontalLayout layoutTimeRow = new HorizontalLayout(); layoutTimeRow.setWidth("100%"); DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT); Label labelTime = new Label(time.format(formatter)); Button buttonDelete = new Button(VaadinIcons.TRASH); buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER); buttonDelete.setWidth("80px"); buttonDelete.addClickListener(e -> { if (layoutClippingTimes.getComponentCount() > 1) { layoutClippingTimes.removeComponent(layoutTimeRow); UserUtils.removeClippingSendTime(user, time); } else {/*from w w w . j av a2 s. c om*/ VaadinUtils.errorNotification(Language.get(Word.AT_LREAST_ONE_TIME)); } }); layoutTimeRow.addComponents(labelTime, buttonDelete); layoutTimeRow.setComponentAlignment(labelTime, Alignment.MIDDLE_LEFT); layoutTimeRow.setComponentAlignment(buttonDelete, Alignment.MIDDLE_CENTER); layoutTimeRow.setExpandRatio(labelTime, 5); return layoutTimeRow; }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
private Component buildFooter(User user) { HorizontalLayout footer = new HorizontalLayout(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Unit.PERCENTAGE); Button cancelButton = new Button(Language.get(Word.CANCEL)); cancelButton.setIcon(VaadinIcons.CLOSE); cancelButton.addClickListener(event -> { close();//from w w w . jav a 2 s .co m }); saveButton = new Button(Language.get(Word.SAVE)); saveButton.setIcon(VaadinIcons.CHECK); saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY); saveButton.addClickListener(event -> { boolean error = false; if (!user.getFirstName().equals(firstNameField.getValue())) { boolean success = UserUtils.changeFirstName(user, firstNameField.getValue()); if (!success) { error = true; } } if (!user.getLastName().equals(lastNameField.getValue())) { boolean success = UserUtils.changeLastName(user, lastNameField.getValue()); if (!success) { error = true; } } if (!user.getUsername().equals(usernameField.getValue())) { boolean success = UserUtils.changeUsername(user, usernameField.getValue()); if (!success) { error = true; } } if (!user.getEmail().equals(emailField.getValue())) { UI.getCurrent().addWindow(ActivateWindow.get()); boolean success = UserUtils.changeEmail(user, user.getEmail(), emailField.getValue(), emailField.getValue()); if (!success) { error = true; } } boolean wrongPW = false; if (!password1Field.isEmpty() && password1Field.getValue().equals(password2Field.getValue())) { wrongPW = !UserUtils.changePassword(user, oldPasswordField.getValue(), password1Field.getValue(), password2Field.getValue()); } if (error) { VaadinUtils.errorNotification(Language.get(Word.UNEXPECTED_ERROR)); } else if (wrongPW) { VaadinUtils.errorNotification(Language.get(Word.WRONG_PASSWORD)); } else { VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED)); close(); } }); saveButton.focus(); Label placeholder = new Label(); footer.addComponents(placeholder, cancelButton, saveButton); footer.setExpandRatio(placeholder, 5); footer.setComponentAlignment(cancelButton, Alignment.TOP_CENTER); footer.setComponentAlignment(saveButton, Alignment.TOP_CENTER); return footer; }
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java
License:Open Source License
/** * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts. * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener, * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt * anzuzeigen./*from w w w . j a v a 2 s. co m*/ * * @author Christian Scherer, Mirko Gpfrich, Marco Glaser * @param project * das darzustellende Projekt und der aktuelle Index der Liste * @param i * der Index der zu erstellenden Komponente (besonders fuer den * Loeschbutton relevant) * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient */ private VerticalLayout generateSingleProjectUI(Project project, int i) { final Project proj = project; final int a = i; //erzeugt eine Panel fr ein Projekt singleProject = new VerticalLayout(); HorizontalLayout container = new HorizontalLayout(); container.setSizeFull(); if (i == 0) { singleProject.setStyleName("singleProjectSelected"); presenter.projectSelected(project); } else { singleProject.setStyleName("singleProject"); } Embedded icon = new Embedded(null, new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png")); icon.setHeight(40, UNITS_PIXELS); icon.setWidth(40, UNITS_PIXELS); Label gap1 = new Label(); Label gap2 = new Label(); Label gap3 = new Label(); gap1.setWidth("15px"); gap2.setWidth("15px"); gap3.setSizeFull(); Label projectName = new Label(project.getName()); projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0); projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0); projectName.setStyleName("projectName"); //Legt ein Layout fr das Projekt-Panel fest //panelContent.setSizeFull(); container.addComponent(gap1); container.addComponent(icon); container.addComponent(gap2); container.addComponent(projectName); container.addComponent(gap3); container.setExpandRatio(gap3, 1.0f); singleProject.addComponent(container); singleProject.setWidth(100, UNITS_PERCENTAGE); singleProject.setHeight(70, UNITS_PIXELS); container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER); container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER); singleProject.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(LayoutClickEvent event) { presenter.projectSelected(proj); switchProjectsStyle(a); eventBus.fireEvent(new SelectProjectEvent()); } }); // singleProject.addListener(this); // projectListPanel.addComponent(singleProject); logger.debug("Einzelnes Projektelement erzeugt"); return singleProject; }
From source file:dhbw.ka.mwi.businesshorizon2.ui.login.LogInScreenViewImplv2.java
License:Open Source License
/** * Erzeugt die Felder, die fr die Regisitrierung eines neuen Users bentigt werden * Gibt diese im Richtigen Layout zurck/* w w w. j av a 2s . c o m*/ * @author Felix Schlosser * @return HorizontalLayout */ private HorizontalLayout generateRegisterLayout() { //Erstellen der LayoutContainer fr den Registrierungsdialog HorizontalLayout registerComponent = new HorizontalLayout(); registerComponent.setSizeFull(); registerComponent.setMargin(true, true, true, true); HorizontalLayout registerFields = new HorizontalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); VerticalLayout credentials = new VerticalLayout(); VerticalLayout required = new VerticalLayout(); VerticalLayout optional = new VerticalLayout(); //Erstellen des Email-Feld textfieldEmailAdress = new TextField("Emailadresse eingeben"); textfieldEmailAdress.setRequired(true); textfieldEmailAdress.setRequiredError("Pflichtfeld"); //Erstellen des Passwort-Feld passwordFieldPassword = new PasswordField("Passwort eingeben"); passwordFieldPassword.setRequired(true); passwordFieldPassword.setRequiredError("Pflichtfeld"); passwordFieldPassword.setDescription( "Geben Sie bitte ein Passwort (8-12 Zeichen) ein, das folgende Kriterien erfllt: Mindestens ein Gro- und ein Kleinbuchstabe, Zahl, Sonderzeichen."); //Erstellen des Passwort-Wiederholen Feld passwordFieldPasswordRep = new PasswordField("Passwort wiederholen"); passwordFieldPasswordRep.setRequired(true); passwordFieldPasswordRep.setRequiredError("Pflichtfeld"); // Felder zur Layoutkomponente hinzufgen credentials.addComponent(textfieldEmailAdress); credentials.addComponent(passwordFieldPassword); credentials.addComponent(passwordFieldPasswordRep); //Erstellen des Vorname-Feld textfieldFirstName = new TextField("Vorname eingeben"); textfieldFirstName.setRequired(true); textfieldFirstName.setRequiredError("Pflichtfeld"); //Erstellen des Nachname-Feld textfieldLastName = new TextField("Nachname eingeben"); textfieldLastName.setRequired(true); textfieldLastName.setRequiredError("Pflichtfeld"); //Felder zur Layoutkomponente hinzufgen required.addComponent(textfieldFirstName); required.addComponent(textfieldLastName); //Erstellen Firmenname-Feld textfieldCompany = new TextField("Firmenname eingeben"); textfieldCompany.setRequired(true); textfieldCompany.setRequiredError("Pflichtfeld"); //Feld zur Layoutkomponente hinzufgen optional.addComponent(textfieldCompany); //Registrieren-Button erstellen dialogRegBtnLayout = new VerticalLayout(); dialogRegBtn = new Button("", this); dialogRegBtn.setWidth(100, Sizeable.UNITS_PIXELS); dialogRegBtn.setHeight(100, Sizeable.UNITS_PIXELS); dialogRegBtn.addStyleName("dialogRegBtn"); dialogRegBtnLabel = new Label("Registrieren"); dialogRegBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); dialogRegBtnLabel.addStyleName("dialogRegBtnLabel"); dialogRegBtnLayout.addComponent(dialogRegBtn); dialogRegBtnLayout.addComponent(dialogRegBtnLabel); dialogRegBtnLayout.setSizeUndefined(); //Abbrechen-Button erstellen registerAbortBtnLayout = new VerticalLayout(); registerAbortBtn = new Button("", this); registerAbortBtn.setWidth(100, Sizeable.UNITS_PIXELS); registerAbortBtn.setHeight(100, Sizeable.UNITS_PIXELS); registerAbortBtn.addStyleName("registerAbortBtn"); registerAbortBtnLabel = new Label("Abbrechen"); registerAbortBtnLabel.setWidth(100, Sizeable.UNITS_PIXELS); registerAbortBtnLayout.addComponent(registerAbortBtn); registerAbortBtnLayout.addComponent(registerAbortBtnLabel); buttonLayout.addComponent(dialogRegBtnLayout); buttonLayout.addComponent(registerAbortBtnLayout); buttonLayout.setMargin(true, true, true, true); registerFields.addComponent(credentials); registerFields.addComponent(required); registerFields.addComponent(optional); registerFields.setMargin(true); registerComponent.addComponent(registerFields); registerComponent.addComponent(buttonLayout); registerComponent.setComponentAlignment(buttonLayout, Alignment.TOP_RIGHT); return registerComponent; }
From source file:ec.com.vipsoft.ce.ui.FacturaView.java
public void construirGui() { HorizontalLayout l1 = new HorizontalLayout(); l1.setSpacing(true);// w w w .j a v a 2s .c o m tipoFactura = new ComboBox(); tipoFactura.addItem("regular"); tipoFactura.setItemCaption("regular", "REGULAR"); tipoFactura.addItem("exportacion"); tipoFactura.setItemCaption("exportacion", "EXPORTACION"); tipoFactura.addItem("reembolso"); tipoFactura.setItemCaption("reembolso", "REEMBOLSO"); tipoFactura.setNullSelectionAllowed(false); tipoFactura.setValue("regular"); tipoIdentificacion = new ComboBox(); tipoIdentificacion.addItem("05"); tipoIdentificacion.setItemCaption("05", "CEDULA"); tipoIdentificacion.addItem("06"); tipoIdentificacion.setItemCaption("06", "PASAPORTE"); tipoIdentificacion.addItem("07"); tipoIdentificacion.setItemCaption("07", "FINAL"); tipoIdentificacion.addItem("08"); tipoIdentificacion.setItemCaption("08", "ID EXTERIOR"); tipoIdentificacion.addItem("04"); tipoIdentificacion.setItemCaption("04", "RUC"); tipoIdentificacion.setNullSelectionAllowed(false); tipoIdentificacion.setValue("04"); l1.addComponent(tipoIdentificacion); rucBeneficiario = new CampoNumeroIdentificacion(); l1.addComponent(rucBeneficiario); Label lrazonSocial = new Label("R. Social"); l1.addComponent(lrazonSocial); razonSocialBeneficiario = new CampoRazonSocial(); l1.addComponent(razonSocialBeneficiario); Label ldireccion = new Label("Dir."); l1.addComponent(ldireccion); direccion = new CampoDireccion(); l1.addComponent(direccion); fechaEmision = new CampoFecha(); l1.addComponent(fechaEmision); ////////////////////////////////////////// HorizontalLayout l2 = new HorizontalLayout(); l2.setSpacing(true); Label lordenCompra = new Label("OC"); setMargin(true); l2.addComponent(lordenCompra); ordenCompra = new TextField(); ordenCompra.setWidth("70px"); l2.addComponent(ordenCompra); Label lvencimiento = new Label("Cond. Pago"); l2.addComponent(lvencimiento); formaPago = new CampoCodigo(); formaPago.setWidth("100px"); l2.addComponent(formaPago); Label lguia = new Label("Gua Remisin"); l2.addComponent(lguia); numeroGuiaRemision = new CampoNumeroComprobante(); l2.addComponent(numeroGuiaRemision); Label lsucursalCliente = new Label("Sucursal cliente"); l2.addComponent(lsucursalCliente); codigoEstablecimientoDestino = new CampoCodigo(); codigoEstablecimientoDestino.setInputPrompt("001"); codigoEstablecimientoDestino.setWidth("70px"); l2.addComponent(codigoEstablecimientoDestino); //////////////////////////////// codigoIVA = new ComboBox(); codigoIVA.addItem("0"); codigoIVA.addItem("2"); codigoIVA.setNullSelectionAllowed(false); codigoIVA.setValue("2"); codigoIVA.setItemCaption("0", "0%"); codigoIVA.setItemCaption("2", "12%"); codigoIVA.setWidth("80px"); HorizontalLayout l3 = new HorizontalLayout(); l3.setSpacing(true); botonBuscarDetalle = new BotonBuscar(); l3.addComponent(botonBuscarDetalle); codigoP = new TextField(); codigoP.setWidth("80px"); l3.addComponent(codigoP); bienSeleccionado = new TextField(); bienSeleccionado.setWidth("150px"); l3.addComponent(bienSeleccionado); l3.addComponent(new Label("IVA")); l3.addComponent(codigoIVA); Label lcantidad = new Label("Cant."); l3.addComponent(lcantidad); cantidad = new CampoCantidad(); l3.addComponent(cantidad); Label lvalorU = new Label("V. Unitario"); l3.addComponent(lvalorU); valorUnitario = new CampoDinero(); l3.addComponent(valorUnitario); Label ldescuento = new Label("Dcto."); l3.addComponent(ldescuento); descuento = new CampoDinero(); l3.addComponent(descuento); Label labelLote = new Label("lote"); l3.addComponent(labelLote); lote = new TextField(); lote.setInputPrompt("lote 323, expira 2016-05-22"); lote.setWidth("165px"); botonAnadirDetalle = new BotonAnadir(); l3.addComponent(lote); l3.addComponent(botonAnadirDetalle); botonEliminarDetalle = new BotonRemoverDetalle(); l3.addComponent(botonEliminarDetalle); botonRegistrar = new BotonRegistrar(); botonCancelar = new BotonCancelar(); //l3.addComponent(botonRegistrar); //l3.addComponent(botonCancelar); //////////////////////////////////////// HorizontalLayout l4 = new HorizontalLayout(); l4.setSizeFull(); tablaDetalles = new Grid(); beanContainerDetalles = new BeanItemContainer<FacturaDetalleBinding>(FacturaDetalleBinding.class); tablaDetalles.setContainerDataSource(beanContainerDetalles); // tablaDetalles.setEditorEnabled(true); // tablaDetalles.setPageLength(5); // tablaDetalles.setSelectable(true); // tablaDetalles.setMultiSelect(false); tablaDetalles.setWidth("100%"); tablaDetalles.setReadOnly(true); tablaDetalles.removeColumn("infoAdicional3"); tablaDetalles.removeColumn("infoAdicional2"); tablaDetalles.removeColumn("codigoAlterno"); tablaDetalles.removeColumn("codigoIVA"); tablaDetalles.removeColumn("ice"); tablaDetalles.setColumnOrder("cantidad", "codigo", "descripcion", "infoAdicional1", "valorUnitario", "descuento", "iva12", "valorTotal"); l4.addComponent(tablaDetalles); l4.setComponentAlignment(tablaDetalles, Alignment.MIDDLE_CENTER); ///////////////////////////////////////////////////////7 HorizontalLayout l5 = new HorizontalLayout(); l5.setSpacing(true); l5.addComponent(tipoFactura); Label lcountry = new Label("PAIS DETINO"); l5.addComponent(lcountry); comboPaisDestino = construirComboPaises(); l5.addComponent(comboPaisDestino); HorizontalLayout l6 = new HorizontalLayout(); l6.setSpacing(true); subtotal = new Label("Subtotal $0.00"); iva12 = new Label("IVA12% $0.00"); ice = new Label("ICE $0.00"); total = new Label("TOTAL $0.00"); l6.addComponent(subtotal); l6.addComponent(iva12); l6.addComponent(ice); l6.addComponent(total); l6.addComponent(botonRegistrar); l6.addComponent(botonCancelar); l5.addComponent(l6); // l5.addComponent(botonRegistrar); // l5.addComponent(botonCancelar); // l5.setSizeFull(); // VerticalLayout v1=new VerticalLayout(); // Label linfo=new Label("Info"); // HorizontalLayout vl1=new HorizontalLayout(); // vl1.setSpacing(true); // vl1.addComponent(linfo); // // v1.addComponent(vl1); // VerticalLayout v2=new VerticalLayout(); // v2.setSizeFull(); // // HorizontalLayout v2l1=new HorizontalLayout(); // v2l1.addComponent(botonRegistrar); // v2l1.addComponent(botonCancelar); // v2.addComponent(v2l1); // v2.setComponentAlignment(v2l1, Alignment.TOP_RIGHT); // l5.addComponent(v1); // l5.addComponent(v2); ////////////////////////////////////////////// setSpacing(true); addComponent(l1); addComponent(l2); addComponent(l3); addComponent(l4); addComponent(l5); setComponentAlignment(l1, Alignment.MIDDLE_CENTER); setComponentAlignment(l2, Alignment.MIDDLE_CENTER); setComponentAlignment(l3, Alignment.MIDDLE_CENTER); setComponentAlignment(l4, Alignment.MIDDLE_CENTER); // setComponentAlignment(l5, Alignment.MIDDLE_CENTER); }
From source file:ed.cracken.pos.ui.purchases.PurchaserView.java
public HorizontalLayout createFooter() { total = new Label("<h2><strong>Total:</strong></h2>"); total.setContentMode(ContentMode.HTML); totalValue = new Label("<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>"); totalValue.setContentMode(ContentMode.HTML); quantity = new Label("<h2><strong>Cantidad:</strong></h2>"); quantity.setContentMode(ContentMode.HTML); quantityValue = new Label( "<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>"); quantityValue.setContentMode(ContentMode.HTML); saveTrx = new Button("Guardar", FontAwesome.CHECK_CIRCLE_O); saveTrx.addStyleName(ValoTheme.BUTTON_PRIMARY); saveTrx.setHeight("60px"); saveTrx.addClickListener((Button.ClickEvent event) -> { UI.getCurrent().addWindow(paymentView); });/* w w w. j ava 2 s . c o m*/ cancelTrx = new Button("Cancelar", FontAwesome.CLOSE); cancelTrx.addStyleName(ValoTheme.BUTTON_DANGER); cancelTrx.setHeight("60px"); HorizontalLayout bottom = new HorizontalLayout(); HorizontalLayout labelsArea = new HorizontalLayout(); HorizontalLayout buttonsArea = new HorizontalLayout(); labelsArea.setSpacing(true); labelsArea.addComponent(total); labelsArea.addComponent(totalValue); labelsArea.addComponent(quantity); labelsArea.addComponent(quantityValue); labelsArea.setComponentAlignment(total, Alignment.MIDDLE_LEFT); labelsArea.setComponentAlignment(totalValue, Alignment.MIDDLE_LEFT); labelsArea.setComponentAlignment(quantity, Alignment.MIDDLE_RIGHT); labelsArea.setComponentAlignment(quantityValue, Alignment.MIDDLE_RIGHT); buttonsArea.setSpacing(true); buttonsArea.addComponent(saveTrx); buttonsArea.addComponent(cancelTrx); bottom.setSpacing(true); bottom.addComponent(buttonsArea); bottom.addComponent(labelsArea); bottom.setComponentAlignment(buttonsArea, Alignment.MIDDLE_LEFT); bottom.setComponentAlignment(labelsArea, Alignment.MIDDLE_RIGHT); bottom.setWidth("100%"); return bottom; }
From source file:edu.kit.dama.ui.admin.administration.user.UserDataAdministrationTab.java
License:Apache License
private VerticalLayout getMainLayout() { if (mainLayout == null) { String id = "mainLayout"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); mainLayout = new VerticalLayout(); mainLayout.setId(DEBUG_ID_PREFIX + id); mainLayout.setSizeFull();/*w ww . j a v a 2s. co m*/ mainLayout.setMargin(true); mainLayout.setSpacing(true); HorizontalLayout filterButtons = new HorizontalLayout(getRemoveAllFiltersButton(), getAddFilterButton()); filterButtons.setComponentAlignment(getRemoveAllFiltersButton(), Alignment.BOTTOM_RIGHT); filterButtons.setComponentAlignment(getAddFilterButton(), Alignment.BOTTOM_RIGHT); // Add components to mainLayout mainLayout.addComponent(getUserDataForm()); mainLayout.addComponent(filterButtons); mainLayout.addComponent(getUserDataTablePanel()); mainLayout.setComponentAlignment(filterButtons, Alignment.BOTTOM_RIGHT); } return mainLayout; }