summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
blob: 2362f09205a98bf5803cc0eb3359fb024daab622 (plain) (blame)
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
package org.openslx.dozmod.gui.window;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.window.layout.MainMenuWindowLayout;
import org.openslx.dozmod.thrift.Session;

public class MainMenuWindow extends MainMenuWindowLayout {

	/**
	 * Version for serialization.
	 */
	private static final long serialVersionUID = 1386462978086690536L;

	public MainMenuWindow() {
		super();
		// function for vmButton
		btnShowVirtualMachines.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				MainWindow.showPage(ImageListWindow.class);
			}
		});

		// function for lecturesButton
		btnShowLectures.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				MainWindow.showPage(LectureListWindow.class);
			}
		});
		
	}

	@Override
	public boolean requestHide() {
		return true;
	}

	@Override
	public void requestShow() {
		// here we need to check if the user is a student
		// if so directly forward to lecturelist.
		if(!Session.canListImages()) {
			MainWindow.showPage(LectureListWindow.class);	
		}

		btnShowVirtualMachines.setEnabled(Session.canListImages());
	}
}