本文整理汇总了Java中com.vaadin.navigator.Navigator类的典型用法代码示例。如果您正苦于以下问题:Java Navigator类的具体用法?Java Navigator怎么用?Java Navigator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Navigator类属于com.vaadin.navigator包,在下文中一共展示了Navigator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
setNavigator(new Navigator(this, (View view) -> {
tabs.setSelectedTab((Component) view);
}));
registerExample(SvgInVaadin.class);
registerExample(SimplyAsAnImageOrIcon.class);
registerExample(FileExample.class);
registerExample(AnimationExample.class);
registerExample(Java2DExample.class);
registerExample(JungExample.class);
getNavigator().setErrorView(SvgInVaadin.class);
tabs.addSelectedTabChangeListener(e -> {
if (e.isUserOriginated()) {
getNavigator().navigateTo(e.getTabSheet().getSelectedTab().getClass().getSimpleName());
}
});
String state = getNavigator().getState();
getNavigator().navigateTo(state);
tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
setContent(tabs);
}
示例2: selectSubMenuSheet
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
/** Selection d'un element du sous menu
* @param menu
* @param vue
*/
public void selectSubMenuSheet(Menu menu, String vue,Navigator navigator, Boolean cleanListener){
if (cleanListener){
/*Suppression des listeners du tabSheet-->Sinon lorsqu'on ajoute un élément, il navigue donc boucle*/
cleanTabSheetListener();
}
/*Suppression des listeners du tabSheet-->Sinon lorsqu'on ajoute un élément, il navigue donc boucle*/
cleanTabSheetListener();
menu.getSubMenu().forEach(s -> {
if (s.getVue().equals(vue)){
this.setSelectedTab(s.getLabel());
}
});
/*Ajout du listener*/
if (cleanListener){
addTabSheetListener(navigator);
}
}
示例3: 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);
}
}
示例4: 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");
}
示例5: MainScreen
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
public MainScreen(MyUI ui) {
setStyleName("main-screen");
CssLayout viewContainer = new CssLayout();
viewContainer.addStyleName("valo-content");
viewContainer.setSizeFull();
//final Navigator navigator = new Navigator(ui, viewContainer);
final Navigator navigator = new DiscoveryNavigator(ui, viewContainer);
navigator.setErrorView(ErrorView.class);
menu = new Menu(navigator);
menu.addView(new SampleCrudView(), SampleCrudView.VIEW_NAME,
SampleCrudView.VIEW_NAME, FontAwesome.EDIT);
menu.addView(new AboutView(), AboutView.VIEW_NAME, AboutView.VIEW_NAME,
FontAwesome.INFO_CIRCLE);
navigator.addViewChangeListener(viewChangeListener);
addComponent(menu);
addComponent(viewContainer);
setExpandRatio(viewContainer, 1);
setSizeFull();
}
示例6: present
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
private void present() {
context = new ClassPathXmlApplicationContext(new String[] { "./applicationContext.xml" });
Set<Class<?>> pages = getAllPages();
System.out.println("Pages found: " + pages.size());
ArrayList<PageController> annotations = getAnnotations(pages);
MetricsToGoVaadinUIController controler = new MetricsToGoVaadinUIController(context, pages);
setContent(contentPane);
Navigator navigator = new Navigator(this, centerContent);
System.out.println("Annotations size:" + annotations.size());
pages.forEach(System.out::println);
annotations.forEach(System.out::println);
annotations.stream()//
.peek(System.out::println).forEach(page -> navigator.addView(page.id(), controler));
initSidebar(navigator, annotations);
contentPane.addComponent(centerContent);
contentPane.setComponentAlignment(centerContent, Alignment.MIDDLE_CENTER);
navigator.addView("main", controler);
navigator.addView("", controler);
}
示例7: initSidebar
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
private void initSidebar(Navigator navigator, ArrayList<PageController> pages) {
Sidebar sidebar = context.getBean(Sidebar.class);
ArrayList<Controller> controller = new ArrayList<>();
pages.stream().map(page -> new Controller(page.id(), page.name())).forEach(controller::add);
sidebar.setNavigator(navigator::navigateTo, controller);
contentPane.addComponent((Component) sidebar);
contentPane.setComponentAlignment((Component) sidebar, Alignment.TOP_LEFT);
Label spacing = new Label();
spacing.setWidth(2, Unit.REM);
contentPane.addComponent(spacing);
contentPane.setComponentAlignment(spacing, Alignment.TOP_LEFT);
}
示例8: 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));
}
示例9: 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());
}
}
示例10: 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);
}
示例11: MainScreen
import com.vaadin.navigator.Navigator; //导入依赖的package包/类
public MainScreen(MockAppUI ui) {
setStyleName("main-screen");
CssLayout viewContainer = new CssLayout();
viewContainer.addStyleName("valo-content");
viewContainer.setSizeFull();
final Navigator navigator = new Navigator(ui, viewContainer);
navigator.setErrorView(ErrorView.class);
menu = new Menu(navigator);
menu.addView(new SampleCrudView(), SampleCrudView.VIEW_NAME,
SampleCrudView.VIEW_NAME, FontAwesome.EDIT);
menu.addView(new AboutView(), AboutView.VIEW_NAME, AboutView.VIEW_NAME,
FontAwesome.INFO_CIRCLE);
navigator.addViewChangeListener(viewChangeListener);
addComponent(menu);
addComponent(viewContainer);
setExpandRatio(viewContainer, 1);
setSizeFull();
}
示例12: 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);
}
示例13: 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());
}
示例14: 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);
}
}
示例15: 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);
}