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

Added waiting cursor during import

parent c20dfd8e
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,10 @@ import kieker.gui.subview.ISubView;
import kieker.gui.subview.aggregatedtraces.Controller.Filter;
import kieker.gui.subview.traces.Controller.Type;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Display;
/**
* The main controller of this application. It is responsible for creating top level models, further sub-controllers, and for creating and controlling the
......@@ -68,7 +70,7 @@ public final class Controller implements SelectionListener {
// Create the main model and the main view
this.mainViewModel = new Model();
this.mainView = new View(this.dataModel, this.mainViewModel, this, subViews);
this.mainView = new View(this.mainViewModel, this, subViews);
}
public void showView() {
......@@ -102,7 +104,9 @@ public final class Controller implements SelectionListener {
final String selectedDirectory = this.mainView.getDialog().open();
if (null != selectedDirectory) {
this.mainViewModel.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
this.dataModel.loadMonitoringLogFromFS(selectedDirectory);
this.mainViewModel.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_ARROW));
}
}
......
......@@ -18,6 +18,8 @@ package kieker.gui.mainview;
import java.util.Observable;
import org.eclipse.swt.graphics.Cursor;
/**
* The model of the main view.
*
......@@ -25,8 +27,20 @@ import java.util.Observable;
*/
public final class Model extends Observable {
private Cursor cursor;
private String currentActiveSubViewKey;
public Cursor getCursor() {
return this.cursor;
}
public void setCursor(final Cursor cursor) {
this.cursor = cursor;
this.setChanged();
this.notifyObservers();
}
public String getCurrentActiveSubViewKey() {
return this.currentActiveSubViewKey;
}
......
......@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import kieker.gui.common.model.DataModel;
import kieker.gui.subview.ISubView;
import org.eclipse.swt.SWT;
......@@ -45,8 +44,7 @@ import org.eclipse.swt.widgets.Widget;
*/
public final class View implements Observer {
private final DataModel dataModel;
private final Model mainViewModel;
private final Model model;
private final Controller controller;
private final Map<String, ISubView> subViews;
......@@ -75,9 +73,8 @@ public final class View implements Observer {
private TreeItem trtmJustAggTracesContaining;
private MenuItem mntmAbout;
public View(final DataModel dataModel, final Model mainViewModel, final Controller controller, final Map<String, ISubView> subViews) {
this.dataModel = dataModel;
this.mainViewModel = mainViewModel;
public View(final Model mainViewModel, final Controller controller, final Map<String, ISubView> subViews) {
this.model = mainViewModel;
this.subViews = subViews;
this.controller = controller;
......@@ -276,8 +273,7 @@ public final class View implements Observer {
}
private void addLogic() {
this.dataModel.addObserver(this);
this.mainViewModel.addObserver(this);
this.model.addObserver(this);
this.tree.addSelectionListener(this.controller);
......@@ -293,16 +289,14 @@ public final class View implements Observer {
@Override
public void update(final Observable observable, final Object obj) {
if (observable == this.dataModel) {
}
if (observable == this.mainViewModel) {
if (observable == this.model) {
this.handleChangedSubView();
this.handleChangedCursor();
}
}
private void handleChangedSubView() {
final String subViewKey = this.mainViewModel.getCurrentActiveSubViewKey();
final String subViewKey = this.model.getCurrentActiveSubViewKey();
final ISubView subViewToShow = this.subViews.get(subViewKey);
final Composite compositeToShow = (subViewToShow != null) ? subViewToShow.getComposite() : null;
......@@ -311,4 +305,8 @@ public final class View implements Observer {
this.subViewComposite.layout();
}
private void handleChangedCursor() {
this.shell.setCursor(this.model.getCursor());
}
}
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