List of usage examples for com.vaadin.navigator Navigator Navigator
public Navigator(UI ui, ViewDisplay display)
From source file:org.vaadin.spring.samples.sidebar.SideBarUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("Vaadin4Spring Side Bar Sample"); final HorizontalSplitPanel rootLayout = new HorizontalSplitPanel(); rootLayout.setStyleName(Reindeer.SPLITPANEL_SMALL); rootLayout.setSizeFull();//www .ja v a2s . c om setContent(rootLayout); final Navigator navigator = new Navigator(this, new ViewDisplay() { @Override public void showView(View view) { System.out.println("Showing view " + view); rootLayout.setSecondComponent((com.vaadin.ui.Component) view); } }); navigator.setErrorView(new ErrorView()); navigator.addProvider(viewProvider); setNavigator(navigator); rootLayout.setFirstComponent(sideBar); rootLayout.setSplitPosition(150, Unit.PIXELS); }
From source file:org.vaadin.webinars.springandvaadin.aspectj.ui.AspectJManagedUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/* ww w.java 2s.c o m*/ layout.setSpacing(true); layout.setMargin(true); author = new TextField("Author"); author.setImmediate(true); layout.addComponent(author); viewContainer = new Panel(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); setContent(layout); Navigator navigator = new Navigator(this, viewContainer); navigator.addView("rooms", new RoomsView()); navigator.addView("chat", ChatView.class); if (navigator.getState().isEmpty()) { navigator.navigateTo("rooms"); } setPollInterval(800); }
From source file:pl.adrian.pieper.biuwaw.UserPanel.java
public UserPanel(MainUI mainUI) { this.mainUI = mainUI; if (manager.isUserOnline()) { PartyService.getInstance(); // To remove userLabel.setValue(manager.getUser().getName()); comboBox.addItems(manager.getUser().getInvitations()); VerticalLayout root = new VerticalLayout(); Navigator.EmptyView emptyView = new Navigator.EmptyView(); HorizontalLayout userMenu = new HorizontalLayout(userLabel, newPartyButton, comboBox); userMenu.setWidth(40, Unit.PERCENTAGE); userMenu.setComponentAlignment(userLabel, Alignment.MIDDLE_CENTER); userMenu.setComponentAlignment(newPartyButton, Alignment.MIDDLE_CENTER); userMenu.setComponentAlignment(comboBox, Alignment.MIDDLE_CENTER); emptyView.setWidth(80, Unit.PERCENTAGE); emptyView.setHeightUndefined();//from w w w. ja v a 2s . c o m root.addComponents(userMenu, emptyView); root.setComponentAlignment(userMenu, Alignment.MIDDLE_CENTER); root.setComponentAlignment(emptyView, Alignment.MIDDLE_CENTER); newPartyButton.addClickListener((com.vaadin.ui.Button.ClickEvent event) -> { userNavigator.navigateTo(MainUI.NEW_PARTY); }); comboBox.setCaption("Imprezy"); comboBox.addValueChangeListener((com.vaadin.data.Property.ValueChangeEvent event) -> { if (comboBox.getValue() instanceof Party) { Party party = (Party) comboBox.getValue(); userNavigator.navigateTo(MainUI.PARTY + "/" + party.getId()); } }); this.userNavigator = new Navigator(mainUI, emptyView); final NewPartyView newPartyView = new NewPartyView(userNavigator); userNavigator.addView("", new Navigator.EmptyView()); userNavigator.addView(NEW_PARTY, newPartyView); partyView = new PartyView(); userNavigator.addView(PARTY, partyView); setCompositionRoot(root); } }
From source file:pl.com.itsense.pattern.processing.analyzer.BrowserApplication.java
License:Apache License
@Override protected void init(final VaadinRequest request) { navigator = new Navigator(this, this); navigator.addView(VIEW_WORKSPACE, new WorkspaceView(navigator, sessionFactory)); navigator.navigateTo(VIEW_WORKSPACE); }
From source file:pl.exsio.frameset.vaadin.navigation.FramesetNavigatorImpl.java
License:Open Source License
protected Navigator createNavigator() throws InvalidNavigationTargetException { if (this.navigationTarget instanceof ViewDisplayNavigationTarget) { return new Navigator(this.ui, (ViewDisplayNavigationTarget) this.navigationTarget); } else if (this.navigationTarget instanceof ComponentContainerNavigationTarget) { return new Navigator(this.ui, (ComponentContainerNavigationTarget) this.navigationTarget); } else {/*from w ww. j a v a 2 s. c o m*/ throw new InvalidNavigationTargetException(this.navigationTarget.getClass()); } }
From source file:test.fmc.simpleclient.SimpleClientUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Navigator navigator = new Navigator(this, this); navigator.addProvider(viewProvider); navigator.navigateTo(Pages.INDEX);/*from ww w .j a v a 2s .c o m*/ }
From source file:uk.co.intec.keyDatesApp.MainUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { try {// w w w. ja va 2 s . co m setRequest(request); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); getPage().setTitle("Key Dates App"); setStyleName("main-screen"); final VerticalLayout layout = new VerticalLayout(); setHeader(new HeaderComponent(this)); layout.addComponent(getHeader()); setContent(layout); setBody(new VerticalLayout()); getBody().setMargin(new MarginInfo(false, true, false, true)); layout.addComponent(getBody()); setUiNavigator(new Navigator(this, body)); getUiNavigator().setErrorView(ErrorView.class); addNewMenuItem(HomeView.VIEW_NAME, HomeView.VIEW_LABEL, new HomeView()); addNewMenuItem(MainView.VIEW_NAME, MainView.VIEW_LABEL, new MainView()); addNewMenuItem(CalendarView.VIEW_NAME, CalendarView.VIEW_LABEL, new CalendarView()); addNewMenuItem(KeyDateView.VIEW_NAME, KeyDateView.VIEW_LABEL, new KeyDateView()); if (!GenericDatabaseUtils.doesDbExist() || "Anonymous".equals(GenericDatabaseUtils.getUserName())) { getUiNavigator().navigateTo(HomeView.VIEW_NAME); } } catch (final Exception e) { e.printStackTrace(); } }