vaadin-flow

Vaadin (Flow): Navigating to destination with a shared object

拜拜、爱过 提交于 2020-01-02 08:34:31
问题 Problem: I currently have a grid that displays content of type SomeModel . When I click an entry of that Grid I would like to navigate to a view that takes an object as its input to display the entries content. Implementation: To achive this behaviour I created a DetailLayout like this: public DetailLayout extends FlexLayout implements HasUrlParameter<SomeModel>{ /* skipped some details */ @Override public void setParameter(BeforeEvent event, Host parameter) { /* This is where I expected to

Vaadin Flow app switch between light and dark modes automatically

ⅰ亾dé卋堺 提交于 2020-01-01 06:52:10
问题 Vaadin Flow 14 ships with light and dark versions of its two bundled themes, Lumo and Material . And now browsers can ask the host OS for the user’s preference for light or dark modes. Is there a way to have a Vaadin app automatically use the light or dark theme variant per the user’s wishes? Marcus Hellberg wrote a helpful post on how to switch light/dark mode theme variants programmatically. I am wondering if Vaadin 14 might be able to switch automatically now that the user preference is

How to change style of combo box in Vaadin 10

牧云@^-^@ 提交于 2019-12-30 14:46:35
问题 I would like to adapt a combo box component's CSS. The combo box has my style class custom1 added which should disable border radius for left corners. In my shared-styles.html , I tried to adapt CSS properties: .custom1 { --lumo-border-radius: 0px; } This is changing the styles but it is not exactly what I want. According to docs, I should follow this wiki to apply local scope styles for the web component. So, I tried: <custom-style> <style> ... </style> </custom-style> <dom-module id="my

Vaadin Flow download code works for Chrome but not for Firefox - How can I support both?

匆匆过客 提交于 2019-12-25 01:13:26
问题 I have the following code to download a file from Vaadin Flow (12.0.7). exportBtn.addClickListener(e -> { toDownload = FileUtil.getLatestExport(); (toDownload != null) { StreamResource resource = new StreamResource(toDownload.getName(), () -> FileUtil.getInputStreamForFile(toDownload)); Element object = new Element("object"); object.setAttribute("download", true); object.setAttribute("data", resource); Input name = new Input(); UI.getCurrent().getElement().appendChild(name.getElement(),

Setting content of my `UI` subclass in Vaadin Flow web app

本秂侑毒 提交于 2019-12-24 04:12:28
问题 In Vaadin Flow, writing a subclass of UI class is no longer necessary. Yet the page of the manual on Differences Between V10 and V8 Applications suggests we are free to do so. The problem: The UI class in Flow has no UI::setContent method. This usual line of code in our UI::init method fails in Flow: this.setContent( layout ); // <--- No method `setContent` found in Flow ➥ How do we set the content to be displayed within our UI subclass at runtime? Here is my code, with the line of setContent

Setting content of my `UI` subclass in Vaadin Flow web app

亡梦爱人 提交于 2019-12-24 04:11:30
问题 In Vaadin Flow, writing a subclass of UI class is no longer necessary. Yet the page of the manual on Differences Between V10 and V8 Applications suggests we are free to do so. The problem: The UI class in Flow has no UI::setContent method. This usual line of code in our UI::init method fails in Flow: this.setContent( layout ); // <--- No method `setContent` found in Flow ➥ How do we set the content to be displayed within our UI subclass at runtime? Here is my code, with the line of setContent

update vaadin grid when new record added to database

故事扮演 提交于 2019-12-23 01:52:58
问题 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"); }

Dynamically changing font, font-size, font-color, and so on in Vaadin Flow web apps

五迷三道 提交于 2019-12-20 05:35:09
问题 In Vaadin Flow (versions 10 and later), is there some way to dynamically change the font, font size, font color and such of the widgets in a Vaadin layout? I do know the basics of CSS, but don’t know much about SASS or other supersets of CSS though I am willing to learn. And I do not know what supersets of CSS are being used by Vaadin Flow. I know I can dynamically assign or remove CSS style names to a widget at runtime. But that means the CSS style must already be defined. ➥Is there some way

MenuBar widget in Vaadin Flow (Vaadin 10) missing?

故事扮演 提交于 2019-12-20 01:43:22
问题 Vaadin Framework (Vaadin 8) offers a MenuBar widget, as discussed in the manual, and shown in the Sampler. When I switch the manual to "Vaadin 10" mode, I cannot find the MenuBar widget. I know Vaadin 10 (Vaadin Flow) is a major re-write of Vaadin, is the widget changed in name or not yet available? 回答1: Possibly in Vaadin 14 Update: A MenuBar widget is planned for development by Vaadin Ltd, scheduled for Vaadin 14 release. See the manual. On GitHub, see Issue # 4694 MenuBar component. No

Vaadin flow: grid conditional background color

戏子无情 提交于 2019-12-13 02:51:10
问题 I want to color grid lines, depending on a condition. I try this: Java: gridEtudiant.setClassNameGenerator(t -> { if (t.getEtud_numero().startsWith("2")) { return "error_row"; } return ""; }); Css: td.error_row { background-color: red; } HTML <td id="vaadin-grid-cell-1" tabindex="0" role="gridcell" part="cell body-cell" first-column="" reorder-status="undefined" aria-selected="false" class="error_row" style="width: 100px; flex-grow: 1; order: 10000000;"><slot name="vaadin-grid-cell-content-1"