forked from nus-cs2103-AY1617S1/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DeadlineCard and EventCard to separate display functionalities fr…
…om TaskCard, and update isDone colour display style
- Loading branch information
Showing
8 changed files
with
351 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package seedu.taskitty.ui; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.HBox; | ||
import seedu.taskitty.model.task.ReadOnlyTask; | ||
import seedu.taskitty.model.task.TaskDate; | ||
import seedu.taskitty.model.task.TaskTime; | ||
|
||
public class DeadlineCard extends UiPart{ | ||
|
||
private static final String FXML = "DeadlineListCard.fxml"; | ||
|
||
@FXML | ||
private HBox cardPane; | ||
@FXML | ||
private Label name; | ||
@FXML | ||
private Label startDate; | ||
@FXML | ||
private Label startTime; | ||
@FXML | ||
private Label endDate; | ||
@FXML | ||
private Label endTime; | ||
@FXML | ||
private Label id; | ||
@FXML | ||
private Label tags; | ||
|
||
private ReadOnlyTask task; | ||
private int displayedIndex; | ||
|
||
public DeadlineCard(){ | ||
|
||
} | ||
|
||
public static DeadlineCard load(ReadOnlyTask task, int displayedIndex){ | ||
DeadlineCard card = new DeadlineCard(); | ||
card.task = task; | ||
card.displayedIndex = displayedIndex; | ||
return UiPartLoader.loadUiPart(card); | ||
} | ||
|
||
@FXML | ||
public void initialize() { | ||
name.setText(task.getName().fullName); | ||
startDate.setText(""); | ||
startTime.setText(""); | ||
endDate.setText(""); | ||
endTime.setText(""); | ||
|
||
TaskDate startTaskDate = task.getStartDate(); | ||
if (startTaskDate != null) { | ||
startDate.setText(startTaskDate.toString()); | ||
} | ||
|
||
TaskTime taskStartTime = task.getStartTime(); | ||
if (taskStartTime != null) { | ||
startTime.setText(taskStartTime.toString()); | ||
} | ||
|
||
TaskDate endTaskDate = task.getEndDate(); | ||
if (endTaskDate != null) { | ||
endDate.setText(endTaskDate.toString()); | ||
} | ||
|
||
TaskTime taskEndTime = task.getEndTime(); | ||
if (taskEndTime != null) { | ||
endTime.setText(taskEndTime.toString()); | ||
} | ||
|
||
boolean isDone = task.getIsDone(); | ||
if (isDone) { | ||
cardPane.setStyle("-fx-background-color: grey"); | ||
name.setStyle("-fx-text-fill: white"); | ||
id.setStyle("-fx-text-fill: white"); | ||
startDate.setStyle("-fx-text-fill: white"); | ||
endDate.setStyle("-fx-text-fill: white"); | ||
startTime.setStyle("-fx-text-fill: white"); | ||
endTime.setStyle("-fx-text-fill: white"); | ||
|
||
} | ||
|
||
id.setText(displayedIndex + ". "); | ||
tags.setText(task.tagsString()); | ||
} | ||
|
||
public HBox getLayout() { | ||
return cardPane; | ||
} | ||
|
||
@Override | ||
public void setNode(Node node) { | ||
cardPane = (HBox)node; | ||
} | ||
|
||
@Override | ||
public String getFxmlPath() { | ||
return FXML; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package seedu.taskitty.ui; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.HBox; | ||
import seedu.taskitty.model.task.ReadOnlyTask; | ||
import seedu.taskitty.model.task.TaskDate; | ||
import seedu.taskitty.model.task.TaskTime; | ||
|
||
public class EventCard extends UiPart{ | ||
|
||
private static final String FXML = "EventListCard.fxml"; | ||
|
||
@FXML | ||
private HBox cardPane; | ||
@FXML | ||
private Label name; | ||
@FXML | ||
private Label startDate; | ||
@FXML | ||
private Label startTime; | ||
@FXML | ||
private Label endDate; | ||
@FXML | ||
private Label endTime; | ||
@FXML | ||
private Label id; | ||
@FXML | ||
private Label tags; | ||
|
||
private ReadOnlyTask task; | ||
private int displayedIndex; | ||
|
||
public EventCard(){ | ||
|
||
} | ||
|
||
public static EventCard load(ReadOnlyTask task, int displayedIndex){ | ||
EventCard card = new EventCard(); | ||
card.task = task; | ||
card.displayedIndex = displayedIndex; | ||
return UiPartLoader.loadUiPart(card); | ||
} | ||
|
||
@FXML | ||
public void initialize() { | ||
name.setText(task.getName().fullName); | ||
startDate.setText(""); | ||
startTime.setText(""); | ||
endDate.setText(""); | ||
endTime.setText(""); | ||
|
||
TaskDate startTaskDate = task.getStartDate(); | ||
if (startTaskDate != null) { | ||
startDate.setText(startTaskDate.toString()); | ||
} | ||
|
||
TaskTime taskStartTime = task.getStartTime(); | ||
if (taskStartTime != null) { | ||
startTime.setText(taskStartTime.toString()); | ||
} | ||
|
||
TaskDate endTaskDate = task.getEndDate(); | ||
if (endTaskDate != null) { | ||
endDate.setText(endTaskDate.toString()); | ||
} | ||
|
||
TaskTime taskEndTime = task.getEndTime(); | ||
if (taskEndTime != null) { | ||
endTime.setText(taskEndTime.toString()); | ||
} | ||
|
||
boolean isDone = task.getIsDone(); | ||
if (isDone) { | ||
cardPane.setStyle("-fx-background-color: grey"); | ||
name.setStyle("-fx-text-fill: white"); | ||
id.setStyle("-fx-text-fill: white"); | ||
startDate.setStyle("-fx-text-fill: white"); | ||
endDate.setStyle("-fx-text-fill: white"); | ||
startTime.setStyle("-fx-text-fill: white"); | ||
endTime.setStyle("-fx-text-fill: white"); | ||
|
||
} | ||
|
||
id.setText(displayedIndex + ". "); | ||
tags.setText(task.tagsString()); | ||
} | ||
|
||
public HBox getLayout() { | ||
return cardPane; | ||
} | ||
|
||
@Override | ||
public void setNode(Node node) { | ||
cardPane = (HBox)node; | ||
} | ||
|
||
@Override | ||
public String getFxmlPath() { | ||
return FXML; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.net.URL?> | ||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.HBox?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
<?import javafx.scene.layout.VBox?> | ||
|
||
<HBox id="cardPane" fx:id="cardPane" stylesheets="@DarkTheme.css" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> | ||
<children> | ||
<GridPane HBox.hgrow="ALWAYS"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0" /> | ||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" prefWidth="100.0" /> | ||
</columnConstraints> | ||
<children> | ||
<VBox alignment="CENTER_LEFT" maxHeight="150.0" minHeight="105.0" prefHeight="115.0" GridPane.columnIndex="0"> | ||
<stylesheets> | ||
<URL value="@DarkTheme.css" /> | ||
<URL value="@Extensions.css" /> | ||
</stylesheets> | ||
<padding> | ||
<Insets bottom="5" left="15" right="5" top="5" /> | ||
</padding> | ||
|
||
<children> | ||
<HBox alignment="CENTER_LEFT" spacing="5"> | ||
<children> | ||
<HBox> | ||
<Label fx:id="id" styleClass="cell_big_label" /> | ||
<Label fx:id="name" styleClass="cell_big_label" text="\$name" /> | ||
</HBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT" spacing="5"> | ||
<children> | ||
<HBox> | ||
<children> | ||
<Label fx:id="startDate" styleClass="cell_small_label" text="\$startDate" /> | ||
<Label fx:id="startTime" styleClass="cell_small_label" text="\$startTime" /> | ||
</children> | ||
</HBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT"> | ||
<children> | ||
<Label fx:id="endDate" styleClass="cell_small_label" text="\$endDate" /> | ||
<Label fx:id="endTime" styleClass="cell_small_label" text="\$endTime" /> | ||
</children> | ||
</HBox> | ||
<Label fx:id="tags" styleClass="cell_small_label" text="\$tags" /> | ||
</children> | ||
</VBox> | ||
</children> | ||
<rowConstraints> | ||
<RowConstraints /> | ||
</rowConstraints> | ||
</GridPane> | ||
</children> | ||
</HBox> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.net.URL?> | ||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.HBox?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
<?import javafx.scene.layout.VBox?> | ||
|
||
<HBox id="cardPane" fx:id="cardPane" stylesheets="@DarkTheme.css" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1"> | ||
<children> | ||
<GridPane HBox.hgrow="ALWAYS"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0" /> | ||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" prefWidth="100.0" /> | ||
</columnConstraints> | ||
<children> | ||
<VBox alignment="CENTER_LEFT" maxHeight="150.0" minHeight="105.0" prefHeight="115.0" GridPane.columnIndex="0"> | ||
<stylesheets> | ||
<URL value="@DarkTheme.css" /> | ||
<URL value="@Extensions.css" /> | ||
</stylesheets> | ||
<padding> | ||
<Insets bottom="5" left="15" right="5" top="5" /> | ||
</padding> | ||
|
||
<children> | ||
<HBox alignment="CENTER_LEFT" spacing="5"> | ||
<children> | ||
<HBox> | ||
<Label fx:id="id" styleClass="cell_big_label" /> | ||
<Label fx:id="name" styleClass="cell_big_label" text="\$name" /> | ||
</HBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT" spacing="5"> | ||
<children> | ||
<HBox> | ||
<children> | ||
<Label fx:id="startDate" styleClass="cell_small_label" text="\$startDate" /> | ||
<Label fx:id="startTime" styleClass="cell_small_label" text="\$startTime" /> | ||
</children> | ||
</HBox> | ||
</children> | ||
</HBox> | ||
<HBox alignment="CENTER_LEFT"> | ||
<children> | ||
<Label fx:id="endDate" styleClass="cell_small_label" text="\$endDate" /> | ||
<Label fx:id="endTime" styleClass="cell_small_label" text="\$endTime" /> | ||
</children> | ||
</HBox> | ||
<Label fx:id="tags" styleClass="cell_small_label" text="\$tags" /> | ||
</children> | ||
</VBox> | ||
</children> | ||
<rowConstraints> | ||
<RowConstraints /> | ||
</rowConstraints> | ||
</GridPane> | ||
</children> | ||
</HBox> |