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.scene.web.WebView;
import javafx.stage.Stage;
import seedu.taskitty.commons.core.LogsCenter;
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 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 = new Image("/images/UIhelp.png");
        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();
    }
}

@@ -187,41 +187,8 @@
 ne;%0A
-import javafx.scene.web.WebView;%0A
 impo
@@ -670,16 +670,81 @@
 %22Help%22;%0A
+    private static final String HELPIMAGE = %22/images/UIhelp.png%22;
 %0A    pri
@@ -1613,36 +1613,25 @@
 w Image(
-%22/images/UIhelp.png%22
+HELPIMAGE
 );%0A     

Remove redundant imports and extract out filepath as a String variable