Hi, everyone.
I’m create a custom dialog by using Composite"<Div>";
I don’t understand how to remove my dialog from ui? Now I’m set css style like (“display”,“none”). It’s works, but my dialog stay in the DOM.
My question is, how to full remove my dialog from UI? Something like - getUI.remove …
Custom dialog:
.......
public void open() {
this.setOpened(true);
}
public void close() {
this.setOpened(false);
}
public void setOpened(boolean opened) {
UI ui = UI.getCurrent();
if(opened && this.getElement().getNode().getParent() == null && ui != null){
ui.beforeClientResponse(ui, (context) -> {
ui.add(new Component[]{this});
});
}else{
Style style = this.getElement().getStyle();
style.set("display","none");
}
}
......
Main code:
......
CustomDialog d = new CustomDialog();
d.open();
......