File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
main/java/com/flowingcode/vaadin/addons/demo
test/java/com/flowingcode/vaadin/addons/demo Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 88import com .vaadin .flow .router .BeforeEnterObserver ;
99import com .vaadin .flow .router .HighlightConditions ;
1010import com .vaadin .flow .router .Location ;
11+ import com .vaadin .flow .router .Route ;
1112import com .vaadin .flow .router .RouterLink ;
1213import java .util .LinkedHashMap ;
1314import java .util .Map ;
@@ -58,9 +59,11 @@ public void addLegacyTab(String label, Component content) {
5859 add (tab );
5960 addSelectedChangeListener (ev -> {
6061 if (ev .getSelectedTab () == tab ) {
61- UI .getCurrent ().getPage ().getHistory ().pushState (null , new Location ("" ));
62- ((TabbedDemo ) getParent ().get ()).removeRouterLayoutContent (null );
63- ((TabbedDemo ) getParent ().get ()).showRouterLayoutContent (content );
62+ TabbedDemo tabbedDemo = (TabbedDemo ) getParent ().get ();
63+ String route = tabbedDemo .getClass ().getAnnotation (Route .class ).value ();
64+ UI .getCurrent ().getPage ().getHistory ().pushState (null , new Location (route ));
65+ tabbedDemo .removeRouterLayoutContent (null );
66+ tabbedDemo .showRouterLayoutContent (content );
6467 }
6568 });
6669 }
Original file line number Diff line number Diff line change 2323import com .vaadin .flow .router .Route ;
2424import com .vaadin .flow .router .RouteAlias ;
2525
26- /** Hello world! */
27- @ Route ("" )
28- @ RouteAlias ("demo" )
26+ @ Route ("demo" )
27+ @ RouteAlias ("" )
2928@ GithubLink ("https://github.com/FlowingCode/CommonsDemo" )
3029public class Demo extends TabbedDemo {
3130
You can’t perform that action at this time.
0 commit comments