vaadin declarative, how to get the java instance of TextField

148 Views Asked by At

I am new with declarative UI in vaadin, how to get the java instance like TextField that was declare in xml ?

I want to set value to it. not found how to get it.

2

There are 2 best solutions below

2
On BEST ANSWER

With the @Id annotation

@Id("my-textfield")
private TextField myTextfield;

Please read the documentation:

https://vaadin.com/docs/latest/flow/templates/components

0
On

For Jmix, you can directly inject the field in screen controllers by using @Autowired annotation.

You can find examples here: https://demo.jmix.io/sampler/#main/3/sample?id=textfield-trim

Notice: the injects property name should be the same as id property in the XML.

btw, you can ask Jmix questions on https://forum.jmix.io