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
......@@ -21,28 +21,63 @@ import java.util.List;
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.AbstractDataModelProxy;
import kieker.gui.subview.util.IModel;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
/**
* The sub-controller responsible for the sub-view presenting the available traces.
*
* @author Nils Christian Ehmke
*/
public final class Controller extends AbstractController {
public final class Controller implements ISubController, SelectionListener {
private final ISubView view;
private final Model model;
public Controller(final Type filter, final DataModel dataModel, final PropertiesModel propertiesModel) {
final IModel<Execution> modelProxy = createModelProxy(dataModel, filter);
this.model = new Model();
this.view = new View(modelProxy, this.model, propertiesModel, this);
}
public Controller(final DataModel dataModel, final PropertiesModel propertiesModel) {
super(dataModel, propertiesModel);
@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
protected IModel<Execution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
public void widgetDefaultSelected(final SelectionEvent e) {}
private static IModel<Execution> createModelProxy(final DataModel dataModel, final Type filter) {
if (filter == Type.JUST_FAILED_TRACES) {
return new FailedTracesModelProxy(dataModel);
}
if (filter == Type.JUST_FAILURE_CONTAINING_TRACES) {
return new FailureContainingTracesModelProxy(dataModel);
}
return new TracesModelProxy(dataModel);
}
private final class ModelProxy extends AbstractDataModelProxy<Execution> {
public enum Type {
NONE, JUST_FAILED_TRACES, JUST_FAILURE_CONTAINING_TRACES
}
private ModelProxy(final DataModel dataModel) {
private static final class TracesModelProxy extends AbstractDataModelProxy<Execution> {
private TracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
......@@ -53,4 +88,30 @@ public final class Controller extends AbstractController {
}
private static final class FailedTracesModelProxy extends AbstractDataModelProxy<Execution> {
private FailedTracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<Execution> getContent() {
return super.dataModel.getFailedTracesCopy();
}
}
private static final class FailureContainingTracesModelProxy extends AbstractDataModelProxy<Execution> {
private FailureContainingTracesModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<Execution> getContent() {
return super.dataModel.getFailureContainingTracesCopy();
}
}
}
/***************************************************************************
* 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.traces;
import java.util.List;
import kieker.gui.common.domain.Execution;
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 failed 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<Execution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
}
private final class ModelProxy extends AbstractDataModelProxy<Execution> {
private ModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<Execution> getContent() {
return super.dataModel.getFailedTracesCopy();
}
}
}
/***************************************************************************
* 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.traces;
import java.util.List;
import kieker.gui.common.domain.Execution;
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 failure-containing 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<Execution> createModelProxy(final DataModel dataModel) {
return new ModelProxy(dataModel);
}
private final class ModelProxy extends AbstractDataModelProxy<Execution> {
private ModelProxy(final DataModel dataModel) {
super(dataModel);
}
@Override
public List<Execution> getContent() {
return super.dataModel.getFailureContainingTracesCopy();
}
}
}
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
......@@ -9,7 +9,7 @@ import java.util.List;
import kieker.common.record.flow.trace.operation.BeforeOperationEvent;
import kieker.gui.common.domain.Record;
import kieker.gui.common.importer.stages.RecordSimplificator;
import kieker.gui.common.model.importer.stages.RecordSimplificator;
import org.junit.Before;
import org.junit.Test;
......
package kieker.gui.common.importer.stages;
package kieker.gui.common.model.importer.stages;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
......@@ -13,7 +13,7 @@ import kieker.common.record.flow.trace.operation.AfterOperationEvent;
import kieker.common.record.flow.trace.operation.AfterOperationFailedEvent;
import kieker.common.record.flow.trace.operation.BeforeOperationEvent;
import kieker.gui.common.domain.Execution;
import kieker.gui.common.importer.stages.TraceReconstructor;
import kieker.gui.common.model.importer.stages.TraceReconstructor;
import org.junit.Before;
import org.junit.Test;
......
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