com.vaadin.flow.component.HasComponents Java Examples
The following examples show how to use
com.vaadin.flow.component.HasComponents.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AttachListenerView.java From flow with Apache License 2.0 | 6 votes |
private Input createRadioButton(HasComponents parent, String id, String group, String text) { Input input = new Input(); input.getElement().setAttribute("type", "radio") .setAttribute("name", group).setAttribute("value", text) .addPropertyChangeListener("checked", "change", event -> { }); input.setId(id); radioButtons.put(id, input); Label label = new Label(text); label.setFor(id); parent.add(input, label); return input; }
Example #2
Source File: LayoutHelper.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public static void add(HasComponents element, Component... components) { if (components == null) { throw new AssertionError(); } else { for (final Component component : components) { if (component == null) { throw new AssertionError(); } element.getElement().appendChild(component.getElement()); } } }
Example #3
Source File: MainLayout.java From crudui with Apache License 2.0 | 5 votes |
public void addSourceCodeAnchorToCurrentView() { Class<? extends HasComponents> viewClass = tabToView.get(tabs.getSelectedTab()); if (!HomeView.class.equals(viewClass)) { HorizontalLayout footer = new HorizontalLayout(new Anchor(DemoUtils.getGitHubLink(viewClass), "Source code")); footer.setMargin(true); ((HasComponents) getContent()).add(footer); } }
Example #4
Source File: SubPropertyModelTemplate.java From flow with Apache License 2.0 | 5 votes |
@EventHandler private void sync() { Div div = new Div(); div.setId("synced-msg"); div.setText(getStatus().getMessage()); ((HasComponents) getParent().get()).add(div); }
Example #5
Source File: SubPropertyModelTemplate.java From flow with Apache License 2.0 | 5 votes |
@EventHandler private void valueUpdated() { Div div = new Div(); div.setId("value-update"); div.setText(getStatus().getMessage()); ((HasComponents) getParent().get()).add(div); }
Example #6
Source File: SubPropertyModelTemplate.java From flow with Apache License 2.0 | 5 votes |
@EventHandler private void click(@ModelItem("status") Status statusItem) { Div div = new Div(); div.setId("statusClick"); div.setText(statusItem.getMessage()); ((HasComponents) getParent().get()).add(div); }
Example #7
Source File: ClearNodeChildrenView.java From flow with Apache License 2.0 | 5 votes |
private void addDivTo(HasComponents container) { Div div = new Div(); div.setText( "Server div " + (container.getElement().getChildCount() + 1)); div.addAttachListener(evt -> message.setText( message.getText() + "\nDiv '" + div.getText() + "' attached.")); div.addDetachListener(evt -> message.setText( message.getText() + "\nDiv '" + div.getText() + "' detached.")); container.add(div); }
Example #8
Source File: MainLayout.java From crudui with Apache License 2.0 | 4 votes |
private void addTab(Class<? extends HasComponents> clazz) { Tab tab = new Tab(DemoUtils.getViewName(clazz)); tabs.add(tab); tabToView.put(tab, clazz); viewToTab.put(clazz, tab); }
Example #9
Source File: MainLayout.java From crudui with Apache License 2.0 | 4 votes |
public void updatePageTitle() { Class<? extends HasComponents> viewClass = tabToView.get(tabs.getSelectedTab()); UI.getCurrent().getPage().setTitle(DemoUtils.getViewName(viewClass) + " - " + "Crud UI add-on demo"); }
Example #10
Source File: ClearNodeChildrenView.java From flow with Apache License 2.0 | 4 votes |
private void clear(HasComponents container, String id) { container.removeAll(); message.setText(message.getText() + "\nDiv '" + id + "' cleared."); }