Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Ui-update' into Allocate-student…
Browse files Browse the repository at this point in the history
…s-to-team

# Conflicts:
#	src/main/java/seedu/address/logic/commands/AddTeamCommand.java
#	src/main/java/seedu/address/logic/parser/AddTeamCommandParser.java
#	src/main/java/seedu/address/logic/parser/AddressBookParser.java
#	src/main/java/seedu/address/logic/parser/CliSyntax.java
#	src/main/java/seedu/address/model/module/TutorialClass.java
#	src/main/java/seedu/address/model/module/TutorialTeam.java
#	src/main/java/seedu/address/storage/JsonAdaptedTutorialClass.java
#	src/main/java/seedu/address/storage/JsonAdaptedTutorialTeam.java
  • Loading branch information
qinxutan committed Mar 25, 2024
2 parents 7ef159e + 57b73e3 commit 7cda303
Show file tree
Hide file tree
Showing 25 changed files with 504 additions and 75 deletions.
16 changes: 8 additions & 8 deletions src/main/java/seedu/address/logic/commands/AddTeamCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public class AddTeamCommand extends Command {
public static final String COMMAND_WORD = "/add_team";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Create a team with a name and an optional size, assigned to a particular tutorial class\n"
+ "Parameters: " + PREFIX_MODULECODE + "MODULE_CODE "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS " + PREFIX_NAME + "TEAM_NAME " + PREFIX_TEAM_SIZE + "TEAM_SIZE\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_MODULECODE + "CS2103T "
+ PREFIX_TUTORIALCLASS + "T09 " + PREFIX_NAME + "Team 1 " + PREFIX_TEAM_SIZE + "5";
+ ": Create a team with a name and an optional size, assigned to a particular tutorial class\n"
+ "Parameters: " + PREFIX_MODULECODE + "MODULE_CODE "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS " + PREFIX_NAME + "TEAM_NAME " + PREFIX_TEAM_SIZE + "TEAM_SIZE\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_MODULECODE + "CS2103T "
+ PREFIX_TUTORIALCLASS + "T09 " + PREFIX_NAME + "Team 1 " + PREFIX_TEAM_SIZE + "5";

private final ModuleCode module;
private final TutorialClass tutorialClass;
Expand Down Expand Up @@ -100,7 +100,7 @@ protected ModuleTutorialPair getModuleAndTutorialClass(Model model) throws Comma
}
if (existingTutorialClass == null) {
throw new CommandException(
String.format(ModuleMessages.MESSAGE_TUTORIAL_DOES_NOT_BELONG_TO_MODULE, tutorialClass, module));
String.format(ModuleMessages.MESSAGE_TUTORIAL_DOES_NOT_BELONG_TO_MODULE, tutorialClass, module));
}
return new ModuleTutorialPair(existingModule, existingTutorialClass);
}
Expand All @@ -123,7 +123,7 @@ protected TutorialClass getTutorialClass() {
*/
private String generateSuccessMessage(ModuleCode module, TutorialClass tutorialString, String teamName) {
return String.format(MESSAGE_ADD_TEAM_SUCCESS_WITHOUT_SIZE, teamName, module,
tutorialString);
tutorialString);
}

