本文整理汇总了Java中com.vaadin.navigator.Navigator.navigateTo方法的典型用法代码示例。如果您正苦于以下问题:Java Navigator.navigateTo方法的具体用法?Java Navigator.navigateTo怎么用?Java Navigator.navigateTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.navigator.Navigator
的用法示例。
在下文中一共展示了Navigator.navigateTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout contentArea = new VerticalLayout();
contentArea.setMargin(false);
setContent(contentArea);
final Navigator navigator = new Navigator(this, contentArea);
navigator.addProvider(viewProvider);
navigator.setErrorView(InaccessibleErrorView.class);
String defaultView = Page.getCurrent().getUriFragment();
if (defaultView == null || defaultView.trim().isEmpty()) {
defaultView = SecureView.VIEW_NAME;
}
if (isUserAuthenticated(vaadinRequest)) {
navigator.navigateTo(defaultView);
} else {
navigator.navigateTo(LoginView.VIEW_NAME + "/" + defaultView);
}
}
示例2: MainLayout
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
public MainLayout() {
Navigator navigator = new Navigator(UI.getCurrent(), contentPanel);
navigator.addView(StatsView.VIEW_NAME, StatsView.class);
navigator.addView(PluginsView.VIEW_NAME, PluginsView.class);
navigator.addView(PermissionsView.VIEW_NAME, PermissionsView.class);
menuButton1.addClickListener(event -> doNavigate(StatsView.VIEW_NAME));
menuButton2
.addClickListener(event -> doNavigate(PluginsView.VIEW_NAME));
menuButton3.addClickListener(
event -> doNavigate(PermissionsView.VIEW_NAME));
if (navigator.getState().isEmpty()) {
navigator.navigateTo(StatsView.VIEW_NAME);
} else {
navigator.navigateTo(navigator.getState());
}
}
示例3: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
Panel panel = new Panel();
panel.setSizeFull();
Navigator navigator = new Navigator(this, panel);
navigator.addView(NavigationState.HOME, HomeView.class);
navigator.addView(NavigationState.AIRPORT_LIST, AirportListView.class);
navigator.addView(NavigationState.FLIGHT_MAINTENANCE, FlightMaintenanceView.class);
navigator.addView(NavigationState.FLIGHT_BOOKING, FlightBookingView.class);
navigator.addView(NavigationState.BOOKING_CANCELLATION, BookingCancellationView.class);
navigator.navigateTo(NavigationState.HOME);
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeFull();
verticalLayout.addComponent(createMenu());
verticalLayout.addComponent(panel);
verticalLayout.setExpandRatio(panel, 1);
setContent(verticalLayout);
}
示例4: MainScreen
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Autowired
public MainScreen(final VaadinSecurity vaadinSecurity, SpringViewProvider springViewProvider, ValoSideBar sideBar) {
HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();
setCompositionRoot(layout);
setSizeFull();
// By adding a security item filter, only views that are accessible to the user will show up in the side bar.
sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity));
layout.addComponent(sideBar);
CssLayout viewContainer = new CssLayout();
viewContainer.setSizeFull();
layout.addComponent(viewContainer);
layout.setExpandRatio(viewContainer, 1f);
Navigator navigator = new Navigator(UI.getCurrent(), viewContainer);
// Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all.
springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
navigator.addProvider(springViewProvider);
navigator.setErrorView(ErrorView.class);
navigator.navigateTo(navigator.getState());
}
示例5: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
public void init(VaadinRequest request) {
logger.info("New Vaadin UI created");
String invitation = request.getParameter("invitation");
logger.info("Invitation: {} of sessions : {}", invitation);
setSizeFull();
GazpachoViewDisplay viewDisplay = new GazpachoViewDisplay();
setContent(viewDisplay);
navigator = new Navigator(this, (ViewDisplay) viewDisplay);
navigator.addProvider(viewProvider);
navigator.setErrorProvider(new GazpachoErrorViewProvider());
if (isUserSignedIn()) {
navigator.navigateTo(QuestionnaireView.NAME);
} else {
navigator.navigateTo(LoginView.NAME);
}
}
示例6: MainScreen
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
public MainScreen(UI ui) {
setSizeFull();
createHeader();
createMenuBar();
final Panel viewContainer = new Panel();
viewContainer.setSizeFull();
viewContainer.addStyleName(Reindeer.PANEL_LIGHT);
addComponent(viewContainer);
setExpandRatio(viewContainer, 1);
final Navigator navigator = new Navigator(ui, viewContainer);
navigator.setErrorView(ErrorView.class);
navigator.addView(SampleTableView.VIEW_NAME, new SampleTableView());
navigator.addView(SampleFormView.VIEW_NAME, SampleFormView.class);
navigator.addView(SampleChartView.VIEW_NAME, SampleChartView.class);
navigator.navigateTo(navigator.getState());
}
示例7: setupNavigator
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
private void setupNavigator(UI ui) {
navigator = new Navigator(ui, content);
navigator.setErrorView(ErrorView.class);
// Add view change listeners so we can do things like select the correct menu item and update the page title
navigator.addViewChangeListener(navBar);
// navigator.addViewChangeListener(new PageTitleUpdater());
addView("/home", HomeView.class, getViewName(HomeView.class));
addView("/system", SystemView.class, getViewName(SystemView.class));
addView("/config", ConfigView.class, getViewName(ConfigView.class));
navigator.navigateTo("/home");
}
示例8: setupNavigator
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
private void setupNavigator() {
navigator = new Navigator(DungeonStoryUI.getCurrent(), viewContainer);
registerViews();
// Add view change listeners so we can do things like select the correct
// menu item and update the page title
navigator.addViewChangeListener(navBar);
navigator.addViewChangeListener(new PageTitleUpdater());
navigator.addViewChangeListener(new MessageViewUpdater());
navigator.setErrorView(ErrorView.class);
navigator.navigateTo(navigator.getState());
}
示例9: createSearchBar
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
private MHorizontalLayout createSearchBar() {
Label header = new Label("Bookery");
header.addStyleName(ValoTheme.LABEL_BOLD);
header.setSizeUndefined();
header.addStyleName(ValoTheme.LABEL_H3);
searchText = new TextField();
searchText.setIcon(FontAwesome.SEARCH);
searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE);
searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
searchText.setWidth(100, Unit.PERCENTAGE);
searchText.setInputPrompt("hier einfach suchen..");
Button searchButton = new Button("such!", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
Navigator navigator = ((App)UI.getCurrent()).getNavigator();
if (navigator.getState().contains("search")) {
navigator.navigateTo(navigator.getState());
}
else {
navigator.navigateTo(SearchView.id);
}
}
});
searchButton.addStyleName(ValoTheme.BUTTON_LARGE);
searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER));
MHorizontalLayout layout = new MHorizontalLayout(header,searchText,searchButton);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setExpandRatio(searchText, 1.0f);
return layout;
}
示例10: MainLayout
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
public MainLayout() {
navigator = new Navigator(UI.getCurrent(), (ViewDisplay) this);
addNavigatorView(DashboardView.VIEW_NAME, DashboardView.class,
menuButton1);
addNavigatorView(OrderView.VIEW_NAME, OrderView.class, menuButton2);
addNavigatorView(AboutView.VIEW_NAME, AboutView.class, menuButton3);
if (navigator.getState().isEmpty()) {
navigator.navigateTo(DashboardView.VIEW_NAME);
}
}
示例11: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
getPage().setTitle("Vaadin Shared Security Demo");
// Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
setErrorHandler(new DefaultErrorHandler() {
@Override
public void error(com.vaadin.server.ErrorEvent event) {
if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
Notification.show("Sorry, you don't have access to do that.");
} else {
super.error(event);
}
}
});
HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();
// By adding a security item filter, only views that are accessible to the user will show up in the side bar.
sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity));
layout.addComponent(sideBar);
CssLayout viewContainer = new CssLayout();
viewContainer.setSizeFull();
layout.addComponent(viewContainer);
layout.setExpandRatio(viewContainer, 1f);
Navigator navigator = new Navigator(this, viewContainer);
// Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all.
springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
navigator.addProvider(springViewProvider);
navigator.setErrorView(ErrorView.class);
navigator.navigateTo(navigator.getState());
setContent(layout); // Call this here because the Navigator must have been configured before the Side Bar can be attached to a UI.
}
示例12: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
setLocale(new Locale.Builder().setLanguage("sr").setScript("Latn").setRegion("RS").build());
Navigator navigator = new Navigator(MainUI.this, (ViewDisplay)mainLayout);
navigator.addProvider(springViewProvider);
navigator.addViewChangeListener(mainLayout);
setContent(mainLayout);
/*
* Handling redirections
*/
RequestAttributes attrs = RequestContextHolder.getRequestAttributes();
if (sessionStrategy.getAttribute(attrs, VaadinRedirectObject.REDIRECT_OBJECT_SESSION_ATTRIBUTE) != null) {
VaadinRedirectObject redirectObject = (VaadinRedirectObject) sessionStrategy.getAttribute(attrs, VaadinRedirectObject.REDIRECT_OBJECT_SESSION_ATTRIBUTE);
sessionStrategy.removeAttribute(attrs, VaadinRedirectObject.REDIRECT_OBJECT_SESSION_ATTRIBUTE);
navigator.navigateTo(redirectObject.getRedirectViewToken());
if (redirectObject.getErrorMessage() != null) {
Notification.show("Error", redirectObject.getErrorMessage(), Type.ERROR_MESSAGE);
}
}
}
示例13: buttonClick
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
public void buttonClick(ClickEvent event) {
Navigator navigator = UI.getCurrent().getNavigator();
if (navigator != null)
navigator.navigateTo(viewName);
}
示例14: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
setLocale(Locale.ENGLISH);
// Let's register a custom error handler to make the 'access denied' messages a bit friendlier.
setErrorHandler(new DefaultErrorHandler() {
@Override
public void error(com.vaadin.server.ErrorEvent event) {
if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) {
Notification.show("Sorry, you don't have access to do that.");
} else {
super.error(event);
}
}
});
VerticalLayout layout = new VerticalLayout();
Panel viewContent = new Panel();
MenuBar menu = new MenuBar();
menu.addStyleName("navigation-menu");
layout.addComponents(menu, viewContent);
layout.setSizeFull();
viewContent.setSizeFull();
layout.setExpandRatio(viewContent, 1);
menu.addItem("Trading Area", e -> onDashboardClicked());
menu.addItem("Users", e -> onCustomersClicked());
navigator = new Navigator(this, viewContent);
springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
navigator.addProvider(springViewProvider);
navigator.setErrorView(ErrorView.class);
setContent(layout);
String state = navigator.getState();
if(state != null && !state.isEmpty()) {
navigator.navigateTo(state);
}
else {
navigator.navigateTo(TradingAreaView.NAME);
}
}
示例15: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
Navigator navigator = new Navigator(this, this);
navigator.addProvider(viewProvider);
setNavigator(navigator);
navigator.navigateTo("main");
}