summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
blob: 2362f09205a98bf5803cc0eb3359fb024daab622 (plain) (tree)
1
2
3
4
5
6
7
8

                                      

                                     
 
                                         
                                                                 
                                         


                                                          




                                                                          

                                 
                                        
                                                                               
                                 
                                                                    
                                                                           



                                              
                                                                        
                                 
                                                                    

                                                                             
                   
                

         
                 
                                      



                            
                                   





                                                                        
                                                                           
         
 
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());
	}
}