Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2122S1#73 from CrownKira/update-PC
Browse files Browse the repository at this point in the history
Update PersonListCard
  • Loading branch information
KT27Learn authored Oct 13, 2021
2 parents 2b37f26 + 4ccb615 commit 93a81f7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
15 changes: 6 additions & 9 deletions src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class PersonCard extends UiPart<Region> {
@FXML
private HBox cardPane;
@FXML
private Label clientId;
@FXML
private Label name;
@FXML
private Label id;
Expand All @@ -52,13 +50,12 @@ public class PersonCard extends UiPart<Region> {
private FlowPane tags;

/**
* Creates a {@code PersonCode} with the given {@code Person} and index to display.
* Creates a {@code PersonCode}.
*/
public PersonCard(Person person, int displayedIndex) {
public PersonCard(Person person) {
super(FXML);
this.person = person;
id.setText(displayedIndex + ". ");
clientId.setText(person.getClientId().value);
id.setText(person.getClientId().value + ". ");
name.setText(person.getName().fullName);
email.setText(person.getEmail().value);
phone.setText(person.getPhone().value);
Expand All @@ -68,8 +65,8 @@ public PersonCard(Person person, int displayedIndex) {
currentPlan.setText(person.getCurrentPlan().toString());
lastMet.setText(person.getLastMet().toString());
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
}

@Override
Expand All @@ -87,6 +84,6 @@ public boolean equals(Object other) {
// state check
PersonCard card = (PersonCard) other;
return id.getText().equals(card.id.getText())
&& person.equals(card.person);
&& person.equals(card.person);
}
}
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/PersonListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void updateItem(Person person, boolean empty) {
setGraphic(null);
setText(null);
} else {
setGraphic(new PersonCard(person, getIndex() + 1).getRoot());
setGraphic(new PersonCard(person).getRoot());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>

<fx:root maxHeight="600.0" maxWidth="740.0" minHeight="600" minWidth="740.0" onCloseRequest="#handleExit" title="LeadsForce" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<fx:root minHeight="600" minWidth="740.0" onCloseRequest="#handleExit" title="LeadsForce" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand Down
5 changes: 0 additions & 5 deletions src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
</Label>
</HBox>
<FlowPane fx:id="tags" />
<Label fx:id="clientId" styleClass="cell_small_label" text="\$clientId">
<tooltip>
<Tooltip text="Client Id" />
</tooltip></Label>
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone">
<tooltip>
<Tooltip text="Phone" />
Expand Down Expand Up @@ -78,7 +74,6 @@
<AnchorPane prefHeight="200.0" prefWidth="200.0" style="-fx-border-color: grey;">
<children>
<Label layoutX="5.0" layoutY="11.0" text="Next Meeting:" />
<Label fx:id="nextMeeting" layoutX="9.0" layoutY="60.0" text="&lt;Meeting Info Here&gt;" />
</children>
</AnchorPane>
</HBox>

0 comments on commit 93a81f7

Please sign in to comment.