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