How to use in jmix project vaadin addon

Hi,

how to include vaddin addon into jmix project.

Hi,

Could you please clarify what UI client do you use: Classic UI or Flow UI?

Regards,
Gleb

In Flow UI.

And how to use component from addon in project.

Hi,

You just need to add an add-on dependency. For example, taking ToggleButton as en example, add the following dependency:

implementation 'com.vaadin.componentfactory:togglebutton:3.0.0'

Dependency coordinates can be found using the Install button in the add-on page

Screenshot 2023-07-24 at 12.59.51

And add vaadin-addons repository:

repositories {
    ...
    maven {
        url 'https://maven.vaadin.com/vaadin-addons'
    }
}

After that, you can start using a new component, e.g.:

@Subscribe
public void onInit(final InitEvent event) {
    ToggleButton toggleButton = new ToggleButton();
    getContent().add(toggleButton);
}

Regards,
Gleb

Just a quick note on this one: everytime I upgrade Jmix to a new version, the vaadin-addons repository is removed.

@gorelov , I followed your instructions, but it still doesn’t work in the code. Do I need to modify other places?Note: I am using Jmix 2.0.1

a2

a3
a1

@gorelov, I upgrade the Idea to 2023.2. It is fixed.

Hi Gleb,

I successfully added a ToggleButton to a page thanks to your explaination.

My problem now is I have to sobstitute some standard checkboxes to toggle buttons and link them to the page descriptor xml.

image

image

I tried many ways but unfortunately noone seems to work.

Any help?

Thank you,
Vittorio

Hi,

You cannot replace a component by providing another one with the same id. In order to support XML markup for a component you need to create XSD schema, Loader class and register component. The example can be found in the UI Samples app.

Regards,
Gleb