Skip to content

Commit

Permalink
Merge pull request #112 from Originalidk/branch-assignment-feature
Browse files Browse the repository at this point in the history
Add individual assignment list person index
  • Loading branch information
Originalidk authored Oct 28, 2023
2 parents 295c48f + e2f82c3 commit b735c14
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.exceptions.ParseException;
Expand Down Expand Up @@ -53,6 +54,9 @@ public interface Logic {
/** Returns an unmodifiable view of all assignments */
ObservableList<Assignment> getAssignments();

/** Returns the index of the student whose list of assignments was last displayed */
Index getIndex();

/**
* Returns the user prefs' address book file path.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public ObservableList<Assignment> getAssignments() {
return assignmentList;
}

@Override
public Index getIndex() {
return this.indexToDisplay;
}

@Override
public Path getAddressBookFilePath() {
return model.getAddressBookFilePath();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextInputControl;
import javafx.scene.input.KeyCombination;
Expand Down Expand Up @@ -69,6 +70,9 @@ public class MainWindow extends UiPart<Stage> {
@FXML
private StackPane statusbarPlaceholder;

@FXML
private Label assignmentListLabel;

/**
* Creates a {@code MainWindow} with the given {@code Stage} and {@code Logic}.
*/
Expand Down Expand Up @@ -143,6 +147,7 @@ void fillInnerParts() {

assignmentNameListPanel = new AssignmentNameListPanel(logic.getAssignmentNameList());
assignmentListPanelPlaceholder.getChildren().add(assignmentNameListPanel.getRoot());
assignmentListLabel.setText("Assignment List");

resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
Expand Down Expand Up @@ -226,13 +231,15 @@ private CommandResult executeCommand(String commandText) throws CommandException

if (commandResult.isAssignmentNames()) {
showAssignmentNames();
assignmentListLabel.setText("Assignment List");
}

boolean isAssignmentNames =
assignmentListPanelPlaceholder.getChildren().get(0).equals(assignmentNameListPanel.getRoot());

if (!isAssignmentNames || commandResult.isPersonAssignments()) {
showStudentAssignments(logic.getAssignments());
assignmentListLabel.setText("Assignment List: Person " + logic.getIndex().getOneBased());
}

if (commandResult.isShowHelp()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</VBox>

<VBox fx:id="assignmentList" minWidth="300" prefWidth="300" VBox.vgrow="ALWAYS" HBox.hgrow="ALWAYS">
<Label text="Assignment List" maxWidth="Infinity" wrapText="true" styleClass="section-label"/>
<Label fx:id="assignmentListLabel" text="\$assignmentListLabel" maxWidth="Infinity" wrapText="true" styleClass="section-label"/>
<StackPane VBox.vgrow="ALWAYS" fx:id="assignmentListPanelPlaceholder" />
</VBox>
</HBox>
Expand Down

0 comments on commit b735c14

Please sign in to comment.