Skip to content

Commit 592c6bb

Browse files
authored
Merge branch 'master' into main-zain
2 parents e07fef1 + 12e46c2 commit 592c6bb

File tree

3 files changed

+77
-13
lines changed

3 files changed

+77
-13
lines changed

src/main/java/seedu/address/ui/PersonCard.java

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,51 @@ public class PersonCard extends UiPart<Region> {
3131
@FXML
3232
private Label name;
3333
@FXML
34+
private Label name1;
35+
@FXML
3436
private Label id;
3537
@FXML
38+
private Label id1;
39+
@FXML
3640
private Label phone;
3741
@FXML
42+
private Label phone1;
43+
@FXML
3844
private Label address;
3945
@FXML
46+
private Label address1;
47+
@FXML
4048
private Label email;
4149
@FXML
50+
private Label email1;
51+
@FXML
4252
private FlowPane tags;
53+
@FXML
54+
private FlowPane tags1;
4355

4456
public PersonCard(Recipe recipe, int displayedIndex) {
4557
super(FXML);
46-
this.recipe = recipe;
47-
id.setText(displayedIndex + ". ");
48-
name.setText(recipe.getName().fullName);
49-
phone.setText(recipe.getPhone().value);
50-
address.setText(recipe.getAddress().value);
51-
email.setText(recipe.getEmail().value);
52-
recipe.getTags().stream()
53-
.sorted(Comparator.comparing(tag -> tag.tagName))
54-
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
58+
this.recipe = recipe;
59+
60+
if (displayedIndex % 2 == 0) {
61+
id.setText(displayedIndex + ". ");
62+
name.setText(recipe.getName().fullName);
63+
phone.setText(recipe.getPhone().value);
64+
address.setText(recipe.getAddress().value);
65+
email.setText(recipe.getEmail().value);
66+
recipe.getTags().stream()
67+
.sorted(Comparator.comparing(tag -> tag.tagName))
68+
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
69+
} else {
70+
id1.setText(displayedIndex + ". ");
71+
name1.setText(recipe.getName().fullName);
72+
phone1.setText(recipe.getPhone().value);
73+
address1.setText(recipe.getAddress().value);
74+
email1.setText(recipe.getEmail().value);
75+
recipe.getTags().stream()
76+
.sorted(Comparator.comparing(tag -> tag.tagName))
77+
.forEach(tag -> tags1.getChildren().add(new Label(tag.tagName)));
78+
}
5579
}
5680

5781
@Override

src/main/resources/view/DarkTheme.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@
342342
-fx-vgap: 3;
343343
}
344344

345+
#tags1 {
346+
-fx-hgap: 7;
347+
-fx-vgap: 3;
348+
}
349+
345350
#tags .label {
346351
-fx-text-fill: white;
347352
-fx-background-color: #3e7b91;
@@ -350,3 +355,12 @@
350355
-fx-background-radius: 2;
351356
-fx-font-size: 11;
352357
}
358+
359+
#tags1 .label {
360+
-fx-text-fill: white;
361+
-fx-background-color: #3e7b91;
362+
-fx-padding: 1 3 1 3;
363+
-fx-border-radius: 2;
364+
-fx-background-radius: 2;
365+
-fx-font-size: 11;
366+
}

src/main/resources/view/PersonListCard.fxml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,56 @@
77
<?import javafx.scene.layout.GridPane?>
88
<?import javafx.scene.layout.HBox?>
99
<?import javafx.scene.layout.Region?>
10+
<?import javafx.scene.layout.RowConstraints?>
1011
<?import javafx.scene.layout.VBox?>
1112

12-
<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
13+
<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
1314
<GridPane HBox.hgrow="ALWAYS">
1415
<columnConstraints>
1516
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150" />
17+
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0" />
1618
</columnConstraints>
1719
<VBox alignment="CENTER_LEFT" minHeight="105" GridPane.columnIndex="0">
1820
<padding>
19-
<Insets top="5" right="5" bottom="5" left="15" />
21+
<Insets bottom="5" left="15" right="5" top="5" />
2022
</padding>
21-
<HBox spacing="5" alignment="CENTER_LEFT">
23+
<HBox alignment="CENTER_LEFT" prefWidth="142.0" spacing="5">
2224
<Label fx:id="id" styleClass="cell_big_label">
2325
<minWidth>
2426
<!-- Ensures that the label text is never truncated -->
2527
<Region fx:constant="USE_PREF_SIZE" />
2628
</minWidth>
2729
</Label>
28-
<Label fx:id="name" text="\$first" styleClass="cell_big_label" />
30+
<Label fx:id="name" styleClass="cell_big_label" text="\$first" />
2931
</HBox>
3032
<FlowPane fx:id="tags" />
3133
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
3234
<Label fx:id="address" styleClass="cell_small_label" text="\$address" />
3335
<Label fx:id="email" styleClass="cell_small_label" text="\$email" />
3436
</VBox>
37+
<VBox alignment="CENTER_LEFT" minHeight="105" GridPane.columnIndex="1">
38+
<padding>
39+
<Insets bottom="5" left="15" right="5" top="5" />
40+
</padding>
41+
<children>
42+
<HBox alignment="CENTER_LEFT" prefWidth="142.0" spacing="5">
43+
<children>
44+
<Label fx:id="id1" styleClass="cell_big_label">
45+
<minWidth>
46+
<Region fx:constant="USE_PREF_SIZE" />
47+
</minWidth>
48+
</Label>
49+
<Label fx:id="name1" styleClass="cell_big_label" text="\$first" />
50+
</children>
51+
</HBox>
52+
<FlowPane fx:id="tags1" />
53+
<Label fx:id="phone1" styleClass="cell_small_label" text="\$phone" />
54+
<Label fx:id="address1" styleClass="cell_small_label" text="\$address" />
55+
<Label fx:id="email1" styleClass="cell_small_label" text="\$email" />
56+
</children>
57+
</VBox>
58+
<rowConstraints>
59+
<RowConstraints />
60+
</rowConstraints>
3561
</GridPane>
3662
</HBox>

0 commit comments

Comments
 (0)