Search in sources :

Example 1 with UiModel

use of org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel in project opennms by OpenNMS.

the class ResultView method enter.

@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    UiModel newValue = UIHelper.getCurrent(JmxConfigGeneratorUI.class).getUiModel();
    if (newValue == null)
        return;
    for (Entry<UiModel.OutputDataKey, String> eachEntry : newValue.getOutputMap().entrySet()) {
        if (tabContentMap.get(eachEntry.getKey()) != null) {
            tabContentMap.get(eachEntry.getKey()).setConfigContent(eachEntry.getValue());
        }
    }
    fileDownloader.setFileDownloadResource(new DownloadResource(createZipContentMap(), DOWNLOAD_FILE_NAME));
}
Also used : UiModel(org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel) OutputDataKey(org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel.OutputDataKey) JmxConfigGeneratorUI(org.opennms.features.vaadin.jmxconfiggenerator.JmxConfigGeneratorUI)

Example 2 with UiModel

use of org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel in project opennms by OpenNMS.

the class MBeansView method enter.

@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    if (app.getUiModel() != model) {
        UiModel newModel = app.getUiModel();
        model = newModel;
        controller.updateDataSource(model);
    }
}
Also used : UiModel(org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel)

Example 3 with UiModel

use of org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel 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)

Aggregations

UiModel (org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel)3 Navigator (com.vaadin.navigator.Navigator)1 ViewChangeListener (com.vaadin.navigator.ViewChangeListener)1 JmxConfigGeneratorUI (org.opennms.features.vaadin.jmxconfiggenerator.JmxConfigGeneratorUI)1 OutputDataKey (org.opennms.features.vaadin.jmxconfiggenerator.data.UiModel.OutputDataKey)1 DetectMBeansJob (org.opennms.features.vaadin.jmxconfiggenerator.jobs.DetectMBeansJob)1 GenerateConfigsJob (org.opennms.features.vaadin.jmxconfiggenerator.jobs.GenerateConfigsJob)1 ConfigView (org.opennms.features.vaadin.jmxconfiggenerator.ui.ConfigView)1 ResultView (org.opennms.features.vaadin.jmxconfiggenerator.ui.ResultView)1 UiState (org.opennms.features.vaadin.jmxconfiggenerator.ui.UiState)1 MBeansView (org.opennms.features.vaadin.jmxconfiggenerator.ui.mbeans.MBeansView)1