Skip to content

Commit

Permalink
Add star graphic for pinned task
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaty committed Oct 19, 2016
1 parent 25baa41 commit bdaef88
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/seedu/task/ui/TaskCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.shape.SVGPath;
import seedu.task.model.task.ReadOnlyTask;

public class TaskCard extends UiPart{
Expand All @@ -19,6 +20,8 @@ public class TaskCard extends UiPart{
@FXML
private Label id;
@FXML
private SVGPath star;
@FXML
private AnchorPane tagsListPlaceholder;

private ReadOnlyTask task;
Expand All @@ -41,14 +44,22 @@ public void initialize() {
name.setText(task.getName().taskName);
id.setText(displayedIndex + ". ");
tagListPanel = TagListPanel.load(getPrimaryStage(), tagsListPlaceholder, task.getTags().getInternalList());
setImportant();
}

private void setImportant() {
if (!task.getImportance()) {
star.setOpacity(0.0);
}
}

public HBox getLayout() {
return cardPane;
}

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

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@
-fx-padding: 8 1 8 1;
}

.invisible-star {
-fx-fill: gold;
}

#cardPane {
-fx-background-color: transparent;
-fx-border-color: #d6d6d6;
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/view/TaskListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import java.net.URL?>
<?import javafx.scene.shape.SVGPath?>
<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<GridPane HBox.hgrow="ALWAYS" >
Expand Down Expand Up @@ -33,6 +34,11 @@
<AnchorPane fx:id="tagsListPlaceholder" />
</children>
</VBox>
<VBox alignment="CENTER" GridPane.columnIndex="1">
<children>
<SVGPath fx:id="star" scaleX="0.6" scaleY="0.6" content="m25,1 6,17h18l-14,11 5,17-15-10-15,10 5-17-14-11h18z" styleClass="invisible-star" />
</children>
</VBox>
</children>
</GridPane>
</children>
Expand Down

0 comments on commit bdaef88

Please sign in to comment.