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




                                               
                                 
                                                                   
 

                                                              
                                                                                      
 
                                                        

                                 
                                                 













                                                                                       

                                                                                                                            
                                               
                                                        




                         
package org.openslx.dozmod.gui.window;

import org.apache.log4j.Logger;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.window.layout.DisclaimerWindowLayout;

public class DisclaimerWindow extends DisclaimerWindowLayout {

	private final static Logger LOGGER = Logger.getLogger(DisclaimerWindow.class);

	public DisclaimerWindow(final Shell mainShell) {
		super(mainShell);

		final DisclaimerWindow me = this;
		// function for agreement checkbox
		agreeBox.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				continueButton.setEnabled(!continueButton.isEnabled());
			}
		});

		// function for continue button
		continueButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				// save the agreement to config
				if (!Config.setDisclaimerAgreement(true))
					LOGGER.error("Could not set the agreement to the disclaimer in '" + Config.getPath()
							+ "'!");
				Config.store();
				me.getShell().dispose();
			}
		});
	}

}