/**
Expand Down Expand Up @@ -155,4 +155,4 @@ public boolean equals(Object other) {
return module.equals(e.module) && tutorialClass.equals(e.tutorialClass) && teamName.equals(e.teamName)
&& teamSize == e.teamSize;
}
}
}
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package seedu.address.logic.parser;

/**
* Contains Command Line Interface (CLI) syntax definitions common to multiple commands
* Contains Command Line Interface (CLI) syntax definitions common to multiple
* commands
*/
public class CliSyntax {

Expand Down
16 changes: 6 additions & 10 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@
import seedu.address.model.tag.Tag;

/**
* Contains utility methods used for parsing strings in the various *Parser classes.
* Contains utility methods used for parsing strings in the various *Parser
* classes.
*/
public class ParserUtil {

public static final String MESSAGE_INVALID_INDEX = "Index is not a non-zero unsigned integer.";

/**
* Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be
* Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading
* and trailing whitespaces will be
* trimmed.
* @throws ParseException if the specified index is invalid (not non-zero unsigned integer).
* @throws ParseException if the specified index is invalid (not non-zero
* unsigned integer).
*/
public static Index parseIndex(String oneBasedIndex) throws ParseException {
String trimmedIndex = oneBasedIndex.trim();
Expand All @@ -40,7 +43,6 @@ public static Index parseIndex(String oneBasedIndex) throws ParseException {
/**
* Parses a {@code String name} into a {@code Name}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code name} is invalid.
*/
public static Name parseName(String name) throws ParseException {
Expand All @@ -55,7 +57,6 @@ public static Name parseName(String name) throws ParseException {
/**
* Parses a {@code String email} into an {@code Email}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code email} is invalid.
*/
public static Email parseEmail(String email) throws ParseException {
Expand All @@ -70,7 +71,6 @@ public static Email parseEmail(String email) throws ParseException {
/**
* Parses a {@code String studentId} into a {@code StudentId}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code studentId} is invalid.
*/
public static StudentId parseStudentId(String studentId) throws ParseException {
Expand All @@ -85,7 +85,6 @@ public static StudentId parseStudentId(String studentId) throws ParseException {
/**
* Parses a {@code String moduleCode} into an {@code ModuleCode}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code moduleCode} is invalid.
*/
public static ModuleCode parseModuleCode(String moduleCode) throws ParseException {
Expand All @@ -97,11 +96,9 @@ public static ModuleCode parseModuleCode(String moduleCode) throws ParseExceptio
return new ModuleCode(trimmedModuleCode);
}


/**
* Parses a {@code String tutorial} into an {@code TutorialClass}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code tutorial} is invalid.
*/
public static TutorialClass parseTutorialClass(String tutorial) throws ParseException {
Expand All @@ -116,7 +113,6 @@ public static TutorialClass parseTutorialClass(String tutorial) throws ParseExce
/**
* Parses a {@code String tag} into a {@code Tag}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code tag} is invalid.
*/
public static Tag parseTag(String tag) throws ParseException {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/seedu/address/model/module/TutorialClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public TutorialClass(String tutorialClass) {
/**
* A constructor for TutorialClass. Creates a tutorial class with students.
* @param tutorialClass to be added
* @param students in the tutorial class
* @param students in the tutorial class
*/
public TutorialClass(String tutorialClass, ArrayList<Person> students) {
requireAllNonNull(tutorialClass);
Expand Down Expand Up @@ -112,14 +112,15 @@ public ArrayList<Person> getStudents() {

/**
* Adds a student to the tutorial class.
* @param student
*/
public void addStudent(Person student) {
students.add(student);
}

/**
* Removes a student from the tutorial class if it exists.
*
* @param student
* @return true if the student was removed
*/
public boolean deleteStudent(Person student) {
Expand All @@ -141,7 +142,6 @@ public boolean hasStudent(Person student) {
public ArrayList<TutorialTeam> getTeams() {
return this.teams;
}

/**
* Adds a team to the tutorial class.
* @param team
Expand All @@ -157,6 +157,7 @@ public void addTeam(TutorialTeam team) {
public boolean hasTeam(TutorialTeam team) {
return teams.contains(team);
}

@Override
public String toString() {
return tutorialName;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/seedu/address/model/module/TutorialTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
/**
* Represents a Module's tutorial team.
* Guarantees: immutable; is valid as declared in
* {@link #isValidTeamName(String)}
*
*/
public class TutorialTeam {

public static final String MESSAGE_CONSTRAINTS = "Please enter a valid tutorial team name "
+ "eg. Team 1, and it should not be blank";
+ "eg. Team 1, and it should not be blank";
public static final String MESSAGE_NAME_CONSTRAINTS = "Team names should only contain alphanumeric "
+ "characters and spaces, and it should not be blank";
+ "characters and spaces, and it should not be blank";
public static final String MESSAGE_SIZE_CONSTRAINTS = "Team size should be a positive integer";

public static final String VALIDATION_REGEX = "[\\p{Alnum}][\\p{Alnum} ]*";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public JsonAdaptedTutorialClass(@JsonProperty("tutorialName") String tutorialNam
*/
public JsonAdaptedTutorialClass(TutorialClass source) {
this.tutorialName = source.tutorialName;
this.teams = source.getTeams().stream().map(JsonAdaptedTutorialTeam::new).collect(Collectors.toList());
this.students = source.getStudents().stream().map(JsonAdaptedPerson::new).collect(Collectors.toList());
this.teams = source.getTeams().stream().map(JsonAdaptedTutorialTeam::new).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public class JsonAdaptedTutorialTeam {
*/
@JsonCreator
public JsonAdaptedTutorialTeam(@JsonProperty("teamName") String teamName,
<<<<<<< HEAD
@JsonProperty("teamSize") int teamSize,
@JsonProperty("students") List<JsonAdaptedPerson> students) {
=======
@JsonProperty("teamSize") int teamSize,
@JsonProperty("students") List<JsonAdaptedPerson> students) {
>>>>>>> origin/Ui-update
this.teamName = teamName;
this.students = students != null ? new ArrayList<>(students) : new ArrayList<>();
this.teamSize = teamSize;
Expand Down Expand Up @@ -85,6 +90,10 @@ public boolean equals(Object other) {

JsonAdaptedTutorialTeam otherTutorialTeam = (JsonAdaptedTutorialTeam) other;
return teamName.equals(otherTutorialTeam.teamName) && students.equals(otherTutorialTeam.students)
<<<<<<< HEAD
&& teamSize == otherTutorialTeam.teamSize;
=======
&& teamSize == otherTutorialTeam.teamSize;
>>>>>>> origin/Ui-update
}
}
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/ModuleCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ModuleCard(ModuleCode moduleCode) {
* to enhance visual appearance.
*/
public void updateImage() {
Image moduleImage = new Image("images/group4.png");
Image moduleImage = new Image("images/damith3.png");
circle.setStroke(Color.ROSYBROWN);
circle.setFill(new ImagePattern(moduleImage));
circle.setEffect(new DropShadow(+10d, 0d, +2d, Color.ROSYBROWN));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void updateImage() {
String path = "images/" + person.getName().toString() + ".png";
File file = new File(path);
if (!file.exists()) {
Image defaultImage = new Image("images/student.png");
Image defaultImage = new Image("images/damith1.png");
circle.setStroke(Color.ROSYBROWN);
circle.setFill(new ImagePattern(defaultImage));
circle.setEffect(new DropShadow(+10d, 0d, +2d, Color.ROSYBROWN));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/TutorialClassCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public TutorialClassCard(TutorialClass tutorialClass) {
* to the circle for enhanced visual appearance.
*/
public void updateImage() {
Image moduleImage = new Image("images/class.png");
Image moduleImage = new Image("images/damith2.png");
circle.setStroke(Color.ROSYBROWN);
circle.setFill(new ImagePattern(moduleImage));
circle.setEffect(new DropShadow(+10d, 0d, +2d, Color.ROSYBROWN));
Expand Down
Binary file added src/main/resources/images/damith1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/damith2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/damith3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 54 additions & 43 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.Scene?>
Expand All @@ -10,11 +9,11 @@
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>

<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.layout.HBox?>

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="Address App" minWidth="500" minHeight="500" onCloseRequest="#handleExit">
title="Address App" minWidth="0" minHeight="0" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand All @@ -24,58 +23,70 @@
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
</stylesheets>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<top>
<MenuBar fx:id="menuBar" VBox.vgrow="ALWAYS">
<Menu mnemonicParsing="false" text="File">
<MenuItem mnemonicParsing="false" onAction="#handleExit" text="Exit"/>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" />
</Menu>
</MenuBar>
</top>
<center>
<SplitPane dividerPositions="0.33, 0.67">
<items>
<!-- Add a new VBox for the module list panel -->
<VBox fx:id="moduleList" minWidth="300" prefWidth="300" minHeight="460" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1" HBox.hgrow="ALWAYS">
<top>
<MenuBar fx:id="menuBar" VBox.vgrow="NEVER">
<Menu mnemonicParsing="false" text="File">
<MenuItem mnemonicParsing="false" onAction="#handleExit" text="Exit"/>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" />
</Menu>
</MenuBar>
</top>
<center>
<SplitPane dividerPositions="0.33, 0.67" HBox.hgrow="ALWAYS" prefHeight="-1" prefWidth="-1">
<items>
<HBox maxHeight="Infinity" prefHeight="-Infinity" maxWidth="Infinity" prefWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox fx:id="moduleList" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" HBox.hgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<!-- Placeholder for the ModuleListPanel -->
<StackPane fx:id="moduleListPanelPlaceholder" maxHeight="600"/>
<StackPane fx:id="moduleListPanelPlaceholder" maxHeight="Infinity" prefWidth="-Infinity" VBox.vgrow="ALWAYS"/>
</VBox>
<VBox fx:id="tutoriallist" minWidth="300" prefWidth="300" minHeight="460" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
</children>
</HBox>
<HBox maxHeight="Infinity" prefHeight="-Infinity" maxWidth="Infinity" prefWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox fx:id="tutoriallist" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" HBox.hgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<!-- Placeholder for the TutorialListPanel -->
<StackPane fx:id="tutorialListPanelPlaceholder" maxHeight="600"/>
<StackPane fx:id="tutorialListPanelPlaceholder" maxHeight="Infinity" prefWidth="-Infinity" VBox.vgrow="ALWAYS"/>
</VBox>
<VBox fx:id="personList" minWidth="300" prefWidth="300" minHeight="460" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
</children>
</HBox>
<HBox maxHeight="Infinity" prefHeight="-Infinity" maxWidth="Infinity" prefWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox fx:id="personList" spacing="5"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" HBox.hgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" maxHeight="600"/>
<StackPane fx:id="personListPanelPlaceholder" maxHeight="Infinity" prefWidth="-Infinity" VBox.vgrow="ALWAYS"/>
</VBox>
</items>
</SplitPane>
</center>
<bottom>
<VBox prefHeight="111.0" prefWidth="604.0" BorderPane.alignment="CENTER">
<children>
<StackPane fx:id="resultDisplayPlaceholder" minHeight="140" prefHeight="140.0"
prefWidth="200.0"/>
<StackPane fx:id="commandBoxPlaceholder" prefHeight="150.0" prefWidth="200.0"/>
</children>
</VBox>
</bottom>
</HBox>
</items>
</SplitPane>
</center>
<bottom>
<VBox prefHeight="111.0" prefWidth="604.0" BorderPane.alignment="CENTER">
<children>
<StackPane fx:id="resultDisplayPlaceholder" minHeight="140" prefHeight="140.0"
prefWidth="200.0" VBox.vgrow="NEVER"/>
<StackPane fx:id="commandBoxPlaceholder" prefHeight="150.0" prefWidth="200.0" VBox.vgrow="NEVER"/>
</children>
</VBox>
</bottom>
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</BorderPane>
</Scene>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/**
* Contains integration tests (interaction with the Model) for
* {@code AddCommand}.
* {@code AddStudentToClassCommand}.
*/
public class AddStudentToClassCommandIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

/**
* Contains integration tests (interaction with the Model) and unit tests for
* {@code DeleteCommand}.
* {@code AddStudentToClassCommand}.
*/
public class AddStudentToClassCommandTest {

Expand Down
Loading

0 comments on commit 7cda303

Please sign in to comment.