summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java
blob: a9d5bcef43fec6b8b67496693fb3861a38362fe0 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                           
                      
 
                                             


                                                                     
                                         



                                                                  
                                                
                                              
                                                         



                                   
                                                                                  

                                   

                                                            
 
                                      
                                                                


                                                             
                 










                                              



                                                                       
                                                              

                                                       
 
                                                                                                     


                            
package org.openslx.dozmod.gui.wizard.page;

import java.util.List;

import org.openslx.bwlp.thrift.iface.NetRule;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureOptionsPageLayout;
import org.openslx.dozmod.state.LectureWizardState;
import org.openslx.dozmod.thrift.Session;

@SuppressWarnings("serial")
public class LectureOptionsPage extends LectureOptionsPageLayout {

	private LectureWizardState state = null;
	private List<NetRule> currentNetrules;
	private String currentRunscript = new String("");

	/**
	 * Page for lecture options
	 */
	public LectureOptionsPage(final Wizard wizard, LectureWizardState state) {
		super(wizard);
		this.state = state;
		this.currentNetrules = state.netRules;
		this.currentRunscript = state.runScriptText;

		setPageComplete(true);
		if (!Session.isLectureRestrictionsSupported()) {
			chkIsExam.setEnabled(false);
			chkInternetEnabled.setEnabled(false);
			chkUsbEnabled.setEnabled(false);
		}
	}

	@Override
	protected boolean wantNextOrFinish() {
		return updateState();
	}

	/**
	 * Set the selected options in state
	 */
	private boolean updateState() {
		state.isExam = chkIsExam.isSelected();
		state.autoUpdate = chkAutoUpdate.isSelected();
		state.internetAccess = chkInternetEnabled.isSelected();
		state.isEnabled = chkIsActive.isSelected();
		state.usbAllowed = chkUsbEnabled.isSelected();
		state.netRules = currentNetrules;
		state.runScriptText = currentRunscript;

		setDescription("Klicken Sie auf 'Weiter' für Berechtigungen oder 'Fertigstellen'.");
		return true;
	}
}