Skip to content

Commit

Permalink
reminders window
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwin97 committed Nov 9, 2019
1 parent ada5d44 commit 7702065
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/model/reminder/Reminder.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ public String toString() {
return builder.toString();
}

/**
* Creates toString method to print Reminders on the RemindersWindow.
*/
public String toWindowString() {
final StringBuilder builder = new StringBuilder();
builder.append(" Description: ")
builder.append("Description: ")
.append(getDescription())
.append(" Time: ")
.append("Time: ")
.append(getTime());
return builder.toString();
}
Expand Down
42 changes: 24 additions & 18 deletions src/main/java/seedu/address/ui/ReminderWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
Expand All @@ -13,8 +12,6 @@
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
Expand Down Expand Up @@ -71,21 +68,23 @@ public ReminderWindow(Stage root, Logic logic) {
border.setTop(hbox);
border.setCenter(reminderListView);
reminderListView.setItems(logic.getFilteredReminderList());
reminderListView.setPrefWidth(700);
reminderListView.setCellFactory(listView -> new ReminderListViewCell());


//addStackPane(hbox); // Add stack to HBox in top region
//border.setCenter(new GridPane());
//border.setRight(new FlowPane());
//hbox.getChildren().addAll(reminder);
//reminder.setText(HELP_MESSAGE);

border.isResizable();
border.setMargin(reminderListView, new Insets(5, 5, 5, 5));
}
//addStackPane(hbox);
// Add stack to HBox in top region
//border.setCenter(new GridPane());
//border.setRight(new FlowPane());
//hbox.getChildren().addAll(reminder);
//reminder.setText(HELP_MESSAGE);

/**
* Custom {@code ListCell} that displays the graphics of a {@code Person} using a {@code PersonCard}.
*/
class ReminderListViewCell extends ListCell<Reminder> {

@Override
protected void updateItem(Reminder reminder, boolean empty) {
super.updateItem(reminder, empty);
Expand All @@ -94,6 +93,7 @@ protected void updateItem(Reminder reminder, boolean empty) {
setText(null);
} else {
setText(reminder.toWindowString());

}
}
}
Expand Down Expand Up @@ -161,6 +161,9 @@ private void copyUrl() {
clipboard.setContent(url);
}

/**
* Creates a new HBox for the Title.
*/
public HBox addHBox() {
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
Expand All @@ -182,14 +185,17 @@ public HBox addHBox() {
return hbox;
}

/**
* Creates a new StackPane for the Title.
*/
public void addStackPane(HBox hb) {
StackPane stack = new StackPane();
Rectangle helpIcon = new Rectangle(30.0, 25.0);
helpIcon.setFill(new LinearGradient(0,0,0,1, true, CycleMethod.NO_CYCLE,
helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE,
new Stop[]{
new Stop(0, Color.web("#4977A3")),
new Stop(0.5, Color.web("#B0C6DA")),
new Stop(1,Color.web("#9CB6CF")),}));
new Stop(0, Color.web("#4977A3")),
new Stop(0.5, Color.web("#B0C6DA")),
new Stop(1, Color.web("#9CB6CF"))}));
helpIcon.setStroke(Color.web("#D0E6FA"));
helpIcon.setArcHeight(3.5);
helpIcon.setArcWidth(3.5);
Expand All @@ -200,10 +206,10 @@ public void addStackPane(HBox hb) {
helpText.setStroke(Color.web("#7080A0"));

stack.getChildren().addAll(helpIcon, helpText);
stack.setAlignment(Pos.CENTER_RIGHT); // Right-justify nodes in stack
stack.setAlignment(Pos.CENTER_RIGHT); // Right-justify nodes in stack
StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); // Center "?"

hb.getChildren().add(stack); // Add to HBox from Example 1-2
HBox.setHgrow(stack, Priority.ALWAYS); // Give stack any extra space
hb.getChildren().add(stack); // Add to HBox from Example 1-2
HBox.setHgrow(stack, Priority.ALWAYS); // Give stack any extra space
}
}

0 comments on commit 7702065

Please sign in to comment.