package tars.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import tars.model.task.ReadOnlyTask;

public class TaskCard extends UiPart{

    private static final String FXML = "TaskListCard.fxml";

    private static final String NO_START_DATE = "None";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;
    @FXML
    private Label priority;
    @FXML
    private Label status;
    @FXML
    private Label tags;

    private ReadOnlyTask task;
    private int displayedIndex;

    public TaskCard(){

    }

    public static TaskCard load(ReadOnlyTask task, int displayedIndex){
        TaskCard card = new TaskCard();
        card.task = task;
        card.displayedIndex = displayedIndex;
        return UiPartLoader.loadUiPart(card);
    }

    @FXML
    public void initialize() {
        name.setText(task.getName().taskName);
        priority.setText(task.priorityString());
        id.setText(displayedIndex + ". ");
        if (task.getDateTime().startDateString != null) {
            startDate.setText(task.getDateTime().startDateString);
        } else {
            startDate.setVisible(false);
            startDate.setManaged(false);
        }
        endDate.setText(task.getDateTime().endDateString);
        status.setText(task.getStatus().toString());
        tags.setText(task.tagsString());
    }

    public HBox getLayout() {
        return cardPane;
    }

    @Override
    public void setNode(Node node) {
        cardPane = (HBox)node;
    }

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

@@ -267,17 +267,16 @@
 .fxml%22;%0A
-%0A
     priv
@@ -303,29 +303,143 @@
 ing 
-NO_START_DATE = %22None
+PRIORITY_HIGH = %22high%22;%0A    private static final String PRIORITY_MEDIUM = %22MEDIUM%22;%0A    private static final String PRIORITY_LOW = %22LOW
 %22;%0A%0A
@@ -1158,46 +1158,24 @@
     
-p
+setP
 riority
-.setText(task.priorityString()
+(task
 );%0A 
@@ -1558,24 +1558,24 @@
 oString());%0A
-
         tags
@@ -1602,32 +1602,789 @@
 ring());%0A    %7D%0A%0A
+    /**%0A     * Sets colors to priority label based on task's priority%0A     * %0A     * @@author A0121533W%0A     */%0A    private void setPriority(ReadOnlyTask task) %7B%0A        switch (task.priorityString()) %7B%0A        case PRIORITY_HIGH:%0A            priority.setText(task.priorityString());%0A            priority.setStyle(%22-fx-text-fill: red%22);%0A            break;%0A        case PRIORITY_MEDIUM:%0A            priority.setText(task.priorityString());%0A            priority.setStyle(%22-fx-text-fill: orange%22);%0A            break;%0A        case PRIORITY_LOW:%0A            priority.setText(task.priorityString());%0A            priority.setStyle(%22-fx-text-fill: green%22);%0A            break;  %0A        default:%0A            priority.setText(task.priorityString());%0A        %7D%0A    %7D%0A%0A
     public HBox 

Add coloring of priority level