package nz.ac.auckland.view;

import org.apache.log4j.Logger;

import java.io.File;
import java.io.IOException;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.stage.FileChooser;

public class RootLayoutController extends VIDEVOXController {
	/**
	* Logger for this class
	*/
	private static final Logger logger = Logger.getLogger(RootLayoutController.class);

	public static final String PREVIEW = "preview";

	public static final String EDITOR = "editor";

	@FXML
	private Button _previewButton;

	@FXML
	private Button _editorButton;

	@FXML
	private void selectVideo() {
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Please select a video file to work on");
		// Set visible extensions
		FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("Video Files ", "*.mp4");
		fileChooser.getExtensionFilters().add(extFilter);
		File file = fileChooser.showOpenDialog(_application.getStage());
		logger.debug("Video name: " + file.getName());
		// set the video
	}

	@FXML
	private void close() {
		_application.saveAndClose();
	}

	@FXML
	private void editorButtonAction() {
		setViewToggle(EDITOR);
	}

	@FXML
	private void previewButtonAction() {
		setViewToggle(PREVIEW);
	}

	public void setViewToggle(String option) {
		switch (option) {
		case PREVIEW:
			_editorButton.setDisable(false);
			_previewButton.setDisable(true);
			break;
		case EDITOR:
			_previewButton.setDisable(false);
			_editorButton.setDisable(true);
			break;
		default:
		}
	}
}

@@ -929,16 +929,25 @@
 %0A%09%09File 
+file;%0D%0A%09%09
 file = f
@@ -999,16 +999,93 @@
 ge());%0D%0A
+%09%09if (file == null) %7B%0D%0A%09%09%09// User canceled selecting video%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A
 %09%09logger

Handle canceling of set video