vaadin-flow

How to Print in Vaadin Flow?

三世轮回 提交于 2019-12-13 01:28:31
问题 I would like to print out the content of a homepage created with Vaadin 14 from a button. with Vaadin 8 was a solution that unfortunately is no longer applicable: Button print = new Button("Print This Page"); print.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // Print the current page JavaScript.getCurrent().execute("print();"); } }); Any Idea how to do this in Vaadin14 please? 回答1: In Vaadin 10 and later, you can run arbitrary JavaScript by

How to fix object set in grid?

▼魔方 西西 提交于 2019-12-12 18:20:44
问题 In my application i have a class like: public class Team { private Country teamId; private Set<Player> playerSet; private Set<Player> substitutes; private Set<Coach> coachSet; } When i instantiate a grid like: Grid<Team> grid = new Grid<>(Team.class); and set allTeam() from database it shows object for playerSet and coachSet. My question is i just want to show players name and coach name concate by ,or \n. Any idea how can i do that?As a beginner it is complicated for me 回答1: I see three

Change Maven-driven project based on Vaadin 11 to Vaadin 12 alpha version?

我们两清 提交于 2019-12-12 14:11:47
问题 Problem I have a working project in IntelliJ 2018.3 for Vaadin 11, created using the Project Base starter-pack. ➥ How do I switch from Vaadin 11.0.0 to Vaadin 12.0.0.alpha4 ? My Question here is similar to this one, Vaadin 8 alpha/beta prerelease fail with “Non-resolvable import POM: Failure to find” errors. The solution on that page was to enable a vaadin-prerelease checkbox in the Profiles list in the Maven sidebar of IntelliJ. But with a Vaadin 11 project, the only such checkbox found

How to download a file with Vaadin 10?

拈花ヽ惹草 提交于 2019-12-11 09:29:29
问题 I want to let user to download a file from server. I looked up for the solution and when trying to make an example - ended up with this: @Route("test-download") public class Download extends VerticalLayout { public Download() { Anchor downloadLink = new Anchor(createResource(), "Download"); downloadLink.getElement().setAttribute("download", true); add(downloadLink); } private AbstractStreamResource createResource() { return new StreamResource("/home/johny/my/important-file.log", this:

Center widgets within a layout in Vaadin Flow

血红的双手。 提交于 2019-12-11 05:21:10
问题 When I have small widget such as a LoginLayout within another layout appearing in a much larger window, how can I center the content? I want the content to appear approximately in the middle of the window with respect to both width and height. I found older Questions on this topic such as this and this, but they are for the previous generation of Vaadin (versions 6, 7, 8) before Flow (versions 10+, now 14). 回答1: HorizontalLayout with CSS3 Flexbox The trusty HorizontalLayout and VerticalLayout

update vaadin grid when new record added to database

只愿长相守 提交于 2019-12-08 03:22:30
I want to add the element to the table in the database and update the grid with new data (probably I should add records directly on UI to the table but whatever). My grid component looks like this @SpringComponent public class PlayersGrid extends Grid<Player> { @PostConstruct public void afterInit() { addColumn(Player::getId).setHeader("ID"); addColumn(Player::getName).setHeader("Name"); addColumn(Player::getCharacterClass).setHeader("Class"); addColumn(Player::getLevel).setHeader("Level"); } public class GridContentObserver implements ContentObserver { @Override public void refreshContent() {

Handling login with a Vaadin Flow webapp, across all layouts globally and across “route” URLs

天大地大妈咪最大 提交于 2019-12-06 06:30:40
问题 Vaadin 8 In Vaadin 8, in my UI subclass I handled login by examining if a user’s session carried an attribute noting whether they had successfully logged in or not. If not, my UI subclass displayed a login layout rather than other content with navigation options such as menu bar and buttons that switch layout within that UI. Vaadin 10+ In Vaadin 10 and later, Vaadin Flow, the UI class is apparently handled automatically by Vaadin in a manner transparent to me the app developer. Now the @Route

Replacement for `AbsoluteLayout` from Vaadin 8 Framework in Vaadin 10 Flow?

泪湿孤枕 提交于 2019-12-06 02:01:33
问题 The AbsoluteLayout in Vaadin 8 (Framework) enables pixel-position-oriented placement of widgets within a layout. While not my first layout of choice, the AbsoluteLayout is suited to porting code from other UI-building platforms that use pixel-position-oriented layout. Example code from the manual: // A 400x250 pixels size layout AbsoluteLayout layout = new AbsoluteLayout(); layout.setWidth("400px"); layout.setHeight("250px"); // A component with coordinates for its top-left corner TextField

Replacement for `AbsoluteLayout` from Vaadin 8 Framework in Vaadin 10 Flow?

你离开我真会死。 提交于 2019-12-04 06:30:49
The AbsoluteLayout in Vaadin 8 ( Framework ) enables pixel-position-oriented placement of widgets within a layout. While not my first layout of choice, the AbsoluteLayout is suited to porting code from other UI-building platforms that use pixel-position-oriented layout. Example code from the manual : // A 400x250 pixels size layout AbsoluteLayout layout = new AbsoluteLayout(); layout.setWidth("400px"); layout.setHeight("250px"); // A component with coordinates for its top-left corner TextField text = new TextField("Somewhere someplace"); layout.addComponent(text, "left: 50px; top: 50px;"); I

Vaadin Flow/10/11 style component via css

时光怂恿深爱的人放手 提交于 2019-12-02 18:07:19
问题 My question is pretty basic. How to add styling from a css-file to a basic vaadin component? What I do NOT want to use: PolymerTemplate getStlye().set(...) Do I have to @ImportHtml, which includes the css-code or do I have to @StyleSheet with the css-file? And afterwards, do I have to add the "css-style" via .getElement().getClassList().add(...)? I really need help to have a working simple code example for a Label, Button or whatsever, please . I cannot find anything to satisfy my