File tree Expand file tree Collapse file tree 2 files changed +4
-14
lines changed
main/java/com/flowingcode/addons/applayout Expand file tree Collapse file tree 2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public default T setCommand(MouseButton button, Command command) {
5555 "mouseup" ,
5656 ev -> {
5757 command .execute ();
58- AppDrawer . findAppDrawer ((Component ) this ).ifPresent ( AppDrawer :: close );
58+ ((Component )this ).getElement (). executeJs ( "this.dispatchEvent(new CustomEvent('item-clicked', {bubbles: true}))" );
5959 })
6060 .setFilter ("event.button==" + button .ordinal ());
6161 data .commands .put (button , Pair .of (command , registration ));
Original file line number Diff line number Diff line change 1919 */
2020package com .flowingcode .addons .applayout .menu ;
2121
22- import com .flowingcode .addons .applayout .AppDrawer ;
22+ import java .util .Optional ;
23+
2324import com .vaadin .flow .component .Component ;
2425import com .vaadin .flow .component .HasComponents ;
2526import com .vaadin .flow .component .HasSize ;
3031import com .vaadin .flow .component .dependency .NpmPackage ;
3132import com .vaadin .flow .dom .Element ;
3233import com .vaadin .flow .server .Command ;
33- import java .util .Optional ;
3434
3535/**
3636 * Component that renders a paper-item
@@ -59,7 +59,7 @@ public void addCommand(Command command) {
5959 "click" ,
6060 e -> {
6161 command .execute ();
62- findAppDrawer ( this ).ifPresent ( AppDrawer :: close );
62+ (( Component ) this ).getElement (). executeJs ( "this.dispatchEvent(new CustomEvent('item-clicked', {bubbles: true}))" );
6363 });
6464 }
6565 }
@@ -104,14 +104,4 @@ private Optional<Element> withIronIcon(boolean create) {
104104 }
105105 }
106106
107- private static Optional <AppDrawer > findAppDrawer (Component component ) {
108- while (component != null ) {
109- if (component instanceof AppDrawer ) {
110- return Optional .of ((AppDrawer ) component );
111- } else {
112- component = component .getParent ().orElse (null );
113- }
114- }
115- return Optional .empty ();
116- }
117107}
You can’t perform that action at this time.
0 commit comments