use of org.opennms.features.vaadin.jmxconfiggenerator.ui.mbeans.MBeansView 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) {
}
});
}
Aggregations