package seedu.taskitty.ui;

import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import seedu.taskitty.commons.core.LogsCenter;
import seedu.taskitty.commons.util.AppUtil;
import seedu.taskitty.commons.util.FxViewUtil;

import java.util.logging.Logger;

/**
 * Controller for a help page
 */
public class HelpWindow extends UiPart {

    private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
    private static final String ICON = "/images/help_icon.png";
    private static final String FXML = "HelpWindow.fxml";
    private static final String TITLE = "Help";
    private static final String HELPIMAGE = "/images/UIhelp.png";
    private AnchorPane mainPane;

    private Stage dialogStage;

    public static HelpWindow load(Stage primaryStage) {
        logger.fine("Showing help page about the application.");
        HelpWindow helpWindow = UiPartLoader.loadUiPart(primaryStage, new HelpWindow());
        helpWindow.configure();
        return helpWindow;
    }

    @Override
    public void setNode(Node node) {
        mainPane = (AnchorPane) node;
    }

    @Override
    public String getFxmlPath() {
        return FXML;
    }

    private void configure(){
        Scene scene = new Scene(mainPane);
        //Null passed as the parent stage to make it non-modal.
        dialogStage = createDialogStage(TITLE, null, scene);
        dialogStage.setMaximized(true); //TODO: set a more appropriate initial size
        setIcon(dialogStage, ICON);
        
        Image helpImage = AppUtil.getImage(HELPIMAGE);
        ImageView helpImageView = new ImageView(helpImage);        
        FxViewUtil.applyAnchorBoundaryParameters(helpImageView, 0.0, 0.0, 0.0, 0.0);
        mainPane.getChildren().add(helpImageView);
    }

    public void show() {
        dialogStage.showAndWait();
    }
}

@@ -21,16 +21,52 @@
 ty.ui;%0A%0A
+import javafx.geometry.Rectangle2D;%0A
 import j
@@ -215,24 +215,52 @@
 AnchorPane;%0A
+import javafx.stage.Screen;%0A
 import javaf
@@ -1568,83 +1568,288 @@
     
-dialogStage.setMaximized(true); //TODO: set a more appropriate initial size
+Screen screen = Screen.getPrimary();%0A        Rectangle2D bounds = screen.getVisualBounds();%0A%0A        dialogStage.setX(bounds.getMinX());%0A        dialogStage.setY(bounds.getMinY());%0A        dialogStage.setWidth(bounds.getWidth());%0A        dialogStage.setHeight(bounds.getHeight());
 %0A   
@@ -2098,16 +2098,171 @@
 , 0.0);%0A
+        helpImageView.fitWidthProperty().bind(dialogStage.widthProperty()); %0A        helpImageView.fitHeightProperty().bind(dialogStage.heightProperty());%0A
         

Fix help window