Skip to content

Commit

Permalink
Merge 044174a into 2a50eb4
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangUo79 committed Oct 30, 2019
2 parents 2a50eb4 + 044174a commit 17cdaa0
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ src/main/resources/docs/
/preferences.json
/*.log.*

# Image files
/images/

# Test sandbox files
src/test/data/sandbox/

Expand Down
82 changes: 65 additions & 17 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,34 @@ As the index can change depending on what filters are applied, refer to the curr

This command adds an athlete to Athletick.

Let's say John Doe just joined the team and you want to add him to Athletick so that you are able to track his
attendance and performance.

*What you should do*

Type the athlete's particulars in the format given below.

Format : `add n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...`
Format : `add n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]... [i/IMAGE]`

[IMPORTANT]
Take note that if you want to add an image of John when you are adding him to Athletick, make sure that
the image is in the `images` folder.

Example: `add n/John Doe p/98765432 e/johnd@example.com a/311, Clementi Ave 2, #02-25 t/backstroke`
[IMPORTANT]
You can include any number of tags (zero tags are also allowed) to an athlete and the addition of an image
is optional.

Example: `add n/John Doe p/98765432 e/johnd@example.com a/311, Clementi Ave 2, #02-25 t/backstroke i/john.png`

image::beforeAdd.png[width="790"]

*What you should see*

image::addcommand.png[width="790"]
image::afterAdd.png[width="790"]

If successfully added, the details of the added athlete will be displayed in the result box.

The athlete will be shown in team list.
The athlete will be shown in the team list.

==== Deleting an athlete : `delete`

Expand All @@ -111,9 +124,11 @@ Format: `delete INDEX`

Example: `delete 7`

IMPORTANT: The index refers to the index number shown in the displayed person list.
[IMPORTANT]
The index refers to the index number shown in the displayed person list.

IMPORTANT: ️The index must be a positive integer 1, 2, 3, …​
[IMPORTANT]
The index must be a positive integer 1, 2, 3, …​

*What you should see*

Expand All @@ -127,18 +142,20 @@ The athlete should no longer be shown in the team list.

This command edits the details of an existing athlete in Athletick.

All the details of an athlete (name, phone number, email, address, tags) can be edited.
All the details of an athlete (name, phone number, email, address, tags, image) can be edited.

*What you should do*

Type the edit command in the following format, using the relevant prefixes to edit the appropriate details.

Format: `edit INDEX n/[NAME] p/[PHONE] e/[EMAIL] a/[ADDRESS] t/[TAGS]`
Format: `edit INDEX n/[NAME] p/[PHONE] e/[EMAIL] a/[ADDRESS] t/[TAGS] i/[IMAGE]`

In order to edit Roy Balakrishnan's name to Shawn, type in the following.

Example: `edit 6 n/Shawn`

image::beforeEdit.png[width="790"]

[IMPORTANT]
The index refers to the index number shown in the displayed person list.

Expand All @@ -154,9 +171,12 @@ When editing tags, the existing tags of the person will be removed i.e adding of
[IMPORTANT]
You can remove all the person’s tags by typing `t/` without specifying any tags after it.

[IMPORTANT]
When editing the image, make sure that the image you are replacing with is in the `images` folder.

*What you should see*

image::editcommand.png[width="790"]
image::afterEdit.png[width="790"]

If successfully edited, the edited information of Roy (now Shawn) will be displayed in the result box.

Expand Down Expand Up @@ -350,24 +370,35 @@ You may use the left and right buttons to navigate to a different month. In the

==== Viewing more details of a team member : `select`

This command shows you details of a specific athlete.
This command shows the profile of the athlete that you have selected.

Let's say you want to view David's personal information.

*What you should do*

Type in the command in the following format.

Format : `select INDEX`

Example : `select 1`
Example : `select 4`

image::beforeSelect.png[width="790"]

*What you should see*

image::select.png[width="790"]
The message “Person selected!” will be displayed in the result box to indicate that you have selected the
athlete.

In the feature box, the personal information of the athlete will be displayed as shown.

The message “person selected!” will be displayed in the result box to indicate that you have selected the
person.
image::afterSelect.png[width="790"]

In the feature box, all the information of the athlete will be displayed as shown.
[IMPORTANT]
If the image of the selected athlete is not appearing as shown below, take note that the image file is not in the
`images` folder. You may refer to *Section 4.1.1. "Adding an athlete"* on where to include the image files which are
going to be used and *Section 4.1.3. Editing an athlete"* to understand further how to edit the image of an athlete.

image::emptyImage.png[width="790"]

==== Sorting athletes alphabetically : `sort`

Expand Down Expand Up @@ -579,12 +610,29 @@ There is no need to save manually.
*Q*: How do I transfer my data to another Computer? +
*A*: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous Address Book folder.

*Q*: How do I add my image files to the `images` folder? +
*A*: Make sure that the `images` folder is in the same directory as the Athletick executable jar file. If the
`images` folder is not created, the following steps will guide you through the creating of the `images` folder and
how to add images into the folder:

* Create a folder named `images` in the same directory as your executable jar file.

image::creatingFile.png[width ="790"]

* Ensure that the file name is correct.

image::imageFile.png[width="790"]

* Add the image files that you want to use into the folder.

image::addingPhotos.png[width="790"]

== Command Summary

[horizontal]
Add athlete:: `add n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...`
Add athlete:: `add n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]... i/IMAGE`
Delete athlete:: `delete INDEX`
Edit athlete:: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]...`
Edit athlete:: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]... i/IMAGE`
Add event:: `event EVENT_NAME`
Record performance:: `performance INDEX e/EVENT_NAME d/DDMMYYYY t/TIMING`
Take attendance (by present):: `attendance INDEX [INDEX]...`
Expand Down
Binary file added docs/images/addingPhotos.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/afterAdd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/afterEdit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/afterSelect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/beforeAdd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/beforeEdit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/beforeSelect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/creatingFile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/emptyImage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/imageFile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions src/main/java/seedu/address/model/person/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,38 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.AppUtil.checkArgument;

import javafx.scene.image.Image;
import java.io.File;

/**
* Represents a Person's photo in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidFilePath(String)}
*/
public class Photo {


public static final String MESSAGE_CONSTRAINTS = "Image filepath should be of the format local-part.png "
+ "and adhere to the following constraints:\n"
+ "1. The local-part should only contain alphanumeric characters and underscores.\n"
+ "2. This is followed by a '.' and only the image extension 'png' is allowed. ";
public static final String VALIDATION_REGEX = "^[\\w]+(\\.(?i)(png))$";
private static final String IMAGE_DIRECTORY = "/images/";

private static final String IMAGE_DIRECTORY = "images/";
public final String value;
public final Image photo;
public final String filePath;
private final File imageFile;


public Photo() {
value = "default.png";
photo = new Image(this.getClass().getResourceAsStream(IMAGE_DIRECTORY + value));
imageFile = new File(IMAGE_DIRECTORY + value);
filePath = "file://" + imageFile.toURI().getPath();
}

public Photo(String image) {
requireNonNull(image);
checkArgument(isValidFilePath(image), MESSAGE_CONSTRAINTS);
value = image;
photo = new Image(this.getClass().getResourceAsStream(IMAGE_DIRECTORY + image));
imageFile = new File(IMAGE_DIRECTORY + value);
filePath = "file://" + imageFile.toURI().getPath();
}

public static boolean isValidFilePath(String test) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/ui/InformationDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
Expand Down Expand Up @@ -57,7 +58,7 @@ public InformationDisplay(Person selectedPerson, String attendance) {
address.setPrefWidth(150);
address.setWrapText(true);
email.setText(this.person.getEmail().value);
photo.setImage(this.person.getPhoto().photo);
photo.setImage(new Image(this.person.getPhoto().filePath));
photo.setPreserveRatio(true);
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/view/InformationDisplay.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<VBox fx:id="informationBox" minHeight="-Infinity" minWidth="-Infinity" prefHeight="390.0" prefWidth="621.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<VBox fx:id="informationBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="390.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label fx:id="title" maxWidth="1.7976931348623157E308" prefHeight="39.0" style="-fx-background-color: #30336B;" text="Profile" textFill="WHITE">
<font>
<Font name="Arial" size="34.0" />
</font>
</Label>
<HBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="361.0" prefWidth="600.0" VBox.vgrow="ALWAYS">
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" VBox.vgrow="ALWAYS">
<children>
<VBox fx:id="imageHolder" prefHeight="402.0" prefWidth="310.0" HBox.hgrow="ALWAYS">
<VBox fx:id="imageHolder" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<children>
<ImageView fx:id="photo" fitHeight="164.0" fitWidth="193.0" pickOnBounds="true" preserveRatio="true" VBox.vgrow="ALWAYS">
<VBox.margin>
Expand All @@ -45,7 +45,7 @@
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="242.10434981982522" minHeight="0.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="242.10434981982522" minHeight="0.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="242.10434981982522" minHeight="0.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="316.97392209837284" minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="316.97392209837284" minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="316.97392209837284" minHeight="10.0" vgrow="SOMETIMES" />
Expand All @@ -57,7 +57,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="name" maxWidth="1.7976931348623157E308" text="\$name" wrapText="true" GridPane.columnIndex="1">
<Label fx:id="name" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$name" wrapText="true" GridPane.columnIndex="1">
<font>
<Font size="13.0" />
</font>
Expand All @@ -67,7 +67,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="phone" text="\$phone" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<Label fx:id="phone" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$phone" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font size="13.0" />
</font>
Expand All @@ -77,7 +77,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="email" maxWidth="1.7976931348623157E308" text="\$email" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<Label fx:id="email" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$email" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="3">
<font>
<Font size="13.0" />
</font>
Expand All @@ -87,7 +87,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="address" maxWidth="1.7976931348623157E308" text="\$address" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2" GridPane.vgrow="ALWAYS">
<Label fx:id="address" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$address" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2" GridPane.vgrow="ALWAYS">
<font>
<Font size="13.0" />
</font>
Expand All @@ -97,7 +97,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="attendanceRate" text="\$attendanceRate" GridPane.columnIndex="1" GridPane.rowIndex="4">
<Label fx:id="attendanceRate" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$attendanceRate" GridPane.columnIndex="1" GridPane.rowIndex="4">
<font>
<Font size="13.0" />
</font>
Expand All @@ -107,7 +107,7 @@
<Font size="15.0" />
</font>
</Label>
<Label fx:id="performance" text="\$performance" GridPane.columnIndex="1" GridPane.rowIndex="5">
<Label fx:id="performance" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="\$performance" GridPane.columnIndex="1" GridPane.rowIndex="5">
<font>
<Font size="13.0" />
</font>
Expand Down

0 comments on commit 17cdaa0

Please sign in to comment.