Skip to content

Commit e5f9853

Browse files
authored
Merge pull request #74 from tanyqcollin/branch-ListView
Change the layout of Person List Panel
2 parents 4d90689 + 8b40e66 commit e5f9853

File tree

7 files changed

+62
-37
lines changed

7 files changed

+62
-37
lines changed

src/main/java/seedu/address/model/person/Gender.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
*/
1010
public class Gender {
1111

12-
public static final String MALE_SYMBOL = " ♂";
13-
public static final String FEMALE_SYMBOL = " ♀";
12+
public static final String MALE_SYMBOL = "♂";
13+
public static final String FEMALE_SYMBOL = "♀";
1414
public static final String MESSAGE_CONSTRAINTS =
1515
"Gender should be either 'male' or 'female', and it should not be empty.";
1616

@@ -43,7 +43,7 @@ public static boolean isValidGender(String test) {
4343
* Returns gender of person concatenated with its corresponding symbol.
4444
*/
4545
public String getGenderWithSymbol() {
46-
return gender.equals("male") ? gender + MALE_SYMBOL : gender + FEMALE_SYMBOL;
46+
return gender.equals("male") ? MALE_SYMBOL : FEMALE_SYMBOL;
4747
}
4848

4949

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public PersonCard(Person person, int displayedIndex) {
6060
.sorted(Comparator.comparing(module -> module.module))
6161
.forEach(module -> modules.getChildren().add(new Label(module.module)));
6262
gender.textFillProperty().bind(
63-
Bindings.when(gender.textProperty().isEqualTo("male ♂"))
63+
Bindings.when(gender.textProperty().isEqualTo("♂"))
6464
.then(Color.LIGHTBLUE)
6565
.otherwise(Color.PINK));
6666
}

src/main/resources/view/DarkTheme.css

+20-7
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@
130130

131131
.cell_big_label {
132132
-fx-font-family: "Segoe UI Semibold";
133-
-fx-font-size: 16px;
133+
-fx-font-size: 20px;
134134
-fx-text-fill: #010504;
135+
-fx-font-weight: bold;
135136
}
136137

137138
.cell_small_label {
@@ -321,8 +322,9 @@
321322
}
322323

323324
#cardPane {
324-
-fx-background-color: transparent;
325-
-fx-border-width: 0;
325+
-fx-background-color: #334155;
326+
-fx-border-width: 0.5;
327+
-fx-border-color: black;
326328
}
327329

328330
#commandTypeLabel {
@@ -372,14 +374,25 @@
372374
}
373375

374376
#modules .label {
375-
-fx-text-fill: white;
377+
-fx-text-fill: black;
376378
-fx-font-weight: bold;
377379
-fx-font-family: "Noto Sans";
378380
-fx-background-color: #ea580c;
379-
-fx-padding: 5;
381+
-fx-padding: 7;
380382
-fx-border-insets: 3;
381383
-fx-background-insets: 3;
382-
-fx-border-radius: 5;
383-
-fx-background-radius: 5;
384+
-fx-border-radius: 20;
385+
-fx-background-radius: 20;
384386
-fx-font-size: 16;
385387
}
388+
389+
#personListLabel {
390+
-fx-background-color: #0F172A;
391+
-fx-padding: 20;
392+
}
393+
394+
#personListLabel .label {
395+
-fx-text-fill: #E0F2FE;
396+
-fx-font-size: 20px;
397+
-fx-font-weight: bold;
398+
}

src/main/resources/view/MainWindow.fxml

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<?import java.net.URL?>
4-
<?import javafx.geometry.Insets?>
54
<?import javafx.scene.Scene?>
65
<?import javafx.scene.control.Menu?>
76
<?import javafx.scene.control.MenuBar?>
@@ -33,18 +32,15 @@
3332
</Menu>
3433
</MenuBar>
3534

36-
<SplitPane VBox.vgrow="ALWAYS" dividerPositions="0.8">
37-
<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
35+
<SplitPane dividerPositions="0.5" VBox.vgrow="ALWAYS">
36+
<VBox fx:id="personList" styleClass="pane-with-border" alignment="CENTER" VBox.vgrow="ALWAYS">
3837
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
3938
</VBox>
40-
4139
<VBox minWidth="340" prefWidth="380">
4240
<StackPane VBox.vgrow="ALWAYS" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border" />
4341
<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border" />
4442
</VBox>
4543
</SplitPane>
46-
47-
4844
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
4945
</VBox>
5046
</Scene>

