本文整理汇总了Java中com.vaadin.navigator.Navigator.addProvider方法的典型用法代码示例。如果您正苦于以下问题:Java Navigator.addProvider方法的具体用法?Java Navigator.addProvider怎么用?Java Navigator.addProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.navigator.Navigator
的用法示例。
在下文中一共展示了Navigator.addProvider方法的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: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
log.info("Levanto la pagina UI");
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
setContent(root);
final Panel viewContainer = new Panel();
viewContainer.setSizeFull();
root.addComponent(viewContainer);
root.setExpandRatio(viewContainer, 1.0f);
Navigator navigator = new Navigator(this, viewContainer);
//Navigator navigator = new Navigator(this, this);
navigator.addProvider(viewProvider);
log.info("Termina de levantar la pagina UI");
}
示例3: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout mainLayout = new VerticalLayout();
HorizontalLayout horizontalLayout = new HorizontalLayout();
CssLayout viewLayout = new CssLayout();
Page.getCurrent().setTitle("Vaadin Demo");
mainLayout.setSizeFull();
viewLayout.setSizeFull();
mainLayout.setMargin(true);
setContent(mainLayout);
mainLayout.addComponent(horizontalLayout);
mainLayout.addComponent(viewLayout);
mainLayout.setExpandRatio(viewLayout, 1f);
Navigator navigator = new Navigator(this, viewLayout);
setNavigator(navigator);
setupHeader(horizontalLayout);
Map<String, Class<? extends MyView>> myViews = getViewProvider();
navigator.addView("", new HomeView(myViews.keySet()));
navigator.addProvider(new CachedViewProvider(myViews));
}
示例4: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
getPage().setTitle("Vaadin4Spring Side Bar Sample");
final HorizontalLayout rootLayout = new HorizontalLayout();
rootLayout.setSizeFull();
setContent(rootLayout);
final VerticalLayout viewContainer = new VerticalLayout();
viewContainer.setSizeFull();
final Navigator navigator = new Navigator(this, viewContainer);
navigator.setErrorView(new ErrorView());
navigator.addProvider(viewProvider);
setNavigator(navigator);
rootLayout.addComponent(getSideBar());
rootLayout.addComponent(viewContainer);
rootLayout.setExpandRatio(viewContainer, 1.0f);
}
示例5: 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());
}
示例6: 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);
}
}
示例7: buildMain
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
/**
* Build application main window
*/
protected void buildMain() {
this.root.removeAllComponents();
this.top.setWidth(100, Unit.PERCENTAGE);
this.top.setSpacing(false);
this.top.setMargin(false);
this.top.addComponent(buttonBar);
this.root.addComponent(top);
this.root.addComponent(mainView);
this.root.setSpacing(false);
this.root.setMargin(false);
this.root.setExpandRatio(top, 0);
this.root.setExpandRatio(mainView, 1);
Navigator navigator = new Navigator(this, mainView);
navigator.addProvider(viewProvider);
}
示例8: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(new MarginInfo(false, false, false, true));
root.setSpacing(true);
setContent(root);
HorizontalLayout topBar = new HorizontalLayout();
topBar.setSpacing(true);
Image logo = new Image(null, new ExternalResource("images/logo1.png"));
logo.setHeight(31f, Unit.PIXELS);
logo.setWidthUndefined();
topBar.addComponent(logo);
CssLayout navBar = new CssLayout();
navBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
navBar.addComponent(createNavButton(messages.get("usersNavigationLabel"), UsersViewImpl.VIEW_NAME));
navBar.addComponent(createNavButton(messages.get("projectsNavigationLabel"), ProjectsViewImpl.VIEW_NAME));
navBar.addComponent(createNavButton(messages.get("rolesNavigationLabel"), RolesViewImpl.VIEW_NAME));
topBar.addComponent(navBar);
root.addComponent(topBar);
final Panel viewContainer = new Panel();
viewContainer.setSizeFull();
root.addComponent(viewContainer);
root.setExpandRatio(viewContainer, 1.0f);
Navigator navigator = new Navigator(this, viewContainer);
navigator.addProvider(viewProvider);
navigator.setErrorProvider(viewProvider);
navigator.setErrorView(ErrorView.class);
}
示例9: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(final VaadinRequest request) {
rootLayout.setSizeFull();
final Panel viewContainer = new Panel();
viewContainer.setSizeFull();
rootLayout.addComponent(viewContainer);
rootLayout.setExpandRatio(viewContainer, 1.0F);
final Navigator navigator = new Navigator(this, viewContainer);
navigator.addProvider(viewProvider);
setContent(rootLayout);
}
示例10: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final CssLayout root = new CssLayout();
root.setSizeFull();
setContent(root);
Navigator navigator = new Navigator(this, root);
navigator.addProvider(viewProvider);
}
示例11: 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.addViewChangeListener(this);
}
示例12: initialize
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@PostConstruct
public void initialize() {
if (ui.getNavigator() == null) {
Navigator navigator = new Navigator(ui, ui);
navigator.addProvider(viewProvider);
navigator.setErrorView(errorView);
}
}
示例13: init
import com.vaadin.navigator.Navigator; //导入方法依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
setContent(root);
final CssLayout navigationBar = new CssLayout();
navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
navigationBar.addComponent(createNavigationButton("Prototype Scoped View", PrototypeScopedView.VIEW_NAME));
navigationBar.addComponent(createNavigationButton("UI Scoped View", UIScopedView.VIEW_NAME));
navigationBar.addComponent(createNavigationButton("View Scoped View", ViewScopedView.VIEW_NAME));
navigationBar.addComponent(createNavigationButton("Access Control", AccessControlView.VIEW_NAME));
root.addComponent(navigationBar);
final Panel viewContainer = new Panel();
viewContainer.setSizeFull();
root.addComponent(viewContainer);
root.setExpandRatio(viewContainer, 1.0f);
viewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
Navigator navigator = new Navigator(this, viewContainer);
navigator.setErrorView(new ErrorView()); // You can still create the error view yourself if you want to.
navigator.addProvider(viewProvider);
}
示例14: 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.
}
示例15: 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);
}
}
}