Search in sources :

Example 6 with Navigator

use of com.vaadin.navigator.Navigator in project opennms by OpenNMS.

the class JmxConfigGeneratorUI method initNavigator.

private void initNavigator() {
    navigator = new Navigator(this, contentPanel);
    // common views
    navigator.addView(UiState.ServiceConfigurationView.name(), new ConfigView(this));
    navigator.addView(UiState.MbeansView.name(), new MBeansView(this));
    navigator.addView(UiState.ResultView.name(), new ResultView());
    // "working views" need to be simulated, they do not actually exist, but we need them for navigation
    navigator.addView(UiState.MbeansDetection.name(), new Navigator.EmptyView());
    navigator.addView(UiState.ResultConfigGeneration.name(), new Navigator.EmptyView());
    // We need to hook into the "view change" process to prevent changing to the "working views"
    // Instead we trigger a long running task and show a "please wait" window.
    navigator.addViewChangeListener(new ViewChangeListener() {

        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            hideProgressWindow();
            headerPanel.enter(event);
            final UiState uiState = UiState.valueOf(event.getViewName());
            if (UiState.ServiceConfigurationView == uiState) {
                UiModel newModel = new UiModel();
                if (model != null) {
                    newModel.setServiceConfig(model.getServiceConfig());
                }
                model = newModel;
            }
            if (UiState.MbeansDetection == uiState) {
                showProgressWindow(uiState.getDescription());
                enqueue(new DetectMBeansJob(getUiModel().getServiceConfig()));
                return false;
            }
            if (UiState.ResultConfigGeneration == uiState) {
                showProgressWindow(uiState.getDescription());
                enqueue(new GenerateConfigsJob(getUiModel()));
                return false;
            }
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {
        }
    });
}
Also used : ConfigView(org.opennms.features.vaadin.jmxconfiggenerator.ui.ConfigView) Navigator(com.vaadin.navigator.Navigator) MBeansView(org.opennms.features.vaadin.jmxconfiggenerator.ui.mbeans.MBeansView) UiModel(org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel) UiState(org.opennms.features.vaadin.jmxconfiggenerator.ui.UiState) GenerateConfigsJob(org.opennms.features.vaadin.jmxconfiggenerator.jobs.GenerateConfigsJob) DetectMBeansJob(org.opennms.features.vaadin.jmxconfiggenerator.jobs.DetectMBeansJob) ResultView(org.opennms.features.vaadin.jmxconfiggenerator.ui.ResultView) ViewChangeListener(com.vaadin.navigator.ViewChangeListener)

Example 7 with Navigator

use of com.vaadin.navigator.Navigator in project ANNIS by korpling.

the class AnnisUI method init.

@Override
protected void init(VaadinRequest request) {
    super.init(request);
    setErrorHandler(this);
    searchView = new SearchView(AnnisUI.this);
    adminView = new AdminView(AnnisUI.this);
    queryController = new QueryController(searchView, AnnisUI.this);
    toolbar = new MainToolbar();
    toolbar.setQueryController(queryController);
    toolbar.addLoginListener(searchView);
    toolbar.addLoginListener(adminView);
    nav = new Navigator(AnnisUI.this, AnnisUI.this);
    nav.addView(SearchView.NAME, searchView);
    nav.addView(AdminView.NAME, adminView);
    nav.addViewChangeListener(AnnisUI.this);
    addExtension(toolbar.getScreenshotExtension());
    loadInstanceFonts();
}
Also used : Navigator(com.vaadin.navigator.Navigator)

Aggregations

Navigator (com.vaadin.navigator.Navigator)7 AppLayoutComponent (com.github.appreciated.app.layout.behaviour.AppLayoutComponent)2 Behaviour (com.github.appreciated.app.layout.behaviour.Behaviour)2 AppLayoutDesign (com.github.appreciated.app.layout.builder.design.AppLayoutDesign)2 AbstractNavigationElement (com.github.appreciated.app.layout.builder.elements.AbstractNavigationElement)2 NavigatorNavigationElement (com.github.appreciated.app.layout.builder.elements.NavigatorNavigationElement)2 SectionNavigationElement (com.github.appreciated.app.layout.builder.elements.SectionNavigationElement)2 SubmenuNavigationElement (com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement)2 NavigationElementInfo (com.github.appreciated.app.layout.builder.entities.NavigationElementInfo)2 DefaultLeftClickableNavigationElementFactory (com.github.appreciated.app.layout.builder.factories.left.DefaultLeftClickableNavigationElementFactory)2 DefaultLeftNavigationBadgeElementComponentFactory (com.github.appreciated.app.layout.builder.factories.left.DefaultLeftNavigationBadgeElementComponentFactory)2 DefaultLeftSectionElementComponentFactory (com.github.appreciated.app.layout.builder.factories.left.DefaultLeftSectionElementComponentFactory)2 DefaultLeftSubmenuNavigationElementFactory (com.github.appreciated.app.layout.builder.factories.left.DefaultLeftSubmenuNavigationElementFactory)2 DefaultTopSubmenuNavigationElementFactory (com.github.appreciated.app.layout.builder.factories.top.DefaultTopSubmenuNavigationElementFactory)2 ComponentFactory (com.github.appreciated.app.layout.builder.interfaces.ComponentFactory)2 Factory (com.github.appreciated.app.layout.builder.interfaces.Factory)2 HasCaptionInterceptor (com.github.appreciated.app.layout.builder.interfaces.HasCaptionInterceptor)2 NavigationElementComponent (com.github.appreciated.app.layout.builder.interfaces.NavigationElementComponent)2 ComponentNavigator (com.github.appreciated.app.layout.navigator.ComponentNavigator)2 AppLayoutSessionHelper (com.github.appreciated.app.layout.session.AppLayoutSessionHelper)2