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) {
}
});
}
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();
}
Aggregations