diff --git a/src/main/java/seedu/address/model/meeting/Location.java b/src/main/java/seedu/address/model/meeting/Location.java index b064517f80b..8cb27fb5954 100644 --- a/src/main/java/seedu/address/model/meeting/Location.java +++ b/src/main/java/seedu/address/model/meeting/Location.java @@ -35,6 +35,16 @@ public static boolean isValidLocation(String test) { return test.matches(VALIDATION_REGEX); } + /** + * Returns a truncated Email if it is more than 40 characters long. + */ + public String shortLocation() { + if (this.location.length() > 40) { + return this.location.substring(0, 40) + "..."; + } + return this.location; + } + @Override public String toString() { return location; diff --git a/src/main/java/seedu/address/model/person/Email.java b/src/main/java/seedu/address/model/person/Email.java index c62e512bc29..a5e2b080d52 100644 --- a/src/main/java/seedu/address/model/person/Email.java +++ b/src/main/java/seedu/address/model/person/Email.java @@ -51,6 +51,16 @@ public static boolean isValidEmail(String test) { return test.matches(VALIDATION_REGEX); } + /** + * Returns a truncated Email if it is more than 30 characters long. + */ + public String shortEmail() { + if (this.value.length() > 30) { + return this.value.substring(0, 30) + "..."; + } + return this.value; + } + @Override public String toString() { return value; diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/seedu/address/model/tag/Tag.java index 12f2f9fe17a..32e185f565a 100644 --- a/src/main/java/seedu/address/model/tag/Tag.java +++ b/src/main/java/seedu/address/model/tag/Tag.java @@ -56,6 +56,16 @@ public static boolean isValidTagName(String test) { return test.matches(VALIDATION_REGEX); } + /** + * Returns a truncated Tag if it is more than 20 characters long. + */ + public String shortTagName() { + if (this.tagName.length() >= 20) { + return this.tagName.substring(0, 20) + "..."; + } + return this.tagName; + } + @Override public boolean equals(Object other) { if (other == this) { diff --git a/src/main/java/seedu/address/ui/MeetingCard.java b/src/main/java/seedu/address/ui/MeetingCard.java index 848fcbf7286..9c92038870b 100644 --- a/src/main/java/seedu/address/ui/MeetingCard.java +++ b/src/main/java/seedu/address/ui/MeetingCard.java @@ -61,7 +61,7 @@ public MeetingCard(Meeting meeting, int displayedIndex) { this.meeting = meeting; id.setText(displayedIndex + ". "); title.setText(meeting.getTitle().meetingTitle); - l.setText(meeting.getLocation().location); + l.setText(meeting.getLocation().shortLocation()); LocalDateTime startTime = meeting.getStart(); LocalDateTime endTime = meeting.getEnd(); dateStart.setText(startTime.format(DateTimeFormatter.ofPattern("dd.MM.yyyy"))); @@ -72,7 +72,7 @@ public MeetingCard(Meeting meeting, int displayedIndex) { end.setText(meeting.getEnd().format(DateTimeFormatter.ofPattern("HHmm"))); meeting.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) - .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + .forEach(tag -> tags.getChildren().add(new Label(tag.shortTagName()))); if (meeting.getStatus().isComplete) { status.setText("COMPLETE"); } else { diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index c35dbbc0513..49ede2cdfd8 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -54,7 +54,7 @@ public PersonCard(Person person, int displayedIndex) { id.setText(displayedIndex + ". "); name.setText(person.getName().fullName); phone.setText(person.getPhone().value); - email.setText(person.getEmail().value); + email.setText(person.getEmail().shortEmail()); LocalDateTime time = person.getLastContactedTime(); lastContactedTime.setText(time.isEqual(LocalDateTime.MIN) ? "Not contacted yet" @@ -62,6 +62,6 @@ public PersonCard(Person person, int displayedIndex) { status.setText(person.getStatus().value); person.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) - .forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); + .forEach(tag -> tags.getChildren().add(new Label(tag.shortTagName()))); } } diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index ab57e7e5474..9ca68c504da 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -13,7 +13,7 @@ - + diff --git a/src/main/resources/view/MeetingScheduleCard.fxml b/src/main/resources/view/MeetingScheduleCard.fxml index 8919d55815d..f140d9a702d 100644 --- a/src/main/resources/view/MeetingScheduleCard.fxml +++ b/src/main/resources/view/MeetingScheduleCard.fxml @@ -20,14 +20,9 @@ - + @@ -43,7 +38,7 @@