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

                                           

                      
                               
                                            
                                                                               
                                                   
                                         

                           
                                                                                      
 
                                                                                                  

                                                
 
                                                                                      


                                      





                                              
 
                                       

                                                                                          
                                                                                                                  
                                                                            
                                                                                 




                                                                  

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

import java.util.List;

import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureLocationSelectionPageLayout;
import org.openslx.dozmod.state.LectureWizardState;
import org.openslx.dozmod.thrift.Session;

@SuppressWarnings("serial")
public class LectureLocationSelectionPage extends LectureLocationSelectionPageLayout {

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

	private LectureWizardState state = null;

	public LectureLocationSelectionPage(Wizard wizard, LectureWizardState state) {
		super(wizard);
		setPageComplete(true);
		this.state = state;
	}

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

	private boolean updateState() {
		List<Integer> locations = ctlLocationSelector.getSelectedLocationsAsIds();
		boolean locationExclusive = ctlLocationSelector.getOnlyInSelection();
		if (locations != null && locations.size() > Session.getSatelliteConfig().maxLocationsPerLecture) {
			setErrorMessage("Zu viele Räume/Orte ausgewählt");
			ctlLocationSelector.setSelectedLocationsAsIds(locations);
			return false;
		}
		state.locations = locations;
		state.onlyInSelectedLocations = locationExclusive;
		setErrorMessage(null);
		return true;
	}

}