package seedu.task.ui;

import javafx.fxml.FXML;
import javafx.scene.web.WebView;
import seedu.task.commons.util.FxViewUtil;

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

    private static final String ICON = "/images/help_icon.png";
    private static final String FXML = "HelpWindow.fxml";
    private static final String TITLE = "Help";
    //@@author A0163848R
    private static final String HELP_HTML =
            "http://CS2103JAN2017-F11-B3.github.io/main/util/offdoc.html"
            + "?mdfile=https://raw.githubusercontent.com/"
            + "CS2103JAN2017-F11-B3/main/master/docs/UserGuide.md";
    //@@author

    @FXML
    private WebView browser;

    public HelpWindow() {
        super(FXML);

        setTitle(TITLE);
        stage.setMaximized(true); //TODO: set a more appropriate initial size
        FxViewUtil.setStageIcon(stage, ICON);

        browser.getEngine().load(HELP_HTML);

        FxViewUtil.applyAnchorBoundaryParameters(browser, 0.0, 0.0, 0.0, 0.0);
    }

}

@@ -35,17 +35,122 @@
 afx.
-fxml.FXML
+event.EventHandler;%0Aimport javafx.fxml.FXML;%0Aimport javafx.scene.input.KeyCode;%0Aimport javafx.scene.input.KeyEvent
 ;%0Aim
@@ -474,16 +474,80 @@
 %22Help%22;%0A
+    private static final String NOTICE = %22press ENTER to exit%22;%0A
     //@@
@@ -934,16 +934,33 @@
 le(TITLE
+ + %22 - %22 + NOTICE
 );%0A     
@@ -1207,14 +1207,482 @@
 .0);
+%0A%0A        setAccelerators();%0A    %7D%0A%0A    private void setAccelerators() %7B%0A        browser.setOnKeyPressed(new EventHandler%3CKeyEvent%3E() %7B%0A%0A            @Override%0A            public void handle(final KeyEvent keyEvent) %7B%0A                if (keyEvent.getCode() == KeyCode.ENTER) %7B%0A                    handleExit();%0A                    keyEvent.consume();%0A                %7D%0A            %7D%0A        %7D);%0A    %7D%0A%0A    @FXML%0A    public void handleExit() %7B%0A        getStage().close();
 %0A    %7D%0A
-%0A
 %7D%0A

exit help window through ENTER