package seedu.taskell.ui;

import javafx.scene.Node;
import javafx.scene.control.TextArea;
import javafx.scene.layout.AnchorPane;
import seedu.taskell.commons.core.LogsCenter;
import seedu.taskell.commons.util.FxViewUtil;

import java.util.ArrayList;
import java.util.logging.Logger;

/**
 * The Display Panel of the App.
 */
public class DisplayPanel extends UiPart{

    private static Logger logger = LogsCenter.getLogger(DisplayPanel.class);
    
    public static final String RESULT_DISPLAY_ID = "resultDisplay";
    private static final String STATUS_BAR_STYLE_SHEET = "result-display";
    
    private TextArea display;

    /**
     * Constructor is kept private as {@link #load(AnchorPane)} is the only way to create a DisplayPanel.
     */
    private DisplayPanel() {

    }

    @Override
    public void setNode(Node node) {
        //not applicable
    }

    @Override
    public String getFxmlPath() {
        return null; //not applicable
    }
    
    /** @@author A0142130A **/

    /**
     * Factory method for creating a Display Panel.
     * This method should be called after the FX runtime is initialized and in FX application thread.
     * @param placeholder The AnchorPane where the DisplayPanel must be inserted
     */
    public static DisplayPanel load(AnchorPane placeholder){
        logger.info("Initializing display panel");
        DisplayPanel displayPanel = new DisplayPanel();
        displayPanel.display = new TextArea();
        displayPanel.display.setEditable(false);
        displayPanel.display.setId(RESULT_DISPLAY_ID);
        displayPanel.display.getStyleClass().removeAll();
        displayPanel.display.getStyleClass().add(STATUS_BAR_STYLE_SHEET);
        
        FxViewUtil.applyAnchorBoundaryParameters(displayPanel.display, 0.0, 0.0, 0.0, 0.0);
        placeholder.getChildren().add(displayPanel.display);
        
        displayPanel.display.setText("Welcome to Taskell!\n"
                + "Enter 'add' in command box to add a task.\n"
                + "Enter 'list-undo' for list of commands to undo.\n"
                + "Enter 'help' in for more information about commands.\n");
       
        return displayPanel;
    }
    
    public void loadList(ArrayList<String> list) {
        display.setText("");
        if (list.isEmpty()) {
            display.setText("No commands available for undo.");
        }
        else {
            for (int i=0; i<list.size(); i++) {
                display.appendText(i+1 + ". " + list.get(i) + "\n");
            }
        }
    }
    
    /** @@author **/

}

@@ -1,8 +1,35 @@
+/** @@author A0142130A **/%0A
 package 
@@ -980,36 +980,32 @@
 cable%0A    %7D%0A
-    
 %0A    /**
  @@author A0
@@ -996,92 +996,8 @@
  /**
- @@author A0142130A **/%0A%0A    /**%0A     * Factory method for creating a Display Panel.
 %0A   
@@ -2032,19 +2032,16 @@
 r 'help'
- in
  for mor
@@ -2470,24 +2470,77 @@
 %0A    %7D%0A    %0A
+    public void loadCalendar() %7B%0A        %0A    %7D%0A    %0A
     /** @@au

edit DisplayPanel