package seedu.address.ui;

import java.awt.event.KeyEvent;

import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.web.WebView;
import javafx.stage.Modality;
import javafx.stage.Stage;
import seedu.address.commons.util.FxViewUtil;

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

    private static final String ICON = "/images/help_icon.png";
    private static final String FXML = "/view/HelpWindow.fxml";
    private static final String USERGUIDE_URL =
            "https://github.com/se-edu/addressbook-level4/blob/master/docs/UserGuide.md";

    @FXML
    private WebView webView;

    public HelpWindow() {
        super(FXML);
        getRoot().initModality(Modality.WINDOW_MODAL);
        FxViewUtil.setStageIcon(getRoot(), ICON);
        webView.getEngine().load(USERGUIDE_URL);

        Alert helpBox = new Alert(javafx.scene.control.Alert.AlertType.INFORMATION);
        helpBox.setTitle("Information Dialog");
        helpBox.setHeaderText(null);
        helpBox.setContentText("I have a great message for you!");
        helpBox.showAndWait();
    }
}

@@ -35,29 +35,30 @@
 java
-.awt
+fx
 .event.
-Key
 Event
+Handler
 ;
-%0A
 %0Aimp
@@ -114,16 +114,120 @@
 .Alert;%0A
+import javafx.scene.image.Image;%0Aimport javafx.scene.input.KeyCode;%0Aimport javafx.scene.input.KeyEvent;%0A
 import j
@@ -304,24 +304,25 @@
 tage.Stage;%0A
+%0A
 import seedu
@@ -1027,12 +1027,13 @@
 ype.
-INFO
+CONFI
 RMAT
@@ -1038,23 +1038,65 @@
 ATION);%0A
+%0A
        
+ //add icon%0A        Stage stage = (Stage)
  helpBox
@@ -1100,143 +1100,584 @@
 Box.
-setTitle(%22Information Dialog%22);%0A        helpBox.setHeaderText(null);%0A        helpBox.setContentText(%22I have a great message for you!%22);
+getDialogPane().getScene().getWindow();%0A        stage.getIcons().add(new Image(ICON));%0A        helpBox.setTitle(%22HELP%22);%0A        helpBox.setHeaderText(null);%0A        helpBox.setContentText(%22%22);%0A        %0A        //press escape to close%0A        stage.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler%3CKeyEvent%3E() %7B%0A            @Override%0A            public void handle(KeyEvent keyEvent) %7B%0A                if (keyEvent.getCode().equals(KeyCode.ESCAPE)) %7B%0A                    stage.close();%0A                    keyEvent.consume();%0A                %7D%0A            %7D%0A        %7D);%0A
 %0A   

make help box close when esc key pressed