Skip to content

Commit

Permalink
Merge pull request #151 from tengcharmaine/bug_fixesfor1.3
Browse files Browse the repository at this point in the history
Fix ui display of personcard contents
  • Loading branch information
jiahui0309 authored Apr 4, 2024
2 parents 56f1b3e + 179b8cf commit d3482fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public PersonCard(Person person, int displayedIndex) {
this.person = person;
id.setText(displayedIndex + ". ");
name.setText(person.getName().fullName);
phone.setText(person.getPhone().value);
email.setText(person.getEmail().value);

StringBuilder truncatedPhone = new StringBuilder();
phone.setText(truncatedPhone.append("Phone: ").append(person.getPhone().value).toString());

StringBuilder truncatedEmail = new StringBuilder();
email.setText(truncatedEmail.append("Email: ").append(person.getEmail().value).toString());

String fullNote = person.getNote().value;
int maxLineLength = 30; // Maximum length of each line before truncation
Expand Down Expand Up @@ -93,7 +97,9 @@ public PersonCard(Person person, int displayedIndex) {
ic.setText(person.getIdentityCardNumber().value);
age.setText(String.valueOf(person.getAge().value));
sex.setText(person.getSex().value);
address.setText(person.getAddress().value);

StringBuilder truncatedAddress = new StringBuilder();
address.setText(truncatedAddress.append("Address: ").append(person.getAddress().value).toString());
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@
<Label fx:id="ic" styleClass="cell_small_label" text="\$ic" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Phone:" styleClass="cell_small_label" />
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Address:" styleClass="cell_small_label" />
<Label fx:id="address" styleClass="cell_small_label" text="\$address" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Email:" styleClass="cell_small_label" />
<Label fx:id="email" styleClass="cell_small_label" text="\$email" />
</HBox>
<HBox spacing="5" alignment="TOP_LEFT">
Expand Down

0 comments on commit d3482fd

Please sign in to comment.