package com.ht.ui.svg;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Circle;

public abstract class MoveScaleButton extends BorderPane {
	public MoveScaleButton() {
		super();
		
		getStyleClass().add("shadow");
		
		Button right = new Button();
		setRight(right);
		BorderPane.setAlignment(right, Pos.CENTER_LEFT);
		right.getStyleClass().add("image-button");
		right.setGraphic(new ImageView(getClass().getResource("images/arrow_right.png").toExternalForm()));
		right.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				moveRight();
			}
		});
		
		Button left = new Button();
		setLeft(left);
		BorderPane.setAlignment(left, Pos.CENTER_RIGHT);
		left.getStyleClass().add("image-button");
		ImageView arrowRight = new ImageView(getClass().getResource("images/arrow_right.png").toExternalForm());
		arrowRight.setRotate(180);
		left.setGraphic(arrowRight);
		left.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				moveLeft();
			}
		});
		
		Button top = new Button();
		setTop(top);
		BorderPane.setAlignment(top, Pos.BOTTOM_CENTER);
		top.getStyleClass().add("image-button");
		ImageView arrowTop = new ImageView(getClass().getResource("images/arrow_right.png").toExternalForm());
		arrowTop.setRotate(-90);
		top.setGraphic(arrowTop);
		top.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				moveTop();
			}
		});
		
		Button bottom = new Button();
		setBottom(bottom);
		BorderPane.setAlignment(bottom, Pos.TOP_CENTER);
		bottom.getStyleClass().add("image-button");
		ImageView arrowBottom = new ImageView(getClass().getResource("images/arrow_right.png").toExternalForm());
		arrowBottom.setRotate(90);
		bottom.setGraphic(arrowBottom);
		bottom.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				moveBottom();
			}
		});
		
		Button center = new Button();
		ImageView resetImage = new ImageView(getClass().getResource("images/fullview.png").toExternalForm());
		resetImage.setRotate(45);
		center.setGraphic(resetImage);
		center.getStyleClass().add("image-button");
		center.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				moveReset();
			}
		});
		setCenter(center);
	}
	
	abstract void moveReset();
	abstract void moveRight();
	abstract void moveLeft();
	abstract void moveTop();
	abstract void moveBottom();
}
