Skip to content

Commit

Permalink
Merge pull request #65 from jian7490/person-to-student
Browse files Browse the repository at this point in the history
Fix the bug of null StudentDetailsPanel in initialization
  • Loading branch information
jian7490 authored Oct 10, 2024
2 parents 18b8143 + e377959 commit 6c0f568
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/CommandResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public boolean isExit() {
return exit;
}

public boolean getStudent() {
public boolean isStudent() {
return student != null;
}

public Student getCurStudent() {
public Student getStudent() {
return student;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ private CommandResult executeCommand(String commandText) throws CommandException
logger.info("Result: " + commandResult.getFeedbackToUser());
resultDisplay.setFeedbackToUser(commandResult.getFeedbackToUser());

if (commandResult.getStudent()) {
updateDetailsPanel(commandResult.getCurStudent(), commandResult.getStudentIndex());
if (commandResult.isStudent()) {
updateDetailsPanel(commandResult.getStudent(), commandResult.getStudentIndex());
}

if (commandResult.isShowHelp()) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/seedu/address/ui/StudentDetailsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public class StudentDetailsPanel extends UiPart<Region> {
@FXML
private Label phone;
@FXML
private Label address;
@FXML
private Label email;
@FXML
private FlowPane detailsTags;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/StudentListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public StudentListPanel(ObservableList<Student> studentList) {
/**
* Custom {@code ListCell} that displays the graphics of a {@code Student} using a {@code StudentCard}.
*/
class StudentListViewCell extends ListCell<Student> {
static class StudentListViewCell extends ListCell<Student> {
@Override
protected void updateItem(Student student, boolean empty) {
super.updateItem(student, empty);
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
</padding>
</StackPane>

<VBox fx:id="studentList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<SplitPane VBox.vgrow="ALWAYS" dividerPositions="0.5">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="studentListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
<StackPane fx:id="studentListPanelPlaceholder" styleClass="pane-with-border" />
<StackPane fx:id="studentDetailsPanelPlaceholder" styleClass="details-pane" />
</SplitPane>

<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
<Label text="Phone: " styleClass="details_field_headers" />
<Label fx:id="phone" styleClass="details_small_label" text="\$phone" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<padding>
<Insets left="8"/>
</padding>
<Label text="Address: " styleClass="details_field_headers" />
<Label fx:id="address" styleClass="details_small_label" text="\$address" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<padding>
<Insets left="8"/>
Expand Down

0 comments on commit 6c0f568

Please sign in to comment.