@Override
  protected void setup(VaadinRequest request) {
    Layout navigatorLayout = new VerticalLayout();
    navigator = new Navigator(this, navigatorLayout);

    addComponent(navigatorLayout);

    navigator.addView(DEFAULT_VIEW_ID, new DefaultView());

    navigator.addView(SECOND_VIEW_ID, new SecondView());
  }
 @Override
 protected void init(VaadinRequest request) {
   setTheme("valo");
   getPage().setTitle("Aruba Networks");
   MainView mainview = new MainView();
   navigator = new Navigator(this, this);
   navigator.addView("login", new LoginView());
   navigator.addView("main", mainview);
   // navigator.addView("Dataset1", new Dataset1View());
   // navigator.addView("Dataset2",new Dataset2View());
   navigator.navigateTo("main");
 }
  public MainView() {
    Navigator navigator = new Navigator(UI.getCurrent(), scroll_panel);
    navigator.addView(DashboardView.VIEW_NAME, DashboardView.class);
    navigator.addView(OrderView.VIEW_NAME, OrderView.class);
    navigator.addView(AboutView.VIEW_NAME, AboutView.class);
    if (navigator.getState().isEmpty()) {
      navigator.navigateTo(DashboardView.VIEW_NAME);
    }

    //		menuButton1.addClickListener(event -> scroll_panel.setContent(new DashboardView()));
    //        menuButton2.addClickListener(event -> scroll_panel.setContent(new OrderView()));
    //        menuButton3.addClickListener(event -> scroll_panel.setContent(new AboutView()));

    menuButton1.addClickListener(event -> doNavigate(DashboardView.VIEW_NAME));
    menuButton2.addClickListener(event -> doNavigate(OrderView.VIEW_NAME));
    menuButton3.addClickListener(event -> doNavigate(AboutView.VIEW_NAME));
  }
Beispiel #4
0
  /** Initialize the navigator with all views */
  private void initNavigator() {
    navigator = new Navigator(this, this);
    navigator.addViewChangeListener(new BackButtonController());

    navigator.setErrorView(new ErrorView());

    navigator.addView(LoginView.NAME_NAV, new LoginView());
    navigator.addView(ChooseExamView.NAME_NAV, new ChooseExamView());
    navigator.addView(AdministrationView.NAME_NAV, new AdministrationView());
    navigator.addView(UserListView.NAME_NAV, new UserListView());
    navigator.addView(UserImportView.NAME_NAV, new UserImportView());
    navigator.addView(QuestionListView.NAME_NAV, new QuestionListView());
    navigator.addView(DatabaseView.NAME_NAV, new DatabaseView());
    navigator.addView(CategoryListView.NAME_NAV, new CategoryListView());

    navigator.addView("RandomExam", randomExamView);

    navigator.addView("TakeExam", new TakeExamView());
  }
Beispiel #5
0
  /** Registers av given view to the navigator and adds it to the NavBar */
  private void addView(Class<? extends View> viewClass) {
    ViewConfig viewConfig = viewClass.getAnnotation(ViewConfig.class);

    switch (viewConfig.createMode()) {
      case ALWAYS_NEW:
        navigator.addView(viewConfig.uri(), viewClass);
        break;
      case LAZY_INIT:
        navigator.addProvider(new LazyProvider(viewConfig.uri(), viewClass));
        break;
      case EAGER_INIT:
        try {
          navigator.addView(viewConfig.uri(), viewClass.newInstance());
        } catch (Exception e) {
          e.printStackTrace();
        }
    }
    navBar.addView(viewConfig.uri(), viewConfig.displayName());
  }
  private void BuildNavigator() {
    navegador = new Navigator(parentUI, content);
    navegador.addView("/dashboard", DashboardView.class);

    for (String route : routes.keySet()) {
      navegador.addView("/" + route, routes.get(route));
    }
    String f = Page.getCurrent().getUriFragment();
    if (f != null && f.startsWith("!")) {
      f = f.substring(1);
    }
    if (f == null || f.equals("") || f.equals("/")) {
      navegador.navigateTo("/dashboard");
      menu.getComponent(0).addStyleName("selected");
      HelpManager.getInstance().showHelpFor(DashboardView.class);
    } else {
      navegador.navigateTo(f);
      HelpManager.getInstance().showHelpFor(routes.get(f));
      viewNameToMenuButton.get(f).addStyleName("selected");
    }

    navegador.addViewChangeListener(
        new ViewChangeListener() {
          @Override
          public boolean beforeViewChange(ViewChangeEvent event) {
            HelpManager.getInstance().closeAll();
            return true;
          }

          @Override
          public void afterViewChange(ViewChangeEvent event) {
            View newView = event.getNewView();
            HelpManager.getInstance().showHelpFor(newView);
          }
        });
  }