/** * Constructs a VerticalLayout with the given components. The components are * added in the given order. * * @see AbstractOrderedLayout#addComponents(Component...) * * @param children * The components to add. */ public VerticalLayout(Component... children) { this(); addComponents(children); }
/** * Adds the given components to this layout and sets them as expanded. The * height of all added child components are set to 100% so that the * expansion will be effective. The height of this layout is also set to * 100% if it is currently undefined. * <p> * The components are added in the provided order to the end of this layout. * Any components that are already children of this layout will be moved to * new positions. * * @param components * the components to set, not <code>null</code> * @since 8.0 */ public void addComponentsAndExpand(Component... components) { addComponents(components); if (getHeight() < 0) { setHeight(100, Unit.PERCENTAGE); } for (Component child : components) { child.setHeight(100, Unit.PERCENTAGE); setExpandRatio(child, 1); } } }
VerticalLayout l1 = new VerticalLayout(); l1.setSizeFull(); l1.addComponents(icon, navBar, header, worldMap); l1.setExpandRatio(worldMap, 1);
@Override protected void init(VaadinRequest request) { TextField nameField = new TextField(); nameField.setCaption("Your name"); Button button = new Button("Print Hello", event -> { Runtime runtime = Runtime.getRuntime(); printHelloDocument(String.format( "Hello %s!\n" + "Your PC is so powerful:\n" + "%s processors\n" + "%s free memory\n" + "%s max memory", nameField.getValue(), runtime.availableProcessors(), runtime.freeMemory(), runtime.maxMemory())); }); VerticalLayout content = new VerticalLayout(); content.addComponents(nameField, button); setContent(content); }
@Override protected void init(VaadinRequest request) { final HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); VerticalLayout left = new VerticalLayout(), middle = new VerticalLayout(), right = new VerticalLayout(); TextField a1 = new TextField(), b1 = new TextField(), c1 = new TextField(); TextField a2 = new TextField(), b2 = new TextField(); TextField a3 = new TextField(), b3 = new TextField(), c3 = new TextField(); layout.addComponents(left, middle, right); left.addComponents(a1, b1, c1); middle.addComponents(a2, b2); right.addComponents(a3, b3, c3); setContent(layout); }
TextField text = new TextField("Edit"); Grid grid; BeanItemContainer<Customer> container; @Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); container = new BeanItemContainer<>(Customer.class, Arrays.asList(new Customer("1"), new Customer("2"))); grid = new Grid(container); Button open = new Button("open"); open.addClickListener(this :: openListener); Button save = new Button("save"); save.addClickListener(this :: saveListener); layout.addComponents(grid, open, save, text); setContent(layout); } private void openListener(Button.ClickEvent clickEvent){ text.setValue(((Customer) (grid.getSelectedRow())).getName()); } private void saveListener(Button.ClickEvent clickEvent){ Customer c = (Customer) grid.getSelectedRow(); c.setName(text.getValue()); grid.clearSortOrder(); }
private EditorView<T> addSubForm(VerticalLayout parent, ItemProviderStrategy<T> itemProvider) { // create subform MultiFormDefinition<T> multiFormDefinitionClone = MutableWrapper.wrap(definition); FormDefinitionMutator.accessMutable(multiFormDefinitionClone.getForm()) .setName(getSubFormName(multiFormDefinitionClone)); if (itemProvider == null) { itemProvider = () -> multiFormItemProvider.read().map(t -> orderHandler.getOrCreate(t, multiFormDefinitionClone.getForm().getName(), locale)); } EditorView<T> subForm = getViewProvider().create(multiFormDefinitionClone.getForm(), itemProvider); forms.put(subForm, itemProvider); formOrder.add(subForm); // setup buttons, listeners and layout VerticalLayout wrapLayout = new VerticalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.addComponents( new Button(MagnoliaIcons.ARROW2_N, e -> onMove(parent, wrapLayout, MoveDirection.UP)), new Button(MagnoliaIcons.ARROW2_S, e -> onMove(parent, wrapLayout, MoveDirection.DOWN)), new Button(MagnoliaIcons.TRASH, e -> onDelete(parent, subForm))); buttonLayout.forEach(button -> button.addStyleName(ResurfaceTheme.BUTTON_ICON)); wrapLayout.addComponents(subForm.asVaadinComponent(), buttonLayout); parent.addComponent(wrapLayout, parent.getComponentCount() - 1); return subForm; }
@Override protected Component initContent() { VerticalLayout layout = new VerticalLayout(); layout.setStyleName("stats-panel"); if (StringUtils.isNotBlank(styleName)) { layout.addStyleName(styleName); } statText = new Label(getStatistic()); statText.setSizeUndefined(); statText.setStyleName("stats-text"); statText.addStyleName(ValoTheme.LABEL_H1); statLabel = new Label(getStatisticLabel()); statLabel.setSizeUndefined(); statLabel.setStyleName("stats-label"); statLabel.addStyleName(ValoTheme.LABEL_H4); statInfo = new Label(getStatisticInfo(), ContentMode.HTML); statInfo.setStyleName("stats-info"); statPic = new Label(getStatisticIcon(), ContentMode.HTML); statPic.setStyleName("stats-icon"); layout.addComponents(statText, statLabel, statInfo, statPic); return layout; }
layout.addComponents(commandBar, summary, statusBar); layout.setExpandRatio(summary, 1f); layout.setSizeFull();
UploadProgressInfoWindow(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState, final VaadinMessageSource i18n) { this.artifactUploadState = artifactUploadState; this.i18n = i18n; setPopupProperties(); createStatusPopupHeaderComponents(); mainLayout = new VerticalLayout(); mainLayout.setSpacing(Boolean.TRUE); mainLayout.setSizeUndefined(); setPopupSizeInMinMode(); uploads = getGridContainer(); grid = createGrid(); setGridColumnProperties(); mainLayout.addComponents(getCaptionLayout(), grid); mainLayout.setExpandRatio(grid, 1.0F); setContent(mainLayout); eventBus.subscribe(this); ui = UI.getCurrent(); }
UploadProgressInfoWindow(final UIEventBus eventBus, final ArtifactUploadState artifactUploadState, final VaadinMessageSource i18n) { this.artifactUploadState = artifactUploadState; this.i18n = i18n; setPopupProperties(); createStatusPopupHeaderComponents(); mainLayout = new VerticalLayout(); mainLayout.setSpacing(Boolean.TRUE); mainLayout.setSizeUndefined(); setPopupSizeInMinMode(); uploads = getGridContainer(); grid = createGrid(); setGridColumnProperties(); mainLayout.addComponents(getCaptionLayout(), grid); mainLayout.setExpandRatio(grid, 1.0F); setContent(mainLayout); eventBus.subscribe(this); ui = UI.getCurrent(); }
private void buildLayout() { mainLayout = new VerticalLayout(); mainLayout.setSpacing(Boolean.TRUE); mainLayout.setSizeUndefined(); mainLayout.setWidth("200px"); final HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.setSizeFull(); captionLayout.addComponents(windowCaption, minimizeButton, closeButton); captionLayout.setExpandRatio(windowCaption, 1.0F); captionLayout.addStyleName("v-window-header"); final HorizontalLayout uploaderLayout = new HorizontalLayout(); uploaderLayout.addComponent(bulkUploader); uploaderLayout.addComponent(linkToSystemConfigHelp); uploaderLayout.setComponentAlignment(linkToSystemConfigHelp, Alignment.BOTTOM_RIGHT); uploaderLayout.setExpandRatio(bulkUploader, 1.0F); uploaderLayout.setSizeFull(); mainLayout.addComponents(captionLayout, dsNamecomboBox, descTextArea, tokenVerticalLayout, descTextArea, progressBar, targetsCountLabel, uploaderLayout); }
private void buildLayout() { mainLayout = new VerticalLayout(); mainLayout.setSpacing(Boolean.TRUE); mainLayout.setSizeUndefined(); mainLayout.setWidth("200px"); final HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.setSizeFull(); captionLayout.addComponents(windowCaption, minimizeButton, closeButton); captionLayout.setExpandRatio(windowCaption, 1.0F); captionLayout.addStyleName("v-window-header"); final HorizontalLayout uploaderLayout = new HorizontalLayout(); uploaderLayout.addComponent(bulkUploader); uploaderLayout.addComponent(linkToSystemConfigHelp); uploaderLayout.setComponentAlignment(linkToSystemConfigHelp, Alignment.BOTTOM_RIGHT); uploaderLayout.setExpandRatio(bulkUploader, 1.0F); uploaderLayout.setSizeFull(); mainLayout.addComponents(captionLayout, dsNamecomboBox, descTextArea, tokenVerticalLayout, descTextArea, progressBar, targetsCountLabel, uploaderLayout); }
vbar.setMargin(true); filterPanel.setContent(vbar); layout.addComponents(rangeLabelTitle,detailsLayout,filterPanel); entriesPanel.setContent(layout); refreshDetails();
if (getInstance() != null && getInstance().getJournal() != null) { newEntryForm = new NewEntryForm(getInstance(), (TransactionsHelper) getHelper(), entryGrid); vl.addComponents(entryGrid, newEntryForm);