vaadin

How to validate fields in vaadin made form

佐手、 提交于 2019-12-02 00:59:25
I am making a Java project with vaadin. Right now I have a user registration form looking like that: public class RegistrationComponent extends CustomComponent implements View { public static final String VIEW_NAME = "Registration"; public RegistrationComponent(){ Panel panel = new Panel("Registration Form"); panel.setSizeUndefined(); FormLayout content = new FormLayout(); CheckBox checkBox1, checkBox2, checkBox3; checkBox1 = new CheckBox("Check Box 1"); checkBox2 = new CheckBox("Check Box 2"); checkBox3 = new CheckBox("Check Box 3"); checkBox1.setRequired(true); checkBox2.setRequired(true);

Get current VaadinContext and current VaadinSession (both places to store state as “attribute” key-value pairs) in Vaadin Flow

孤人 提交于 2019-12-02 00:44:29
In using Vaadin Flow, version 14, I know we can store state as key-value pairs kept as "attributes" via getAttribute / setAttribute / removeAttribute methods found on: VaadinSession (per-user scope) VaadinContext (web-app scope) How does one access the current object for those classes? VaadinSession.getCurrent() For that per-user scope , the VaadinSesion class provides a static class method getCurrent to access the current instance. VaadinSession session = VaadinSession.getCurrent() ; // Fetch current instance of `VaadinSession` to use its key-value collection of attributes. session

How to Add Language flags in Vaadin 10 Combo box

北城以北 提交于 2019-12-02 00:14:07
How to Add Language flags in Vaadin 10 Como box You can use comboBox.setRenderer() to build your own layout that will be used. comboBox.setRenderer(new ComponentRenderer<HorizontalLayout, MyLanguageClass>(language -> { HorizontalLayout layout = new HorizontalLayout(); layout.add(new Image(language.getPathToFlag(), language.getName())); layout.add(new Label(language.getName())); return layout; })); This example will do a basic HorizontalLayout with an Image and a Label. You can of course adjust this further to your needs. I used a ComponentRenderer here, but you can also use a TemplateRenderer

MenuBar widget in Vaadin Flow (Vaadin 10) missing?

自作多情 提交于 2019-12-01 22:17:42
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? 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 MenuBar in Vaadin 10 or 11 As discussed in this Forum thread , as of version 11.0.1, Vaadin Flow currently

In Vaadin 7, pass data/arguments to new UI instance of BrowserWindowOpener?

可紊 提交于 2019-12-01 21:31:34
问题 I am successfully opening new browser windows with BrowserWindowOpener. Question: How do I pass some information to the newly instantiated UI subclass? The syntax requires that I specify a class to be instantiated. How do I communicate with that future instance? BrowserWindowOpener bookOpener = new BrowserWindowOpener( BookUI.class ); For example, let's say my app opens a window listing word definitions for words starting with a particular letter of the alphabet (A-Z). How do I tell the newly

Vaadin 7 fire custom events between components

允我心安 提交于 2019-12-01 21:02:01
I want to create custom events and fire them in some part of the view such that some other part of the view is updated/removed/refreshed. I have tried by extending the Component.Event and Component.Listener but it doesn't work. I think that events and listeners mustbe limited to the same component instance. Can this be done with Vaadin 7? Basically I want to decouple my views and provide easy communication between components. I'm also using Spring with Vaadin. If you have better ideas beside the Observer pattern I would also appreciate it. Thank you vlad2005 What you need: 1. A component that

Both ENTER shortcut and TextArea in Vaadin

主宰稳场 提交于 2019-12-01 20:18:36
TextField f = new TextField(); Button b = new Button("Save"); b.setClickShortcut(KeyCode.ENTER); // For quick saving from text field itself TextArea longText = new TextArea(); // "Enter" is garbled here Hot to make the shortcut to work only in the from text field? Henri Kerola Use focus and blur listeners to remove and add the shortcut key: f.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { b.setClickShortcut(KeyCode.ENTER); } }); f.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { b.removeClickShortcut(); } }); Newer

set table row height

非 Y 不嫁゛ 提交于 2019-12-01 17:02:01
My lacking skills of CSS is giving me a headache. As presented in this picture below, captured from firebug: Using a GWT like framework called Vaadin I have given a Table component the class name m2m-modal-table and I want set a min-height to the four rows in that table. However, I can't seem to get it to work.. And as you see from the image the table doesn't even seem to have the class name m2m-modal-table but v-table-table instead (styles are being added outside my involvement since I'm using an already setup framework library). So, can anyone who has good knowledge of CSS class referring

set table row height

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 15:21:25
问题 My lacking skills of CSS is giving me a headache. As presented in this picture below, captured from firebug: Using a GWT like framework called Vaadin I have given a Table component the class name m2m-modal-table and I want set a min-height to the four rows in that table. However, I can't seem to get it to work.. And as you see from the image the table doesn't even seem to have the class name m2m-modal-table but v-table-table instead (styles are being added outside my involvement since I'm

Maven build error: Failed to execute goal, missing a class

China☆狼群 提交于 2019-12-01 15:06:33
I'm trying to package the sample application from vaadin 7.0.0 with the maven plugin for eclipse, but every time a run the goal "package", building fails with the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project essai: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile: org/codehaus/plexus/compiler/util/scan/InclusionScanException [ERROR] ------------