use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class NavigationRpcHandlerTest method handleHistoryChange_uiIsInert_navigationTriggered.
@Test
public void handleHistoryChange_uiIsInert_navigationTriggered() {
ui.addModal(new RouterLink());
rpcHandler.handle(ui, invocation);
Mockito.verify(historyStateChangeHandler, Mockito.times(1)).onHistoryStateChange(Mockito.any(History.HistoryStateChangeEvent.class));
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class RootNavigationTarget method onAttach.
@Override
protected void onAttach(AttachEvent attachEvent) {
Label label = new Label(String.valueOf(getUI().get().getUIId()));
label.setId("ui-id");
add(label);
RouterLink link = new RouterLink("foo", FooNavigationTarget.class);
link.setId("foo");
add(link);
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class BeansWithNoOwnerView method onAttach.
@Override
protected void onAttach(AttachEvent attachEvent) {
NativeButton button = new NativeButton("switch content", ev -> {
remove(current);
if (isSubDiv) {
current = context.getBean(ButtonNoOwner.class);
} else {
current = context.getBean(DivNoOwner.class);
}
add(current);
isSubDiv = !isSubDiv;
});
button.setId("switch-content");
add(button);
RouterLink link = new RouterLink("another-view", AnotherBeanNopOwnerView.class);
link.getElement().getStyle().set("display", "block");
link.setId("navigate-another");
add(link);
current = context.getBean(ButtonNoOwner.class);
add(current);
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class ChildNoOwnerView method onAttach.
@Override
protected void onAttach(AttachEvent attachEvent) {
if (attachEvent.isInitialAttach()) {
RouterLink link = new RouterLink("parent", ParentNoOwnerView.class);
link.setId("to-parent");
add(link);
Div div = new Div();
div.setId("child-info");
div.getElement().getStyle().set("display", "block");
div.setText(bean.getValue());
add(div);
}
}
use of com.vaadin.flow.router.RouterLink in project flow by vaadin.
the class MainView method createTab.
private static Tab createTab(String text, Class<? extends Component> navigationTarget) {
final Tab tab = new Tab();
tab.add(new RouterLink(text, navigationTarget));
ComponentUtil.setData(tab, Class.class, navigationTarget);
return tab;
}
Aggregations