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

Removed some logic from the views

parent 88a744e7
No related branches found
No related tags found
No related merge requests found
Showing
with 116 additions and 43 deletions
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.AggregatedTracesSubViewModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
......@@ -38,7 +41,14 @@ public final class AggregatedFailedTracesSubViewController implements SelectionL
public AggregatedFailedTracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new AggregatedTracesSubViewModel();
this.view = new AggregatedTracesSubView(AggregatedTracesSubView.Type.SHOW_JUST_FAILED_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new AggregatedTracesSubView(new AbstractProxyDataModel<AggregatedExecution>(dataModel) {
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailedAggregatedTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.AggregatedTracesSubViewModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
......@@ -38,7 +41,13 @@ public final class AggregatedTracesSubViewController implements SelectionListene
public AggregatedTracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new AggregatedTracesSubViewModel();
this.view = new AggregatedTracesSubView(AggregatedTracesSubView.Type.SHOW_ALL_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new AggregatedTracesSubView(new AbstractProxyDataModel<AggregatedExecution>(dataModel) {
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getAggregatedTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
import kieker.gui.model.TracesSubViewModel;
......@@ -38,7 +41,14 @@ public final class FailedTracesSubViewController implements SelectionListener, I
public FailedTracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new TracesSubViewModel();
this.view = new TracesSubView(TracesSubView.Type.SHOW_JUST_FAILED_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new TracesSubView(new AbstractProxyDataModel<Execution>(dataModel) {
@Override
public final List<Execution> getContent() {
return this.dataModel.getFailedTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.AggregatedTracesSubViewModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
......@@ -38,7 +41,13 @@ public final class FailureContainingAggregatedTracesSubViewController implements
public FailureContainingAggregatedTracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new AggregatedTracesSubViewModel();
this.view = new AggregatedTracesSubView(AggregatedTracesSubView.Type.SHOW_JUST_FAILURE_CONTAINING_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new AggregatedTracesSubView(new AbstractProxyDataModel<AggregatedExecution>(dataModel) {
@Override
public List<AggregatedExecution> getContent() {
return super.dataModel.getFailureContainingAggregatedTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
import kieker.gui.model.TracesSubViewModel;
......@@ -38,7 +41,14 @@ public final class FailureContainingTracesSubViewController implements Selection
public FailureContainingTracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new TracesSubViewModel();
this.view = new TracesSubView(TracesSubView.Type.SHOW_JUST_FAILURE_CONTAINING_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new TracesSubView(new AbstractProxyDataModel<Execution>(dataModel) {
@Override
public final List<Execution> getContent() {
return this.dataModel.getFailureContainingTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
......@@ -16,6 +16,9 @@
package kieker.gui.controller;
import java.util.List;
import kieker.gui.model.AbstractProxyDataModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.PropertiesModel;
import kieker.gui.model.TracesSubViewModel;
......@@ -38,7 +41,14 @@ public final class TracesSubViewController implements SelectionListener, ISubCon
public TracesSubViewController(final DataModel dataModel, final PropertiesModel propertiesModel) {
this.model = new TracesSubViewModel();
this.view = new TracesSubView(TracesSubView.Type.SHOW_ALL_TRACES, dataModel, this.model, propertiesModel, this);
this.view = new TracesSubView(new AbstractProxyDataModel<Execution>(dataModel) {
@Override
public final List<Execution> getContent() {
return this.dataModel.getTracesCopy();
}
}, this.model, propertiesModel, this);
}
@Override
......
package kieker.gui.model;
import java.util.Observable;
import java.util.Observer;
public abstract class AbstractProxyDataModel<T> extends Observable implements IModel<T>, Observer {
protected final DataModel dataModel;
public AbstractProxyDataModel(final DataModel dataModel) {
this.dataModel = dataModel;
this.dataModel.addObserver(this);
}
@Override
public final void update(final Observable o, final Object arg) {
this.setChanged();
this.notifyObservers(arg);
}
@Override
public final String getShortTimeUnit() {
return this.dataModel.getShortTimeUnit();
}
}
package kieker.gui.model;
import java.util.List;
import java.util.Observer;
public interface IModel<T> {
public List<T> getContent();
public String getShortTimeUnit();
public void addObserver(Observer observer);
}
......@@ -21,7 +21,7 @@ import java.util.Observable;
import java.util.Observer;
import kieker.gui.model.AggregatedTracesSubViewModel;
import kieker.gui.model.DataModel;
import kieker.gui.model.IModel;
import kieker.gui.model.PropertiesModel;
import kieker.gui.model.domain.AggregatedExecution;
import kieker.gui.view.util.AggregatedExecutionAvgDurationComparator;
......@@ -54,7 +54,7 @@ public class AggregatedTracesSubView implements Observer, ISubView {
private final AggregatedTracesSubViewModel aggregatedTracesSubViewModel;
private final SelectionListener controller;
private final DataModel model;
private final IModel<AggregatedExecution> model;
private Composite composite;
private Tree tree;
private Composite detailComposite;
......@@ -71,15 +71,13 @@ public class AggregatedTracesSubView implements Observer, ISubView {
private Label lblFailed;
private final PropertiesModel propertiesModel;
private Label lblTotalDurationDisplay;
private final Type type;
public AggregatedTracesSubView(final Type type, final DataModel model, final AggregatedTracesSubViewModel aggregatedTracesSubViewModel, final PropertiesModel propertiesModel,
public AggregatedTracesSubView(final IModel<AggregatedExecution> model, final AggregatedTracesSubViewModel aggregatedTracesSubViewModel, final PropertiesModel propertiesModel,
final SelectionListener controller) {
this.controller = controller;
this.model = model;
this.propertiesModel = propertiesModel;
this.aggregatedTracesSubViewModel = aggregatedTracesSubViewModel;
this.type = type;
model.addObserver(this);
aggregatedTracesSubViewModel.addObserver(this);
......@@ -260,14 +258,8 @@ public class AggregatedTracesSubView implements Observer, ISubView {
}
private void updateTree() {
final List<AggregatedExecution> records;
if (this.type == Type.SHOW_JUST_FAILED_TRACES) {
records = this.model.getFailedAggregatedTracesCopy();
} else if (this.type == Type.SHOW_JUST_FAILURE_CONTAINING_TRACES) {
records = this.model.getFailureContainingAggregatedTracesCopy();
} else {
records = this.model.getAggregatedTracesCopy();
}
final List<AggregatedExecution> records = this.model.getContent();
this.tree.setData(records);
this.tree.setItemCount(records.size());
......@@ -356,7 +348,7 @@ public class AggregatedTracesSubView implements Observer, ISubView {
item.setText(new String[] { executionEntry.getContainer(), componentName, operationString, "", minDuration, avgDuration, maxDuration, totalDuration });
} else {
item.setText(new String[] { executionEntry.getContainer(), componentName, operationString, Integer.toString(executionEntry.getCalls()), minDuration, avgDuration,
maxDuration, totalDuration });
maxDuration, totalDuration });
}
if (executionEntry.isFailed()) {
......@@ -370,8 +362,4 @@ public class AggregatedTracesSubView implements Observer, ISubView {
}
public enum Type {
SHOW_ALL_TRACES, SHOW_JUST_FAILED_TRACES, SHOW_JUST_FAILURE_CONTAINING_TRACES
}
}
......@@ -94,6 +94,8 @@ public class MainView implements Observer {
this.shell.open();
this.shell.layout();
this.dataModel.loadMonitoringLogFromFS("example/kieker-20141217-134719867-UTC-SE-Nils-Ehmke-KIEKER");
while (!this.shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
......
......@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Observable;
import java.util.Observer;
import kieker.gui.model.DataModel;
import kieker.gui.model.IModel;
import kieker.gui.model.PropertiesModel;
import kieker.gui.model.TracesSubViewModel;
import kieker.gui.model.domain.Execution;
......@@ -49,7 +49,7 @@ import org.eclipse.wb.swt.SWTResourceManager;
public class TracesSubView implements Observer, ISubView {
private final DataModel model;
private final IModel<Execution> model;
private final TracesSubViewModel tracesSubViewModel;
private final SelectionListener controller;
private Composite composite;
......@@ -65,10 +65,8 @@ public class TracesSubView implements Observer, ISubView {
private Label lblExecutionContainerDisplay;
private Label lblFailed;
private final PropertiesModel propertiesModel;
private final Type type;
public TracesSubView(final Type type, final DataModel model, final TracesSubViewModel tracesSubViewModel, final PropertiesModel propertiesModel,
final SelectionListener controller) {
public TracesSubView(final IModel<Execution> model, final TracesSubViewModel tracesSubViewModel, final PropertiesModel propertiesModel, final SelectionListener controller) {
this.model = model;
this.propertiesModel = propertiesModel;
this.tracesSubViewModel = tracesSubViewModel;
......@@ -77,8 +75,6 @@ public class TracesSubView implements Observer, ISubView {
model.addObserver(this);
tracesSubViewModel.addObserver(this);
propertiesModel.addObserver(this);
this.type = type;
}
/**
......@@ -226,14 +222,7 @@ public class TracesSubView implements Observer, ISubView {
}
private void updateTree() {
final List<Execution> records;
if (this.type == Type.SHOW_JUST_FAILED_TRACES) {
records = this.model.getFailedTracesCopy();
} else if (this.type == Type.SHOW_JUST_FAILURE_CONTAINING_TRACES) {
records = this.model.getFailureContainingTracesCopy();
} else {
records = this.model.getTracesCopy();
}
final List<Execution> records = this.model.getContent();
this.tree.setData(records);
this.tree.setItemCount(records.size());
......@@ -324,8 +313,4 @@ public class TracesSubView implements Observer, ISubView {
}
}
public enum Type {
SHOW_ALL_TRACES, SHOW_JUST_FAILED_TRACES, SHOW_JUST_FAILURE_CONTAINING_TRACES
}
}
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