com.vaadin.flow.component.orderedlayout.HorizontalLayout Java Examples
The following examples show how to use
com.vaadin.flow.component.orderedlayout.HorizontalLayout.
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: TopNavigationLink.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public TopNavigationLink(String caption, Component icon, Class<? extends Component> className) { super(); this.className = className; HorizontalLayout wrapper = new HorizontalLayout(); if (icon != null){ wrapper.add(icon); } if(caption != null){ wrapper.add(new Label(caption)); } wrapper.setAlignItems(FlexComponent.Alignment.CENTER); wrapper.setHeight("100%"); add(wrapper); UpNavigationHelper.registerNavigationRoute(className); setRoute(UI.getCurrent().getRouter(), className); setHighlightCondition((routerLink, event) -> UpNavigationHelper.shouldHighlight(className, event.getLocation())); }
Example #2
Source File: GridTest.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public GridTest() { Random random = new Random(); for (int i = 0; i < 300; i++) { people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i)); } Grid<Person> grid = getGrid(); grid.setSelectionMode(Grid.SelectionMode.MULTI); grid.setSizeFull(); HorizontalLayout gridWrapper = new HorizontalLayout(grid); gridWrapper.setMargin(false); gridWrapper.setPadding(false); gridWrapper.setSpacing(false); gridWrapper.setFlexGrow(1, grid); gridWrapper.setSizeFull(); add(gridWrapper); setMargin(false); setPadding(false); setSpacing(false); setAlignItems(Alignment.STRETCH); setFlexGrow(1, gridWrapper); setSizeFull(); }
Example #3
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); layout.add(new Label("< " + getViewName() + " >")); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setMargin(false); setSizeFull(); getElement() .getStyle() .set("overflow", "auto"); }
Example #4
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); layout.add(new Label("< " + getViewName() + " >")); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setMargin(false); setSizeFull(); getElement() .getStyle() .set("overflow", "auto"); }
Example #5
Source File: GridTest.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public GridTest() { Random random = new Random(); for (int i = 0; i < 300; i++) { people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i)); } Grid<Person> grid = getGrid(); grid.setSelectionMode(Grid.SelectionMode.MULTI); grid.setSizeFull(); HorizontalLayout gridWrapper = new HorizontalLayout(grid); gridWrapper.setMargin(false); gridWrapper.setPadding(false); gridWrapper.setSpacing(false); gridWrapper.setFlexGrow(1, grid); gridWrapper.setSizeFull(); add(gridWrapper); setMargin(false); setPadding(false); setSpacing(false); setAlignItems(Alignment.STRETCH); setFlexGrow(1, gridWrapper); setSizeFull(); }
Example #6
Source File: GridTest.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public GridTest() { Random random = new Random(); for (int i = 0; i < 300; i++) { people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i)); } Grid<Person> grid = getGrid(); grid.setSelectionMode(Grid.SelectionMode.MULTI); grid.setSizeFull(); HorizontalLayout gridWrapper = new HorizontalLayout(grid); gridWrapper.setMargin(false); gridWrapper.setPadding(false); gridWrapper.setSpacing(false); gridWrapper.setFlexGrow(1, grid); gridWrapper.setSizeFull(); add(gridWrapper); setMargin(false); setPadding(false); setSpacing(false); setAlignItems(Alignment.STRETCH); setFlexGrow(1, gridWrapper); setSizeFull(); }
Example #7
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); layout.add(new Label("< " + getViewName() + " >")); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setMargin(false); setSizeFull(); getElement() .getStyle() .set("overflow", "auto"); }
Example #8
Source File: NasGroupsView.java From radman with MIT License | 6 votes |
NasGroupFormDialog(NasService nasService) { this.nasService = nasService; TextField groupname = new TextField("Group name"); groupname.setValueChangeMode(ValueChangeMode.EAGER); TextField nasIpAddress = new TextField("IP address"); nasIpAddress.setValueChangeMode(ValueChangeMode.EAGER); TextField nasPortId = new TextField("Port ID"); nasPortId.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(NasGroupDto.class); binder.bind(groupname, "groupName"); binder.bind(nasIpAddress, "nasIpAddress"); binder.bind(nasPortId, "nasPortId"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(groupname, nasIpAddress, nasPortId)); add(new Hr()); add(controlsLayout); }
Example #9
Source File: GridTest.java From vaadin-app-layout with Apache License 2.0 | 6 votes |
public GridTest() { Random random = new Random(); for (int i = 0; i < 300; i++) { people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i)); } Grid<Person> grid = getGrid(); grid.setSelectionMode(Grid.SelectionMode.MULTI); grid.setSizeFull(); HorizontalLayout gridWrapper = new HorizontalLayout(grid); gridWrapper.setMargin(false); gridWrapper.setPadding(false); gridWrapper.setSpacing(false); gridWrapper.setFlexGrow(1, grid); gridWrapper.setSizeFull(); add(gridWrapper); setMargin(false); setPadding(false); setSpacing(false); setAlignItems(Alignment.STRETCH); setFlexGrow(1, gridWrapper); setSizeFull(); }
Example #10
Source File: UsersView.java From radman with MIT License | 6 votes |
UserFormDialog() { TextField username = new TextField("Username"); username.setValueChangeMode(ValueChangeMode.EAGER); TextField description = new TextField("Description"); description.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(RadiusUserDto.class); binder.bind(username, "username"); binder.bind(description, "description"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(username, description)); add(new Hr()); add(controlsLayout); }
Example #11
Source File: AbstractAutoGeneratedCrudFormFactory.java From crudui with Apache License 2.0 | 6 votes |
protected Component buildFooter(CrudOperation operation, T domainObject, ComponentEventListener<ClickEvent<Button>> cancelButtonClickListener, ComponentEventListener<ClickEvent<Button>> operationButtonClickListener) { Button operationButton = buildOperationButton(operation, domainObject, operationButtonClickListener); Button cancelButton = buildCancelButton(cancelButtonClickListener); HorizontalLayout footerLayout = new HorizontalLayout(); footerLayout.setSizeUndefined(); footerLayout.setSpacing(true); footerLayout.setPadding(false); if (cancelButton != null) { footerLayout.add(cancelButton); } if (operationButton != null) { footerLayout.add(operationButton); } return footerLayout; }
Example #12
Source File: UserGroupsView.java From radman with MIT License | 6 votes |
UserGroupFormDialog() { TextField username = new TextField("Name"); username.setValueChangeMode(ValueChangeMode.EAGER); TextField description = new TextField("Description"); description.setValueChangeMode(ValueChangeMode.EAGER); binder = new BeanValidationBinder<>(RadiusGroupDto.class); binder.bind(username, "name"); binder.bind(description, "description"); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(new Button("Cancel", event -> setOpened(false))); controlsLayout.add(getConfirmBtn()); controlsLayout.setWidthFull(); add(new H3(getDialogTitle())); add(new FormLayout(username, description)); add(new Hr()); add(controlsLayout); }
Example #13
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #14
Source File: TopLayouts.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public void setTitleComponent(Component component) { HorizontalLayout wrapper = new HorizontalLayout(component); wrapper.setWidthFull(); titleWrapper.add(wrapper); this.title = component; titleWrapper.setAlignItems(FlexComponent.Alignment.CENTER); }
Example #15
Source File: DemoView.java From multiselect-combo-box-flow with Apache License 2.0 | 5 votes |
public void addComponentRendererDemo() { MultiselectComboBox<User> multiselectComboBox = new MultiselectComboBox(); multiselectComboBox.setLabel( "Multiselect combo box with ComponentRenderer"); multiselectComboBox.setPlaceholder("Add"); multiselectComboBox.setWidth("100%"); List<User> data = Arrays.asList( new User("Leanne Graham", "leanne", "[email protected]"), new User("Ervin Howell", "ervin", "[email protected]"), new User("Samantha Doe", "samantha", "[email protected]")); multiselectComboBox.setItems(data); multiselectComboBox.setItemLabelGenerator(User::getEmail); multiselectComboBox.addSelectionListener( event -> Notification.show(event.toString())); Button getValueBtn = new Button("Get value"); getValueBtn.addClickListener( event -> objectMultiselectComboBoxValueChangeHandler( multiselectComboBox)); multiselectComboBox.setRenderer(new ComponentRenderer<VerticalLayout, User>(VerticalLayout::new, (container, user) -> { HorizontalLayout name = new HorizontalLayout(new Icon(VaadinIcon.USER), new Label(user.getName())); HorizontalLayout email = new HorizontalLayout(new Icon(VaadinIcon.SUITCASE), new Label(user.getEmail())); container.add(name, email); })); add(buildDemoContainer(multiselectComboBox, getValueBtn)); }
Example #16
Source File: GridTest.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public GridTest() { Random random = new Random(); for (int i = 0; i < 300; i++) { people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i)); } Grid<Person> grid = getGrid(); grid.setSelectionMode(Grid.SelectionMode.MULTI); grid.setSizeFull(); HorizontalLayout gridWrapper = new HorizontalLayout(grid); gridWrapper.setMargin(false); gridWrapper.setPadding(false); gridWrapper.setSpacing(false); gridWrapper.setFlexGrow(1, grid); gridWrapper.setSizeFull(); add(gridWrapper); setMargin(false); setPadding(false); setSpacing(false); setAlignItems(Alignment.STRETCH); setFlexGrow(1, gridWrapper); setSizeFull(); }
Example #17
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #18
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
private Tab jwt() { final Span label = new Span("JWT"); final Icon icon = PASSWORD.create(); final Tab tab = new Tab(new HorizontalLayout(icon, label)); tab2Workspace.put(tab, new JwtGeneratorView(this.authenticationService)); return tab; }
Example #19
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #20
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
private Tab filters() { final Span label = new Span("RSocket Filters"); final Icon icon = FILTER.create(); final Tab tab = new Tab(new HorizontalLayout(icon, label)); tab2Workspace.put(tab, new RSocketFiltersView(this.filterChain, this.rSocketBrokerManager)); return tab; }
Example #21
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #22
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #23
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #24
Source File: AbstractView.java From vaadin-app-layout with Apache License 2.0 | 5 votes |
public AbstractView() { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); layout.setMargin(false); setMargin(false); Label label = new Label("< " + getViewName() + " >"); layout.add(label); layout.setAlignItems(Alignment.CENTER); layout.setJustifyContentMode(JustifyContentMode.CENTER); add(layout); setSizeFull(); getElement().getStyle().set("overflow", "auto"); }
Example #25
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 #26
Source File: MainView.java From tutorials with MIT License | 5 votes |
public MainView(EmployeeRepository repo, EmployeeEditor editor) { this.employeeRepository = repo; this.editor = editor; this.grid = new Grid<>(Employee.class); this.filter = new TextField(); this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create()); HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn); add(actions, grid, editor); grid.setHeight("200px"); grid.setColumns("id", "firstName", "lastName"); grid.getColumnByKey("id").setWidth("50px").setFlexGrow(0); filter.setPlaceholder("Filter by last name"); filter.setValueChangeMode(ValueChangeMode.EAGER); filter.addValueChangeListener(e -> listEmployees(e.getValue())); grid.asSingleSelect().addValueChangeListener(e -> { editor.editEmployee(e.getValue()); }); addNewBtn.addClickListener(e -> editor.editEmployee(new Employee("", ""))); editor.setChangeHandler(() -> { editor.setVisible(false); listEmployees(filter.getValue()); }); listEmployees(null); }
Example #27
Source File: MainLayout.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
private Tab serviceTesting() { final Span label = new Span("Service Testing"); final Icon icon = TOOLS.create(); final Tab tab = new Tab(new HorizontalLayout(icon, label)); tab2Workspace.put(tab, new ServiceTestingView(this.handlerRegistry, this.serviceRoutingSelector)); return tab; }
Example #28
Source File: ConfirmationDialog.java From radman with MIT License | 5 votes |
public ConfirmationDialog(String maxWidth) { contentLayout.setMargin(false); contentLayout.setPadding(false); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setWidthFull(); controlsLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END); controlsLayout.add(cancelBtn); controlsLayout.add(confirmBtn); FormLayout layout = new FormLayout(); layout.setMaxWidth(maxWidth == null ? "500px" : maxWidth); layout.add(title); layout.add(contentLayout); layout.add(new Hr()); layout.add(controlsLayout); add(layout); cancelBtn.addClickListener(event -> { if (Objects.nonNull(cancelListener)) { cancelListener.onCancel(this); } else { setOpened(false); } }); confirmBtn.addClickListener(event -> { if (Objects.nonNull(confirmListener)) { confirmListener.onConfirm(); } }); }
Example #29
Source File: AppConfigView.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
public AppConfigView(@Autowired ConfigurationService configurationService, @Autowired RSocketBrokerManager brokerManager) { this.configurationService = configurationService; this.brokerManager = brokerManager; HorizontalLayout horizontalLayout = new HorizontalLayout(); VerticalLayout appList = makeAppList(); VerticalLayout content = makeConfigForm(); // Compose layout horizontalLayout.add(appList, content); add(horizontalLayout); }
Example #30
Source File: AppConfigView.java From alibaba-rsocket-broker with Apache License 2.0 | 5 votes |
VerticalLayout makeConfigForm() { VerticalLayout content = new VerticalLayout(); appName = new TextField("App Name"); appName.setWidth("300px"); configName = new TextField("Key"); configName.setWidth("300px"); configValue = new TextArea("Value"); configValue.setWidth("600px"); HorizontalLayout buttons = new HorizontalLayout(); saveButton = new Button("Save", buttonClickEvent -> { String key = appName.getValue() + ":" + configName.getValue(); AppConfigEvent appConfigEvent = new AppConfigEvent(appName.getValue(), configName.getValue(), configValue.getValue()); configurationService.put(key, configValue.getValue()) .doOnSuccess(aVoid -> Notification.show("Saved Successfully")) .then(brokerManager.broadcast(appConfigEvent.toCloudEvent(URI.create("broker:" + brokerManager.localBroker().getIp())))) .subscribe(); }); content.add(new H3("Key/Value")); content.add(appName); content.add(configName); content.add(configValue); buttons.add(saveButton); buttons.add(new Button("New Configuration", buttonClickEvent -> { clearForm(); })); content.add(buttons); return content; }