src/main/resources/view/PersonListCard.fxml

+27-14
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,36 @@
1414
<columnConstraints>
1515
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150" />
1616
</columnConstraints>
17-
<VBox alignment="CENTER_LEFT" minHeight="105" GridPane.columnIndex="0">
18-
<padding>
19-
<Insets top="5" right="5" bottom="5" left="15" />
20-
</padding>
21-
<HBox spacing="0.5" alignment="CENTER_LEFT">
22-
<Label fx:id="id" styleClass="cell_big_label">
17+
<HBox>
18+
<VBox alignment="CENTER_LEFT" minHeight="105" GridPane.columnIndex="0" spacing="5">
19+
<padding>
20+
<Insets top="5" right="5" bottom="5" left="15" />
21+
</padding>
22+
<HBox spacing="0.5" alignment="CENTER_LEFT">
23+
<Label fx:id="id" styleClass="cell_big_label">
24+
<minWidth>
25+
<!-- Ensures that the label text is never truncated -->
26+
<Region fx:constant="USE_PREF_SIZE" />
27+
</minWidth>
28+
</Label>
29+
<Label fx:id="name" text="\$first" styleClass="cell_big_label" />
2330
<minWidth>
24-
<!-- Ensures that the label text is never truncated -->
2531
<Region fx:constant="USE_PREF_SIZE" />
2632
</minWidth>
27-
</Label>
28-
<Label fx:id="name" text="\$first" styleClass="cell_big_label" />
33+
<Label fx:id="gender" text="\$gender" styleClass="cell_big_label" />
34+
</HBox>
35+
36+
<HBox spacing="5">
37+
<Label styleClass="cell_small_label" text="📞" />
38+
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
39+
</HBox>
40+
41+
<FlowPane fx:id="tags" />
42+
</VBox>
43+
44+
<HBox spacing="0.5" alignment="CENTER" style="-fx-padding: 30;">
45+
<FlowPane fx:id="modules" />
2946
</HBox>
30-
<FlowPane fx:id="tags" />
31-
<FlowPane fx:id="modules" />
32-
<Label fx:id="gender" styleClass="cell_small_label" text="\$gender" />
33-
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
34-
</VBox>
47+
</HBox>
3548
</GridPane>
3649
</HBox>

src/main/resources/view/PersonListPanel.fxml

+5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
<?import javafx.scene.control.ListView?>
44
<?import javafx.scene.layout.VBox?>
5+
<?import javafx.scene.layout.HBox?>
6+
<?import javafx.scene.control.Label?>
57

68
<VBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
9+
<HBox fx:id="personListLabel" spacing="0.5" alignment="CENTER">
10+
<Label text="Students" />
11+
</HBox>
712
<ListView fx:id="personListView" VBox.vgrow="ALWAYS" />
813
</VBox>

src/test/java/seedu/address/model/person/GenderTest.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ public void isValidGender() {
4141
@Test
4242
public void getGenderWithSymbol() {
4343
Gender gender = new Gender("male");
44-
assertEquals("male" + MALE_SYMBOL, gender.getGenderWithSymbol());
45-
assertNotEquals("male" + FEMALE_SYMBOL, gender.getGenderWithSymbol());
46-
assertNotEquals("female" + FEMALE_SYMBOL, gender.getGenderWithSymbol());
44+
assertEquals(MALE_SYMBOL, gender.getGenderWithSymbol());
45+
assertNotEquals(FEMALE_SYMBOL, gender.getGenderWithSymbol());
4746
assertNotEquals("male", gender.getGenderWithSymbol());
4847
gender = new Gender("female");
49-
assertEquals("female" + FEMALE_SYMBOL, gender.getGenderWithSymbol());
50-
assertNotEquals("male" + FEMALE_SYMBOL, gender.getGenderWithSymbol());
51-
assertNotEquals("female" + MALE_SYMBOL, gender.getGenderWithSymbol());
48+
assertEquals(FEMALE_SYMBOL, gender.getGenderWithSymbol());
49+
assertNotEquals(MALE_SYMBOL, gender.getGenderWithSymbol());
5250
assertNotEquals("female", gender.getGenderWithSymbol());
5351
}
5452

0 commit comments

Comments
 (0)