Skip to content

Commit

Permalink
Merge pull request #61 from H4mes/branch-SideBySide
Browse files Browse the repository at this point in the history
Display articles and persons panes side-by-side
  • Loading branch information
Howlong11 authored Mar 28, 2024
2 parents fdaebf1 + d9307fb commit 2a54e18
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public AddArticleCommand parse(String args) throws ParseException {
ArgumentTokenizer.tokenize(args, PREFIX_TITLE, PREFIX_AUTHOR, PREFIX_PUBLICATION_DATE, PREFIX_SOURCE,
PREFIX_ARTICLETAG, PREFIX_STATUS);
//Temporarily reinstate source requirement
if (!arePrefixesPresent(argMultimap, PREFIX_TITLE, PREFIX_AUTHOR, PREFIX_PUBLICATION_DATE, PREFIX_SOURCE,
PREFIX_ARTICLETAG, PREFIX_STATUS) || !argMultimap.getPreamble().isEmpty()) {
if (!arePrefixesPresent(argMultimap, PREFIX_TITLE, PREFIX_PUBLICATION_DATE, PREFIX_STATUS)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddArticleCommand.MESSAGE_USAGE));
}

Expand Down
15 changes: 7 additions & 8 deletions src/main/java/seedu/address/storage/JsonAdaptedArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public JsonAdaptedArticle(Article sourceArticle) {
* @throws IllegalValueException if data constraints are violated
*/
public Article toModelType() throws IllegalValueException {
if (title == null) {
throw new IllegalValueException("The title is missing");
}
if (status == null) {
throw new IllegalValueException("The status is missing");
}

final List<Tag> articleTags = new ArrayList<>();
for (JsonAdaptedTag tag : tags) {
articleTags.add(tag.toModelType());
Expand All @@ -96,16 +103,8 @@ public Article toModelType() throws IllegalValueException {
articleSources.add(source.toModelType());
}

if (title == null) {
throw new IllegalValueException("The title is missing");
}

final Set<Author> modelAuthors = new HashSet<>(articleAuthors);

if (publicationDate == null) {
throw new IllegalValueException("The publication date is invalid");
}

final Set<Source> modelSources = new HashSet<>(articleSources);

final Set<Tag> modelTags = new HashSet<>(articleTags);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javafx.scene.control.TextInputControl;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import seedu.address.commons.core.GuiSettings;
Expand All @@ -31,6 +32,7 @@ public class MainWindow extends UiPart<Stage> {
private Logic logic;

// Independent Ui parts residing in this Ui container
private GridPane listPanelContainer;
private PersonListPanel personListPanel;
private ArticleListPanel articleListPanel;
private ResultDisplay resultDisplay;
Expand Down
52 changes: 30 additions & 22 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="PressPlanner" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
<fx:root minHeight="600" minWidth="450" onCloseRequest="#handleExit" title="PressPlanner" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand All @@ -33,33 +35,39 @@
</Menu>
</MenuBar>

<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<StackPane fx:id="commandBoxPlaceholder" styleClass="pane-with-border" VBox.vgrow="NEVER">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
<Insets bottom="5" left="10" right="10" top="5" />
</padding>
</StackPane>

<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="100" prefHeight="100" maxHeight="100">
<StackPane fx:id="resultDisplayPlaceholder" maxHeight="100" minHeight="100" prefHeight="100" styleClass="pane-with-border" VBox.vgrow="NEVER">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
<Insets bottom="5" left="10" right="10" top="5" />
</padding>
</StackPane>
<GridPane fx:id="listPanelContainer" VBox.vgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" />
<ColumnConstraints hgrow="ALWAYS" />
</columnConstraints>
<VBox fx:id="personList" minWidth="340" prefWidth="340" styleClass="pane-with-border" GridPane.columnIndex="0" GridPane.vgrow="ALWAYS" VBox.vgrow="ALWAYS">
<padding>
<Insets bottom="10" left="10" right="10" top="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS" />
</VBox>

<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<VBox fx:id="articleList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="articleListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<VBox fx:id="articleList" minWidth="340" prefWidth="340" styleClass="pane-with-border" GridPane.columnIndex="1" GridPane.vgrow="ALWAYS" VBox.vgrow="ALWAYS">
<padding>
<Insets bottom="10" left="10" right="10" top="10" />
</padding>
<StackPane fx:id="articleListPanelPlaceholder" VBox.vgrow="ALWAYS" />
</VBox>
<rowConstraints>
<RowConstraints />
</rowConstraints>
</GridPane>
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
</Scene>
Expand Down

0 comments on commit 2a54e18

Please sign in to comment.