/*
 *  Keyframe-Based Video Summarization Designer
 *  Copyright (C) 2014 Waltenberger Andreas
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package at.ac.tuwien.ims.ui;

import java.io.File;

import at.ac.tuwien.ims.util.TemplateImporter;
import javafx.scene.control.ScrollPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;

/**
 * Panel that displays the chosen Template
 * @author Andreas Waltenberger
 *
 */
public class LayoutPane extends ScrollPane {

	private int percent;
	private Text layoutText;

	public LayoutPane() {
		layoutText = new Text("Choose a\nTemplate");
		layoutText.setFont(Font.font("Helvetica", FontWeight.BOLD, 40));
		layoutText.setFill(Color.gray(0.35));
		layoutText.translateXProperty().bind(widthProperty().subtract(layoutText.getLayoutBounds().getWidth()).divide(2));
		layoutText.translateYProperty().bind(heightProperty().subtract(layoutText.getLayoutBounds().getHeight()).divide(2));
		setContent(layoutText);
	}

	public void setContent(File file) {
		setContent(TemplateImporter.createLayout(file));
		getContent().setTranslateX(0);
		getContent().setTranslateY(0);
		percent = 100;
	}

	public int getPercent() {
		return percent;
	}

	public void incPercent() {
		percent += 10;
	}

	public void decPercent() {
		percent -= 10;
	}
}
