forked from nus-cs2103-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2103-AY2425S1#77 from ethan-goh/change-ui
Change UI
- Loading branch information
Showing
10 changed files
with
640 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package seedu.address.ui; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Region; | ||
import seedu.address.model.person.Person; | ||
/** | ||
* A UI component that displays detailed information of a {@code Person}. | ||
*/ | ||
public class PersonDetails extends UiPart<Region> { | ||
private static final String FXML = "PersonDetails.fxml"; | ||
|
||
|
||
public final Person person; | ||
|
||
@javafx.fxml.FXML | ||
private HBox cardPane; | ||
@FXML | ||
private Label name; | ||
@FXML | ||
private Label id; | ||
@FXML | ||
private Label studentId; | ||
@FXML | ||
private Label phone; | ||
@FXML | ||
private Label address; | ||
@FXML | ||
private Label email; | ||
@FXML | ||
private Label tag; | ||
@FXML | ||
private Label course; | ||
@FXML | ||
private Label module; | ||
/** | ||
* Creates a {@code PersonDetails} with the given {@code Person}. | ||
* | ||
* @param person The person whose details are to be displayed. | ||
*/ | ||
public PersonDetails(Person person) { | ||
super(FXML); | ||
this.person = person; | ||
updateDetails(person); | ||
} | ||
|
||
/** | ||
* Updates the labels with the details of the given {@code Person}. | ||
*/ | ||
public void updateDetails(Person person) { | ||
if (person != null) { | ||
name.setText(person.getName().fullName); | ||
studentId.setText("StudentID\n" + person.getStudentId().value); | ||
phone.setText("Contact Number\n" + person.getPhone().value); | ||
tag.setText(person.getTag().role.getRole()); | ||
address.setText("Address\n" + person.getAddress().value); | ||
email.setText("Email Address\n" + person.getEmail().value); | ||
course.setText("Course\n" + person.getCourse().course); | ||
String modulesAsString = person.getModules().stream() | ||
.map(m -> m.toString() + "\n") | ||
.reduce("", (x, y) -> x + y); | ||
module.setText("Modules\n" + (modulesAsString.isEmpty() ? "No enrolled modules" : modulesAsString)); | ||
} else { | ||
name.setText(""); | ||
studentId.setText(""); | ||
phone.setText(""); | ||
address.setText(""); | ||
email.setText(""); | ||
tag.setText(""); | ||
course.setText(""); | ||
module.setText(""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.