forked from AY2324S1-CS2103T-T13-0/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 AY2324S1-CS2103T-T13-0#98 from xCOLOURx/branch-ui-…
…javafx Update JavaFx UI with ModulePlan
- Loading branch information
Showing
9 changed files
with
200 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package seedu.address.ui; | ||
|
||
import java.util.Comparator; | ||
|
||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.layout.FlowPane; | ||
import javafx.scene.layout.Region; | ||
import javafx.scene.layout.VBox; | ||
|
||
|
||
|
||
public class ModulePlanCard extends UiPart<Region> { | ||
|
||
private static final String FXML = "ModulePlanCard.fxml"; | ||
|
||
|
||
//TODO uncomment when ModulePlan is added. | ||
//public final ModulePlan modulePlanSemester; | ||
|
||
@FXML | ||
private VBox modulePlanCardPane; | ||
@FXML | ||
private Label semester; | ||
@FXML | ||
private FlowPane modules; | ||
|
||
|
||
|
||
/** | ||
* Creates a {@code PersonCode} with the given {@code Person} and index to display. | ||
*/ | ||
public ModulePlanCard(String semester) { | ||
super(FXML); | ||
|
||
//Placeholder text | ||
this.semester.setText(semester); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
modules.getChildren().add(new Label("CS2103")); | ||
|
||
|
||
//TODO | ||
// this.modulePlanSemester = modulePlanSemester; | ||
// modulePlanSemester.getTags().stream() | ||
// .sorted(Comparator.comparing(tag -> tag.tagName)) | ||
// .forEach(tag -> modules.getChildren().add(new Label(tag.tagName))); | ||
} | ||
} |
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,57 @@ | ||
package seedu.address.ui; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.ListCell; | ||
import javafx.scene.control.ListView; | ||
import javafx.scene.layout.Region; | ||
import seedu.address.commons.core.LogsCenter; | ||
import seedu.address.model.person.Person; | ||
|
||
/** | ||
* Panel containing the list of persons. | ||
*/ | ||
public class ModulePlanPanel extends UiPart<Region> { | ||
private static final String FXML = "ModulePlanPanel.fxml"; | ||
private final Logger logger = LogsCenter.getLogger(ModulePlanPanel.class); | ||
|
||
//TODO modify class. | ||
@FXML | ||
private ListView<String> modulePlanView; | ||
|
||
/** | ||
* Creates a {@code PersonListPanel} with the given {@code ObservableList}. | ||
*/ | ||
public ModulePlanPanel(/*ObservableList<ModulePlan> modulePlan*/) { | ||
super(FXML); | ||
|
||
//Placeholder values | ||
ObservableList<String> items = FXCollections.observableArrayList("Y1S1", "Y1S2", "Y2S1", "Y2S2", "Y3S1", "Y3S2", "Y4S1", "Y4S2"); | ||
|
||
modulePlanView.setItems(items); | ||
modulePlanView.setCellFactory(listView -> new ModulePlanViewCell()); | ||
} | ||
|
||
/** | ||
* Custom {@code ListCell} that displays the graphics of a {@code Person} using a {@code PersonCard}. | ||
*/ | ||
class ModulePlanViewCell extends ListCell<String> { | ||
@Override | ||
protected void updateItem(String string, boolean empty) { | ||
super.updateItem(string, empty); | ||
|
||
if (empty || string == null) { | ||
setGraphic(null); | ||
setText(null); | ||
} else { | ||
//Todo change constructor params | ||
ModulePlanCard m = new ModulePlanCard(string); | ||
setGraphic(m.getRoot()); | ||
} | ||
} | ||
} | ||
|
||
} |
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,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.FlowPane?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
<?import javafx.scene.layout.VBox?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
<VBox id="cardPane" fx:id="modulePlanCardPane" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1"> | ||
<children> | ||
<GridPane VBox.vgrow="ALWAYS"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150" /> | ||
</columnConstraints> | ||
<children> | ||
<VBox alignment="TOP_CENTER" minHeight="105" GridPane.columnIndex="0" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS"> | ||
<padding> | ||
<Insets bottom="5" left="15" right="5" top="5" /> | ||
</padding> | ||
<children> | ||
<Label fx:id="semester" styleClass="cell_big_label" text="\$semester"> | ||
<font> | ||
<Font size="14.0" /> | ||
</font> | ||
<VBox.margin> | ||
<Insets bottom="10.0" /> | ||
</VBox.margin> | ||
</Label> | ||
<FlowPane fx:id="modules" alignment="TOP_CENTER" columnHalignment="CENTER" orientation="VERTICAL" prefWrapLength="100.0" rowValignment="TOP" vgap="5.0" VBox.vgrow="ALWAYS" /> | ||
</children> | ||
</VBox> | ||
</children> | ||
<rowConstraints> | ||
<RowConstraints /> | ||
</rowConstraints> | ||
</GridPane> | ||
</children> | ||
</VBox> |
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.ListView?> | ||
<?import javafx.scene.layout.HBox?> | ||
|
||
<HBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"> | ||
<ListView fx:id="modulePlanView" orientation="HORIZONTAL" HBox.hgrow="ALWAYS" /> | ||
</HBox> |
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