List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:dhbw.clippinggorilla.userinterface.windows.ManageSourcesWindow.java
public Component getSourcesList() { VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setSizeFull();/* w ww . j a v a 2 s . c om*/ sourcesLayout = new VerticalLayout(); sourcesLayout.setWidth("100%"); Panel sourcesPanel = new Panel(sourcesLayout); refreshSources(); sourcesPanel.setContent(sourcesLayout); sourcesPanel.setHeight("100%"); windowLayout.addComponent(sourcesPanel); windowLayout.setExpandRatio(sourcesPanel, 1); windowLayout.setSpacing(false); windowLayout.setMargin(false); TextField textFieldSearch = new TextField(); textFieldSearch.setPlaceholder(Language.get(Word.SEARCH)); textFieldSearch.addValueChangeListener(searchValue -> { sourceLayouts.forEach((sourceName, sourceLayout) -> { if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "") .replaceAll("-", "").replaceAll("_", ""))) { sourcesLayout.removeComponent(sourceLayout); } else { sourcesLayout.addComponent(sourceLayout); } }); }); Button buttonAddSource = new Button(Language.get(Word.ADD_SOURCE), VaadinIcons.PLUS); buttonAddSource.addClickListener(ce -> UI.getCurrent().addWindow(NewSourceWindow.create())); Button buttonSave = new Button(); Language.set(Word.SAVE, buttonSave); buttonSave.setIcon(VaadinIcons.CHECK); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { close(); }); buttonSave.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); Label placeholder = new Label(); GridLayout footer = new GridLayout(4, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.addStyleName("menubar"); footer.setWidth(100.0f, Unit.PERCENTAGE); footer.addComponents(textFieldSearch, placeholder, buttonAddSource, buttonSave); footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(buttonAddSource, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(buttonSave, Alignment.MIDDLE_CENTER); footer.setColumnExpandRatio(1, 5); windowLayout.addComponent(footer); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
private void refreshList(GridLayout grid, Crawler c) { VerticalLayout layoutList = new VerticalLayout(); layoutList.setWidth("100%"); layoutList.setSpacing(false); layoutList.setMargin(false);//from w ww .j ava 2 s. c o m Panel panelList = new Panel(layoutList); panelList.setHeight("325px"); c.getIncludesByClass() .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null))); c.getIncludesByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null))); c.getIncludesByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null))); c.getIncludesByAttribute() .forEach((k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v))); c.getExcludeByClass() .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null))); c.getExcludeByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null))); c.getExcludeByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null))); c.getExcludeByAttribute().forEach( (k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v))); grid.removeComponent(1, 0); grid.addComponent(panelList, 1, 0); }
From source file:dhbw.clippinggorilla.userinterface.windows.PreferencesWindow.java
private Component buildSupportTab(User user) { VerticalLayout root = new VerticalLayout(); root.setCaption(Language.get(Word.SUPPORT)); root.setIcon(VaadinIcons.HEADSET);//w w w. jav a 2 s .c o m root.setWidth("100%"); root.setHeight("100%"); root.setSpacing(true); root.setMargin(true); TextArea textAreaMessage = new TextArea(Language.get(Word.MESSAGE)); textAreaMessage.setWidth("100%"); textAreaMessage.setHeight("100%"); Button buttonSend = new Button(Language.get(Word.SEND), VaadinIcons.ENVELOPE); buttonSend.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSend.addClickListener(ce -> { try { if (emailsSend.containsKey(user)) { Map<LocalDate, Integer> times = emailsSend.get(user); if (times.containsKey(LocalDate.now())) { if (times.get(LocalDate.now()) > 3) { if (times.get(LocalDate.now()) > 15) { UserUtils.banUser(user); VaadinUtils.errorNotification("BANNED DUE TO TOO MUCH EMAILS"); } else { VaadinUtils.errorNotification("TOO MUCH EMAILS"); } return; } else { times.put(LocalDate.now(), times.get(LocalDate.now()) + 1); } } else { times.put(LocalDate.now(), 1); } } else { HashMap<LocalDate, Integer> times = new HashMap<>(); times.put(LocalDate.now(), 1); emailsSend.put(user, times); } Mail.send(Props.get("supportmail"), "SUPPORT", user.toString() + "\n" + textAreaMessage.getValue()); VaadinUtils.middleInfoNotification(Language.get(Word.SUCCESSFULLY_SEND)); textAreaMessage.clear(); } catch (EmailException ex) { VaadinUtils.errorNotification(Language.get(Word.SEND_FAILED)); Log.error("Could not send Supportmail: ", ex); } }); root.addComponents(textAreaMessage, buttonSend); root.setExpandRatio(textAreaMessage, 5); root.setComponentAlignment(buttonSend, Alignment.MIDDLE_LEFT); return root; }
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java
License:Open Source License
/** * Zeige das Projekt-Hinzufuegen-Dialogfenster, bei dem ein Eingabefeld fuer * den Namen des Projekts und ein Hinzfuege-Button vorhanden ist. Funktion * bei geklicktem Button siehe Clicklistener in dieser Klasse. Das * horizontale Layout zur Darstellung besitzt ein Formlayout und den Button, * die nebeneinander dargestellt werden. * // ww w. j a v a 2 s . com * @author Christian Scherer, Mirko Gpfrich */ @Override public void showAddProjectDialog() { addDialog = new Window("Projekt hinzufgen"); addDialog.setModal(true); addDialog.setWidth(410, UNITS_PIXELS); addDialog.setResizable(false); addDialog.setDraggable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(false); FormLayout formLayout = new FormLayout(); formLayout.setMargin(true); formLayout.setSpacing(true); //TextFeld fr Name dem Formular hinzufgen tfName = new TextField("Name whlen:"); tfName.setRequired(true); tfName.addValidator(new StringLengthValidator("Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2, 20, false)); tfName.setRequiredError("Pflichtfeld"); tfName.setSizeFull(); formLayout.addComponent(tfName); //TextArea fr Beschreibung dem Formular hinzufgen taDescription = new TextArea("Beschreibung whlen"); taDescription.setSizeFull(); formLayout.addComponent(taDescription); //Formular dem Layout hinzufgen layout.addComponent(formLayout); //Hinzufge-Button erstllen und dem Layout hinzufgen dialogAddBtn = new Button("Hinzufgen", this); layout.addComponent(dialogAddBtn); //Layout dem Dialog-Fenster hinzufgen addDialog.addComponent(layout); //Dialog dem Hauptfenster hinzufgen getWindow().addWindow(addDialog); logger.debug("Hinzufuege-Dialog erzeugt"); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java
License:Open Source License
/**Methode zur Implementierung des Dialogfensters fr Projekt-nderungen. * //from ww w. j a v a 2 s .co m */ @Override public void showEditProjectDialog(Project project) { editDialog = new Window("Projekt bearbeiten"); editDialog.setModal(true); editDialog.setWidth(410, UNITS_PIXELS); editDialog.setResizable(false); editDialog.setDraggable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); FormLayout formLayout = new FormLayout(); formLayout.setMargin(true); formLayout.setSpacing(true); //TextFeld fr Name dem Formular hinzufgen tfName = new TextField("Name ndern:", project.getName()); tfName.setRequired(true); tfName.addValidator(new StringLengthValidator("Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2, 20, false)); tfName.setRequiredError("Pflichtfeld"); tfName.setSizeFull(); formLayout.addComponent(tfName); //TextArea fr Beschreibung dem Formular hinzufgen taDescription = new TextArea("Beschreibung ndern:", project.getDescription()); taDescription.setSizeFull(); formLayout.addComponent(taDescription); //Formular dem Layout hinzufgen layout.addComponent(formLayout); //Speichern-Button erstllen und dem Layout hinzufgen //TODO: ist das korrekt? Gute Frage, I have no idea what u r doing dialogEditBtn = new Button("Speichern"); layout.addComponent(dialogEditBtn); dialogEditBtn.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (tfName.isValid()) { boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(), (String) taDescription.getValue()); if (succed) { getWindow().removeWindow(editDialog); logger.debug("Projekt-bearbeiten Dialog geschlossen"); } } else { getWindow().showNotification("", "Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an", Notification.TYPE_ERROR_MESSAGE); } } }); //Layout dem Dialog-Fenster hinzufgen editDialog.addComponent(layout); //Dialog dem Hauptfenster hinzufgen getWindow().addWindow(editDialog); logger.debug("Bearbeiten-Dialog erzeugt"); }
From source file:ec.com.vipsoft.ce.ui.FacturaView.java
@PostConstruct public void postconstructor() { construirGui();/*w ww. ja va2 s . c om*/ tipoIdentificacion.addValueChangeListener(event -> { String seleccionado = (String) tipoIdentificacion.getValue(); if (seleccionado.equalsIgnoreCase("07")) { razonSocialBeneficiario.setValue("Consumidor Final"); rucBeneficiario.setValue("9999999999999"); direccion.setValue("Consumidor Final"); razonSocialBeneficiario.setReadOnly(true); rucBeneficiario.setReadOnly(true); direccion.setReadOnly(true); } else { razonSocialBeneficiario.setReadOnly(false); rucBeneficiario.setReadOnly(false); direccion.setReadOnly(false); } }); final SimpleStringFilter filtro; gridBusqueda = new Grid(); beaitem = new BeanItemContainer<BienEconomico>(BienEconomico.class); gridBusqueda.setContainerDataSource(beaitem); gridBusqueda.setSizeFull(); // gridBusqueda.setVisibleColumns(new Object[]{"codigo","descripcion"}); gridBusqueda.removeColumn("id"); gridBusqueda.removeColumn("codigoIva"); gridBusqueda.removeColumn("codigoIce"); gridBusqueda.removeColumn("entidad"); gridBusqueda.setColumnOrder("codigo", "descripcion"); gridBusqueda.setSelectionMode(SelectionMode.SINGLE); // tfiltro.setImmediate(true); botonSeleccionaDesdeVentanar = new Button("seleccionar"); HorizontalLayout lbus = new HorizontalLayout(); lbus.setSpacing(true); lbus.setMargin(true); lbus.addComponent(new Label("cdigo")); lbus.addComponent(campoBusquedaProducto); lbus.addComponent(botonSeleccionaDesdeVentanar); beaitem.addAll(listadorBienes.listarBienesDisponibles(userInfo.getRucEmisor())); VerticalLayout layoutventana = new VerticalLayout(); layoutventana.setSpacing(true); layoutventana.setMargin(true); layoutventana.addComponent(lbus); layoutventana.addComponent(gridBusqueda); ventana.setContent(layoutventana); ventana.center(); iniciarEventos(); this.campoBusquedaProducto .addTextChangeListener((FieldEvents.TextChangeListener) new FieldEvents.TextChangeListener() { private static final long serialVersionUID = 5128049403423426140L; SimpleStringFilter filter; public void textChange(FieldEvents.TextChangeEvent event) { Container.Filterable f = (Container.Filterable) gridBusqueda.getContainerDataSource(); if (this.filter != null) { f.removeContainerFilter((Container.Filter) this.filter); } this.filter = new SimpleStringFilter((Object) "codigo", event.getText(), true, false); f.addContainerFilter((Container.Filter) this.filter); } }); }
From source file:ed.cracken.pos.ui.products.ProductForm.java
public void initComponents() { setId("product-form"); setStyleName("product-form-wrapper"); addStyleName("product-form"); VerticalLayout formLayout = new VerticalLayout(); formLayout.setHeightUndefined();/* ww w . j a v a 2 s . co m*/ formLayout.setSpacing(true); formLayout.setStyleName("form-layout"); formLayout.addComponent(productName = new TextField("Name")); HorizontalLayout priceAndStockLayout = new HorizontalLayout(); priceAndStockLayout.addComponent(price = new TextField("Price")); priceAndStockLayout.addComponent(stockCount = new TextField("Stock")); formLayout.addComponent(priceAndStockLayout); formLayout.addComponent(availability = new ComboBox("Availability")); formLayout.addComponent(category = new CategoryField("Category")); CssLayout separator = new CssLayout(); separator.setStyleName("expander"); formLayout.addComponent(separator); formLayout.addComponent(save = new Button("Save") { { setStyleName("primary"); setId("save"); } }); formLayout.addComponent(cancel = new Button("Cancel") { { setStyleName("cancel"); setId("cancel"); } }); formLayout.addComponent(delete = new Button("Delete") { { setStyleName("danger"); setId("delete"); } }); addComponent(formLayout); }
From source file:ed.cracken.pos.ui.purchases.PurchaseItemForm.java
public PurchaseItemForm(PurchaserLogic viewLogic) { setId("product-form"); setStyleName("product-form-wrapper"); addStyleName("product-form"); VerticalLayout formLayout = new VerticalLayout(); formLayout.setHeightUndefined();/* w ww . ja v a2 s. com*/ formLayout.setSpacing(true); formLayout.setStyleName("form-layout"); formLayout.addComponent(productId = new TextField("Code")); formLayout.addComponent(description = new TextField("Description")); formLayout.addComponent(price = new DecimalNumberField("Price")); formLayout.addComponent(quantity = new DecimalNumberField("Quantity")); formLayout.addComponent(discount = new DecimalNumberField("Discount")); formLayout.addComponent(subtotal = new DecimalNumberField("Subtotal")); price.setConverter(BigDecimal.class); quantity.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { if (!event.getText().isEmpty()) { try { NumberFormat nf = DecimalFormat.getInstance(); nf.setMaximumFractionDigits(2); ItemTo item; BigDecimal r = BigDecimal.valueOf(nf.parse(event.getText()).longValue()) .multiply((item = fieldGroup.getItemDataSource().getBean()).getPrice()); subtotal.setReadOnly(false); subtotal.setValue(nf.format(r.doubleValue())); subtotal.setReadOnly(true); } catch (ParseException ex) { Logger.getLogger(PurchaseItemForm.class.getName()).log(Level.SEVERE, null, ex); } } }); CssLayout separator = new CssLayout(); separator.setStyleName("expander"); formLayout.addComponent(separator); formLayout.addComponent(save = new StyledButton("Aplicar", "primary", "save")); formLayout.addComponent(cancel = new StyledButton("Cancelar", "cancel", "cancel")); formLayout.addComponent(delete = new StyledButton("Quitar", "danger", "delete")); save.addClickListener((Button.ClickEvent event) -> { try { fieldGroup.commit(); viewLogic.updateItem(fieldGroup.getItemDataSource().getBean()); } catch (FieldGroup.CommitException e) { e.printStackTrace(System.err); } }); cancel.addClickListener((Button.ClickEvent event) -> { viewLogic.cancelItemChanges(); }); delete.addClickListener((Button.ClickEvent event) -> { viewLogic.removeItem(fieldGroup.getItemDataSource().getBean()); }); addComponent(formLayout); configBinding(); }
From source file:ed.cracken.pos.ui.purchases.PurchaserPaymentView.java
public PurchaserPaymentView() { super("Forma de pago"); // Set window caption center();//from w ww. j ava 2s . co m VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); HorizontalLayout lyCash = new HorizontalLayout(); HorizontalLayout lyCard = new HorizontalLayout(); content.addComponent(lyCash); content.addComponent(lyCard); lyCash.addComponent(new Label("Efectivo: ")); lyCash.setSpacing(true); lyCash.addComponent(txtCash = new DecimalNumberField()); lyCard.addComponent(new Label("Tarjeta: ")); lyCard.addComponent(txtCard = new DecimalNumberField()); lyCard.setSpacing(true); setContent(content); setClosable(false); setModal(true); HorizontalLayout lyButtons = new HorizontalLayout(); Button ok = new Button("Aceptar"); ok.addClickListener((ClickEvent event) -> { close(); }); lyButtons.addComponent(ok); Button ko = new Button("Cancelar"); ok.addClickListener((ClickEvent event) -> { close(); }); lyButtons.addComponent(ko); lyButtons.setSpacing(true); content.addComponent(lyButtons); }
From source file:ed.cracken.pos.ui.purchases.PurchaserView.java
public PurchaserView() { summary = SellSummaryTo.builder().count(BigDecimal.ZERO).total(BigDecimal.ZERO).build(); setSizeFull();//w w w . ja va 2s . co m addStyleName("crud-view"); viewLogic = new PurchaserLogic(this); paymentView = new PurchaserPaymentView(); grid = new PurchaserGrid(); grid.addSelectionListener((SelectionEvent event) -> { viewLogic.editItem(grid.getSelectedRow()); }); VerticalLayout mainContent = new VerticalLayout(); HorizontalLayout foot; mainContent.addComponent(createTopBar()); mainContent.addComponent(grid); mainContent.addComponent(foot = createFooter()); mainContent.setMargin(true); mainContent.setSpacing(true); mainContent.setSizeFull(); mainContent.setExpandRatio(grid, 1); mainContent.setStyleName("crud-main-layout"); mainContent.setComponentAlignment(foot, Alignment.TOP_CENTER); addComponent(mainContent); addComponent(purchaseItemForm = new PurchaseItemForm(viewLogic)); }