55
66import com .vaadin .flow .component .ClickEvent ;
77import com .vaadin .flow .component .button .Button ;
8+ import com .vaadin .flow .component .dialog .Dialog ;
9+ import com .vaadin .flow .component .icon .Icon ;
10+ import com .vaadin .flow .component .icon .VaadinIcon ;
811import com .vaadin .flow .component .orderedlayout .VerticalLayout ;
912import com .vaadin .flow .router .Route ;
1013
2225@ Route ("" )
2326public class LeafletView extends VerticalLayout
2427{
28+ private boolean viewLunch = false ;
2529
30+ /**
31+ * UI-Components
32+ */
2633 private final Button btnLunch = new Button ("Where do XDEV employees go for lunch?" );
27- private boolean viewLunch = false ;
34+ private final Button btnOpenDialog = new Button ("Open dialog over map" , ev ->
35+ {
36+ final Icon icoClose = VaadinIcon .CLOSE .create ();
37+
38+ final Dialog dialog = new Dialog (icoClose );
39+ dialog .setWidth ("50vw" );
40+ dialog .setHeight ("50vh" );
41+ dialog .open ();
42+
43+ icoClose .addClickListener (iev -> dialog .close ());
44+ });
2845
2946 private LMap map ;
3047
@@ -44,7 +61,7 @@ public LeafletView()
4461 this .initMapComponents ();
4562
4663 this .btnLunch .addClickListener (this ::btnLunchClick );
47- this .add (this .btnLunch );
64+ this .add (this .btnLunch , this . btnOpenDialog );
4865 }
4966
5067 private void btnLunchClick (final ClickEvent <Button > event )
@@ -132,7 +149,6 @@ private void initMapComponents()
132149 this .markerLeberkaese = new LMarker (49.673800 , 12.160113 );
133150 this .markerLeberkaese .setPopup ("Fast food like Leberkäsesemmeln" );
134151
135-
136152 this .map = new LMap (49.675126 , 12.160733 , 17 );
137153
138154 this .map .setHeight ("700px" );
0 commit comments