package seedu.taskell.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.taskell.model.task.ReadOnlyTask;
import seedu.taskell.model.task.Task;

public class TaskCard extends UiPart{

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label description;
    @FXML
    private Label taskType;
    @FXML
    private Label id;
    @FXML
    private Label taskDate;
    @FXML
    private Label taskPriority;
    @FXML
    private Label startTime;
    @FXML
    private Label endTime;
    @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() {
        taskType.setText(WHITESPACE);
        id.setText(displayedIndex + ". ");
        description.setText(task.getDescription().description);
        taskPriority.setText(WHITESPACE);
        tags.setText(task.tagsString());
        
        if (task.getTaskType().equals(Task.FLOATING_TASK)) {
            taskDate.setText(WHITESPACE);
            startTime.setText(WHITESPACE);
            endTime.setText(WHITESPACE);
        } else if (task.getTaskType().equals(Task.DEADLINE_TASK)) {
            taskDate.setText(task.getTaskDate().taskDate);
            startTime.setText(task.getEndTime().taskTime);  //To accustomed to display format on UI
            endTime.setText(WHITESPACE);
        } else {
            taskDate.setText(task.getTaskDate().taskDate);
            startTime.setText(task.getStartTime().taskTime);
            endTime.setText(task.getEndTime().taskTime);
        }
        
    }

    public HBox getLayout() {
        return cardPane;
    }

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

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

@@ -326,58 +326,8 @@
 ml%22;
-%0A    private static final String WHITESPACE = %22 %22;
 %0A%0A  
@@ -1057,34 +1057,42 @@
 ype.setText(
-WHITESPACE
+task.getTaskType()
 );%0A        i
@@ -1222,547 +1222,87 @@
 ext(
-WHITESPACE);%0A        tags.setText(task.tagsString());%0A        %0A        if (task.getTaskType().equals(Task.FLOATING_TASK)) %7B%0A            taskDate.setText(WHITESPACE);%0A            startTime.setText(WHITESPACE);%0A            endTime.setText(WHITESPACE);%0A        %7D else if (task.getTaskType().equals(Task.DEADLINE_TASK)) %7B%0A            taskDate.setText(task.getTaskDate().taskDate);%0A            startTime.setText(task.getEndTime().taskTime);  //To accustomed to display format on UI%0A            endTime.setText(WHITESPACE);%0A        %7D else %7B%0A    
+task.getTaskPriority().taskPriority);%0A        tags.setText(task.tagsString());%0A
     
@@ -1348,28 +1348,24 @@
 .taskDate);%0A
-    
         star
@@ -1417,20 +1417,16 @@
         
-    
 endTime.
@@ -1466,27 +1466,8 @@
 e);%0A
-        %7D%0A        %0A
     

Fix error in JUnit