import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.mixins.Mixin;
import com.vaadin.v7.flow.componentMixinInterface.MixinSupplier;
@Tag("my-custom-component")
public class MyCustomMixin extends Component implements MixinSupplier<Component> {
public MyCustomMixin() {
super(ElementFactory.createCustomComponent());
init();
}
private void init() {
getElement().setProperty("myCustomProperty", "foo");
getElement().addPropertyChangeListener("myCustomProperty", event -> {
});
}
}
public class MyLibraryClass {
public void useCustomFeature() {
MyCustomMixin customMixin = new MyCustomMixin();
getElement().appendChild(customMixin.getElement());
}
}
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;
@Route("")
public class MyApplicationView extends Div {
public MyApplicationView() {
MyLibraryClass myLibrary = new MyLibraryClass();
myLibrary.useCustomFeature();
add(myLibrary.getElement(), new Button("Click me"));
}
}