Skip to content
Snippets Groups Projects
Commit 56843f86 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Refactoring

parent 156d21fe
No related branches found
No related tags found
No related merge requests found
Showing
with 114 additions and 257 deletions
......@@ -23,11 +23,11 @@ import kieker.gui.mainview.Controller;
*
* @author Nils Christian Ehmke
*/
public class Main {
public final class Main {
/**
* The main method of this application.
*
*
* @param args
* The command line arguments. They have no effect.
*/
......
......@@ -27,7 +27,7 @@ import kieker.common.record.misc.KiekerMetadataRecord;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.domain.Execution;
import kieker.gui.common.domain.Record;
import kieker.gui.common.importer.ImportAnalysisConfiguration;
import kieker.gui.common.model.importer.ImportAnalysisConfiguration;
import teetime.framework.Analysis;
/**
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer;
package kieker.gui.common.model.importer;
import java.io.File;
import java.util.List;
......@@ -26,13 +26,13 @@ import kieker.common.record.misc.KiekerMetadataRecord;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.domain.Execution;
import kieker.gui.common.domain.Record;
import kieker.gui.common.importer.stages.FailedAggregatedTraceFilter;
import kieker.gui.common.importer.stages.FailedTraceFilter;
import kieker.gui.common.importer.stages.FailureContainingAggregatedTraceFilter;
import kieker.gui.common.importer.stages.FailureContainingTraceFilter;
import kieker.gui.common.importer.stages.RecordSimplificator;
import kieker.gui.common.importer.stages.TraceAggregator;
import kieker.gui.common.importer.stages.TraceReconstructor;
import kieker.gui.common.model.importer.stages.FailedAggregatedTraceFilter;
import kieker.gui.common.model.importer.stages.FailedTraceFilter;
import kieker.gui.common.model.importer.stages.FailureContainingAggregatedTraceFilter;
import kieker.gui.common.model.importer.stages.FailureContainingTraceFilter;
import kieker.gui.common.model.importer.stages.RecordSimplificator;
import kieker.gui.common.model.importer.stages.TraceAggregator;
import kieker.gui.common.model.importer.stages.TraceReconstructor;
import teetime.framework.AnalysisConfiguration;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import kieker.gui.common.domain.AggregatedExecution;
import teetime.framework.AbstractConsumerStage;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import kieker.gui.common.domain.Execution;
import teetime.framework.AbstractConsumerStage;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import kieker.gui.common.domain.AggregatedExecution;
import teetime.framework.AbstractConsumerStage;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import kieker.gui.common.domain.Execution;
import teetime.framework.AbstractConsumerStage;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import kieker.common.record.IMonitoringRecord;
import kieker.gui.common.domain.Record;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import java.util.HashMap;
import java.util.Map;
......
......@@ -14,7 +14,7 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import java.util.Deque;
import java.util.HashMap;
......
......@@ -23,6 +23,8 @@ import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.ISubController;
import kieker.gui.subview.ISubView;
import kieker.gui.subview.aggregatedtraces.Controller.Filter;
import kieker.gui.subview.traces.Controller.Type;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
......@@ -47,12 +49,12 @@ public final class Controller implements SelectionListener {
// Create the sub-controllers
final ISubController subViewController1 = new kieker.gui.subview.records.Controller(this.dataModel);
final ISubController subViewController2 = new kieker.gui.subview.aggregatedtraces.Controller(this.dataModel, this.propertiesModel);
final ISubController subViewController3 = new kieker.gui.subview.traces.FailedController(this.dataModel, this.propertiesModel);
final ISubController subViewController4 = new kieker.gui.subview.traces.Controller(this.dataModel, this.propertiesModel);
final ISubController subViewController5 = new kieker.gui.subview.traces.FailureController(this.dataModel, this.propertiesModel);
final ISubController subViewController6 = new kieker.gui.subview.aggregatedtraces.FailedController(this.dataModel, this.propertiesModel);
final ISubController subViewController7 = new kieker.gui.subview.aggregatedtraces.FailureController(this.dataModel, this.propertiesModel);
final ISubController subViewController2 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.NONE, this.dataModel, this.propertiesModel);
final ISubController subViewController3 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController4 = new kieker.gui.subview.traces.Controller(Type.NONE, this.dataModel, this.propertiesModel);
final ISubController subViewController5 = new kieker.gui.subview.traces.Controller(Type.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController6 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILED_TRACES, this.dataModel, this.propertiesModel);
final ISubController subViewController7 = new kieker.gui.subview.aggregatedtraces.Controller(Filter.JUST_FAILURE_CONTAINING_TRACES, this.dataModel, this.propertiesModel);
// Get the sub-views from the controllers
final Map<String, ISubView> subViews = new HashMap<>();
......
......@@ -18,9 +18,14 @@ package kieker.gui.mainview;
import java.util.Observable;
/**
* The model of the main view.
*
* @author Nils Christian Ehmke
*/
public final class Model extends Observable {
private String currentActiveSubViewKey = "";
private String currentActiveSubViewKey;
public String getCurrentActiveSubViewKey() {
return this.currentActiveSubViewKey;
......
......@@ -36,7 +36,12 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
public class View implements Observer {
/**
* The main view of the application. For the most part it uses sub-views to show data.
*
* @author Nils Christian Ehmke
*/
public final class View implements Observer {
private final DataModel dataModel;
private final Model mainViewModel;
......@@ -46,20 +51,22 @@ public class View implements Observer {
private Shell shell;
private Composite subViewComposite;
private StackLayout subViewLayout;
private Tree tree;
private TreeItem trtmExplorer;
private TreeItem trtmRecords;
private TreeItem trtmTraces;
private DirectoryDialog dialog;
private MenuItem mntmExit;
private MenuItem mntmShortOperationNames;
private MenuItem mntmLongOperationNames;
private MenuItem mntmShortComponentNames;
private MenuItem mntmLongComponentNames;
private MenuItem mntmOpenMonitoringLog;
private DirectoryDialog dialog;
private Tree tree;
private TreeItem trtmExplorer;
private TreeItem trtmRecords;
private TreeItem trtmTraces;
private TreeItem trtmAggregatedTraces;
private TreeItem trtmJustFailedTraces;
private TreeItem trtmJustTracesContaining;
private TreeItem trtmJustFailedAggTraces;
private TreeItem trtmJustAggTracesContaining;
......
......@@ -16,7 +16,6 @@
package kieker.gui.subview;
/**
* A commons interface for all sub-controllers to reduce dependencies.
*
......
......@@ -18,6 +18,11 @@ package kieker.gui.subview;
import org.eclipse.swt.widgets.Composite;
/**
* An interface for classes representing sub-views within the main view.
*
* @author Nils Christian Ehmke
*/
public interface ISubView {
public void createComposite(final Composite parent);
......
package kieker.gui.subview.aggregatedtraces;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.ISubController;
import kieker.gui.subview.ISubView;
import kieker.gui.subview.util.IModel;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public abstract class AbstractController implements ISubController, SelectionListener {
private final ISubView view;
private final Model model;
public AbstractController(final DataModel dataModel, final PropertiesModel propertiesModel) {
final IModel<AggregatedExecution> modelProxy = this.createModelProxy(dataModel);
this.model = new Model();
this.view = new View(modelProxy, this.model, propertiesModel, this);
}
@Override
public ISubView getView() {
return this.view;
}
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.item.getData() instanceof AggregatedExecution) {
this.model.setCurrentActiveTrace((AggregatedExecution) e.item.getData());
}
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {}
protected abstract IModel<AggregatedExecution> createModelProxy(final DataModel dataModel);
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.gui.subview.aggregatedtraces;
import java.util.List;
......@@ -21,33 +5,58 @@ import java.util.List;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.ISubController;
import kieker.gui.subview.ISubView;
import kieker.gui.subview.util.AbstractDataModelProxy;
import kieker.gui.subview.util.IModel;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class Controller implements ISubController, SelectionListener {
private final ISubView view;
private final Model model;
/**
* The sub-controller responsible for the sub-view presenting the available aggregated traces.
*
* @author Nils Christian Ehmke
*/
public final class Controller extends AbstractController {
public Controller(final Filter filter, final DataModel dataModel, final PropertiesModel propertiesModel) {
final IModel<AggregatedExecution> modelProxy = createModelProxy(dataModel, filter);
this.model = new Model();
public Controller(final DataModel dataModel, final PropertiesModel propertiesModel) {
super(dataModel, propertiesModel);
this.view = new View(modelProxy, this.model, propertiesModel, this);
}
@Override
protected IModel<AggregatedExecution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
public ISubView getView() {
return this.view;
}
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.item.getData() instanceof AggregatedExecution) {
this.model.setCurrentActiveTrace((AggregatedExecution) e.item.getData());
}
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {}
private final class ModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private static IModel<AggregatedExecution> createModelProxy(final DataModel dataModel, final Filter filter) {
if (filter == Filter.JUST_FAILED_TRACES) {
return new FailedTracesModelProxy(dataModel);
}
if (filter == Filter.JUST_FAILURE_CONTAINING_TRACES) {
return new FailureContainingTracesModelProxy(dataModel);
}
return new TracesModelProxy(dataModel);
}
public enum Filter {
NONE, JUST_FAILED_TRACES, JUST_FAILURE_CONTAINING_TRACES
}
private static final class TracesModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private ModelProxy(final DataModel dataModel) {
private TracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
......@@ -58,4 +67,30 @@ public final class Controller extends AbstractController {
}
private static final class FailedTracesModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private FailedTracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailedAggregatedTracesCopy();
}
}
private static final class FailureContainingTracesModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private FailureContainingTracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailureContainingAggregatedTracesCopy();
}
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.gui.subview.aggregatedtraces;
import java.util.List;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.util.AbstractDataModelProxy;
import kieker.gui.subview.util.IModel;
/**
* The sub-controller responsible for the sub-view presenting the available aggregated traces.
*
* @author Nils Christian Ehmke
*/
public final class FailedController extends AbstractController {
public FailedController(final DataModel dataModel, final PropertiesModel propertiesModel) {
super(dataModel, propertiesModel);
}
@Override
protected IModel<AggregatedExecution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
}
private final class ModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private ModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailedAggregatedTracesCopy();
}
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.gui.subview.aggregatedtraces;
import java.util.List;
import kieker.gui.common.domain.AggregatedExecution;
import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.util.AbstractDataModelProxy;
import kieker.gui.subview.util.IModel;
/**
* The sub-controller responsible for the sub-view presenting the available aggregated traces.
*
* @author Nils Christian Ehmke
*/
public final class FailureController extends AbstractController {
public FailureController(final DataModel dataModel, final PropertiesModel propertiesModel) {
super(dataModel, propertiesModel);
}
@Override
protected IModel<AggregatedExecution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
}
private final class ModelProxy extends AbstractDataModelProxy<AggregatedExecution> {
private ModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailureContainingAggregatedTracesCopy();
}
}
}
package kieker.gui.subview.traces;
import kieker.gui.common.domain.Execution;
import kieker.gui.common.model.DataModel;
import kieker.gui.common.model.PropertiesModel;
import kieker.gui.subview.ISubController;
import kieker.gui.subview.ISubView;
import kieker.gui.subview.util.IModel;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public abstract class AbstractController implements ISubController, SelectionListener {
private final ISubView view;
private final Model model;
public AbstractController(final DataModel dataModel, final PropertiesModel propertiesModel) {
final IModel<Execution> modelProxy = this.createModelProxy(dataModel);
this.model = new Model();
this.view = new View(modelProxy, this.model, propertiesModel, this);
}
@Override
public ISubView getView() {
return this.view;
}
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.item.getData() instanceof Execution) {
this.model.setCurrentActiveTrace((Execution) e.item.getData());
}
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {}
protected abstract IModel<Execution> createModelProxy(final DataModel dataModel);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment