summaryrefslogtreecommitdiff
path: root/src/YalpClients/SwtClient/GUI/InitGUI.java
blob: e432c50f3ffd38636039ec0da760274ff639b159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (c) 2006 Manuel Traut and Volker Dahnke
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors: Manuel Traut and Volker Dahnke
 */

package YalpClients.SwtClient.GUI;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import YalpClients.SwtClient.*;
import YalpInterfaces.AccessRights;

/*
 * Class InitGUI
 *
 * <em></em>
 *
 * @author Volker Dahnke / Manuel Traut
 *
 * @version 1 02-04-2006<br>
 *
 */

public class InitGUI {
	private Model model;
	private Display display;
	private int time = 1000;

	public InitGUI(Model model,AccessRights kind){
		this.model=model;
		this.display = Display.getDefault();
		final Runnable timer = new Runnable() {
			public void run() {
				serverStillAlive(this);
			}
		};
		display.timerExec(time, timer);

		GUI gui= new GUI(
			new Shell(display ,SWT.MIN), display, model, kind, SWT.NULL );
		gui.show();
	}

	public void serverStillAlive(Runnable timer){
		model.serverStillAlive();
		if (!this.model.getLogoff()){
			this.display.timerExec(time, timer);
		}
	}

}