From 19c76c0cb8a88d111512d3c30af37ed844e24ed8 Mon Sep 17 00:00:00 2001 From: Nicholas Jimmy Alden <89759682+Nixx162@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:56:52 +0800 Subject: [PATCH 01/12] style: merged some columns of the list --- .../java/seedu/address/ui/ContactCard.java | 56 +++++++++++++++++++ .../seedu/address/ui/PersonListPanel.java | 33 ++++------- src/main/resources/view/ContactCard.fxml | 37 ++++++++++++ src/main/resources/view/PersonListPanel.fxml | 6 +- 4 files changed, 104 insertions(+), 28 deletions(-) create mode 100644 src/main/java/seedu/address/ui/ContactCard.java create mode 100644 src/main/resources/view/ContactCard.fxml diff --git a/src/main/java/seedu/address/ui/ContactCard.java b/src/main/java/seedu/address/ui/ContactCard.java new file mode 100644 index 00000000000..2e290965e17 --- /dev/null +++ b/src/main/java/seedu/address/ui/ContactCard.java @@ -0,0 +1,56 @@ +package seedu.address.ui; + +import java.util.Comparator; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Region; +import seedu.address.model.person.Person; + +/** + * An UI component that displays information of a {@code Person}. + */ +public class ContactCard extends UiPart { + + private static final String FXML = "ContactCard.fxml"; + + /** + * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. + * As a consequence, UI elements' variable names cannot be set to such keywords + * or an exception will be thrown by JavaFX during runtime. + * + * @see The issue on AddressBook level 4 + */ + + public final Person person; + + @FXML + private HBox cardPane; + @FXML + private Label name; + @FXML + private Label email; + @FXML + private Label mobile; + @FXML + private Label address; + @FXML + private FlowPane tags; + + /** + * Creates a {@code PersonCode} with the given {@code Person} and index to display. + */ + public ContactCard(Person person) { + super(FXML); + this.person = person; + name.setText(person.getName().fullName); + mobile.setText("Phone: " + person.getPhone().value); + address.setText(person.getAddress().value); + email.setText(person.getEmail().value); + person.getTags().stream() + .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + + } +} \ No newline at end of file diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java index 1dd4bee05c4..54b193bccdb 100644 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ b/src/main/java/seedu/address/ui/PersonListPanel.java @@ -28,11 +28,7 @@ public class PersonListPanel extends UiPart { @FXML private TableView table; @FXML private TableColumn indexCol; - @FXML private TableColumn nameCol; - @FXML private TableColumn emailCol; - @FXML private TableColumn phoneCol; - @FXML private TableColumn addressCol; - @FXML private TableColumn tagsCol; + @FXML private TableColumn contactCol; @FXML private TableColumn notesCol; @FXML private TableColumn eventsCol; @@ -46,24 +42,23 @@ public PersonListPanel(ObservableList personList) { indexCol.setCellFactory(col -> new TableIndexCell()); indexCol.setPrefWidth(50); - nameCol.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().getName().fullName)); - emailCol.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().getEmail().value)); + contactCol.setCellFactory(col -> new TableContactsCell(personList)); - phoneCol.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().getPhone().value)); - phoneCol.setPrefWidth(100); - - addressCol.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().getAddress().value)); - tagsCol.setCellFactory(col -> new TableTagsCell(personList)); notesCol.setCellFactory(col -> new TableNotesCell(personList)); + notesCol.minWidthProperty().bind( + table.widthProperty().multiply(0.5)); + eventsCol.setCellFactory(col -> new TableEventsCell(personList)); + eventsCol.minWidthProperty().bind( + table.widthProperty().multiply(0.3)); table.setItems(personList); } - class TableTagsCell extends TableCell { + class TableContactsCell extends TableCell { private ObservableList personList; - public TableTagsCell(ObservableList personList) { + public TableContactsCell(ObservableList personList) { this.personList = personList; } @@ -73,13 +68,7 @@ public void updateIndex(int index) { if (isEmpty() || index < 0) { setGraphic(null); } else { - FlowPane tagFlowPane = new FlowPane(); - tagFlowPane.setVgap(8); - tagFlowPane.setHgap(10); - tagFlowPane.setPrefWrapLength(200); - personList.get(index).getTags().stream() - .forEach(tag -> tagFlowPane.getChildren().add(new Label(tag.tagName))); - setGraphic(tagFlowPane); + setGraphic(new ContactCard(personList.get(index)).getRoot()); } } } @@ -101,7 +90,6 @@ public void updateIndex(int index) { notes.setItems(personList.get(index).getNotes()); notes.setCellFactory(cell -> new NoteCell()); notes.setPrefHeight(120); - notes.setPrefWidth(300); setGraphic(notes); } } @@ -168,5 +156,4 @@ protected void updateItem(Event event, boolean empty) { } } } - } diff --git a/src/main/resources/view/ContactCard.fxml b/src/main/resources/view/ContactCard.fxml new file mode 100644 index 00000000000..165e2fd4f46 --- /dev/null +++ b/src/main/resources/view/ContactCard.fxml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/view/PersonListPanel.fxml b/src/main/resources/view/PersonListPanel.fxml index 89cbf96db77..6048e5af365 100644 --- a/src/main/resources/view/PersonListPanel.fxml +++ b/src/main/resources/view/PersonListPanel.fxml @@ -8,11 +8,7 @@ - - - - - + From f5fbb1e7935df43d66a982c75a5348efceec5643 Mon Sep 17 00:00:00 2001 From: Nicholas Jimmy Alden <89759682+Nixx162@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:57:22 +0800 Subject: [PATCH 02/12] style: adjust UI look --- src/main/resources/view/DarkTheme.css | 4 ++-- src/main/resources/view/MainWindow.fxml | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/resources/view/DarkTheme.css b/src/main/resources/view/DarkTheme.css index 4697b3b1def..07ed3d2c90d 100644 --- a/src/main/resources/view/DarkTheme.css +++ b/src/main/resources/view/DarkTheme.css @@ -123,13 +123,13 @@ .cell_big_label { -fx-font-family: "Segoe UI Semibold"; -fx-font-size: 16px; - -fx-text-fill: #010504; + -fx-text-fill: #ffffff; } .cell_small_label { -fx-font-family: "Segoe UI"; -fx-font-size: 13px; - -fx-text-fill: #010504; + -fx-text-fill: #ffffff; } .stack-pane { diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 7778f666a0a..dd4452fc8f4 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -6,13 +6,12 @@ - + - + @@ -33,24 +32,23 @@ - + - + - + - + - + - + - + From cf558eaf937721f3358aeb262c44435e9cb292c2 Mon Sep 17 00:00:00 2001 From: Nicholas Jimmy Alden <89759682+Nixx162@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:57:38 +0800 Subject: [PATCH 03/12] style: make result display bar larger --- src/main/resources/view/ResultDisplay.fxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/view/ResultDisplay.fxml b/src/main/resources/view/ResultDisplay.fxml index 01b691792a9..562e5a32459 100644 --- a/src/main/resources/view/ResultDisplay.fxml +++ b/src/main/resources/view/ResultDisplay.fxml @@ -5,5 +5,5 @@ -