Skip to content

Commit 4227179

Browse files
committed
Merge branch 'master' of github.com:FlowingCode/AppLayoutAddon
2 parents 17731ba + 558828f commit 4227179

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/com/flowingcode/addons/applayout/PaperIconItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public PaperIconItem(String title, String icon, Command command, AppDrawer appDr
6363
this.getElement().addEventListener("click", e->{
6464
command.execute();
6565
if (appDrawer!=null)
66-
UI.getCurrent().getPage().executeJavaScript("" + appDrawer.getId().get() + ".toggle()");
66+
appDrawer.getUI().ifPresent(ui->ui.getPage().executeJavaScript("" + appDrawer.getId().get() + ".toggle()"));
6767
});
6868
}
6969
}

src/main/java/com/flowingcode/addons/applayout/PaperItem.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.vaadin.flow.component.HasSize;
2727
import com.vaadin.flow.component.HasText;
2828
import com.vaadin.flow.component.Tag;
29-
import com.vaadin.flow.component.UI;
3029
import com.vaadin.flow.component.dependency.HtmlImport;
3130
import com.vaadin.flow.server.Command;
3231

@@ -55,7 +54,7 @@ public PaperItem(String title, Command command, AppDrawer appDrawer) {
5554
this.getElement().addEventListener("click", e->{
5655
command.execute();
5756
if (appDrawer!=null)
58-
UI.getCurrent().getPage().executeJavaScript("" + appDrawer.getId().get() + ".toggle()");
57+
appDrawer.getUI().ifPresent(ui->ui.getPage().executeJavaScript("" + appDrawer.getId().get() + ".toggle()"));
5958
});
6059
}
6160
}

0 commit comments

Comments
 (0)