Skip to content

Commit

Permalink
Merge branch 'master' into mainWindowUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
rafflesandrison authored Apr 13, 2019
2 parents 3f9a909 + b930aa0 commit 3857830
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 191 deletions.
112 changes: 56 additions & 56 deletions src/main/java/seedu/address/commons/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,80 +85,80 @@ public static void writeToFile(Path file, String content) throws IOException {

public static String getBeltIconFilePath(ColorValue color) {
switch(color) {
case BLACK: return "images/belt_icon/belt-black.PNG";
case BLUE: return "images/belt_icon/belt-blue.PNG";
case BROWN: return "images/belt_icon/belt-brown.PNG";
case CREAM: return "images/belt_icon/belt-cream.PNG";
case GREEN: return "images/belt_icon/belt-green.PNG";
case GREY: return "images/belt_icon/belt-grey.PNG";
case KHAKI: return "images/belt_icon/belt-khaki.PNG";
case NAVY: return "images/belt_icon/belt-navy.PNG";
case ORANGE: return "images/belt_icon/belt-orange.PNG";
case PINK: return "images/belt_icon/belt-pink.PNG";
case PURPLE: return "images/belt_icon/belt-purple.PNG";
case RED: return "images/belt_icon/belt-red.PNG";
case WHITE: return "images/belt_icon/belt-white.PNG";
case YELLOW: return "images/belt_icon/belt-yellow.PNG";
case BLACK: return "/images/belt_icon/belt-black.PNG";
case BLUE: return "/images/belt_icon/belt-blue.PNG";
case BROWN: return "/images/belt_icon/belt-brown.PNG";
case CREAM: return "/images/belt_icon/belt-cream.PNG";
case GREEN: return "/images/belt_icon/belt-green.PNG";
case GREY: return "/images/belt_icon/belt-grey.PNG";
case KHAKI: return "/images/belt_icon/belt-khaki.PNG";
case NAVY: return "/images/belt_icon/belt-navy.PNG";
case ORANGE: return "/images/belt_icon/belt-orange.PNG";
case PINK: return "/images/belt_icon/belt-pink.PNG";
case PURPLE: return "/images/belt_icon/belt-purple.PNG";
case RED: return "/images/belt_icon/belt-red.PNG";
case WHITE: return "/images/belt_icon/belt-white.PNG";
case YELLOW: return "/images/belt_icon/belt-yellow.PNG";
default: throw new IllegalArgumentException("No such color");
}
}

public static String getBottomIconFilePath(ColorValue color) {
switch(color) {
case BLACK: return "images/bottom_icon/bottom-black.PNG";
case BLUE: return "images/bottom_icon/bottom-blue.PNG";
case BROWN: return "images/bottom_icon/bottom-brown.PNG";
case CREAM: return "images/bottom_icon/bottom-cream.PNG";
case GREEN: return "images/bottom_icon/bottom-green.PNG";
case GREY: return "images/bottom_icon/bottom-grey.PNG";
case KHAKI: return "images/bottom_icon/bottom-khaki.PNG";
case NAVY: return "images/bottom_icon/bottom-navy.PNG";
case ORANGE: return "images/bottom_icon/bottom-orange.PNG";
case PINK: return "images/bottom_icon/bottom-pink.PNG";
case PURPLE: return "images/bottom_icon/bottom-purple.PNG";
case RED: return "images/bottom_icon/bottom-red.PNG";
case WHITE: return "images/bottom_icon/bottom-white.PNG";
case YELLOW: return "images/bottom_icon/bottom-yellow.PNG";
case BLACK: return "/images/bottom_icon/bottom-black.PNG";
case BLUE: return "/images/bottom_icon/bottom-blue.PNG";
case BROWN: return "/images/bottom_icon/bottom-brown.PNG";
case CREAM: return "/images/bottom_icon/bottom-cream.PNG";
case GREEN: return "/images/bottom_icon/bottom-green.PNG";
case GREY: return "/images/bottom_icon/bottom-grey.PNG";
case KHAKI: return "/images/bottom_icon/bottom-khaki.PNG";
case NAVY: return "/images/bottom_icon/bottom-navy.PNG";
case ORANGE: return "/images/bottom_icon/bottom-orange.PNG";
case PINK: return "/images/bottom_icon/bottom-pink.PNG";
case PURPLE: return "/images/bottom_icon/bottom-purple.PNG";
case RED: return "/images/bottom_icon/bottom-red.PNG";
case WHITE: return "/images/bottom_icon/bottom-white.PNG";
case YELLOW: return "/images/bottom_icon/bottom-yellow.PNG";
default: throw new IllegalArgumentException("No such color");
}
}

public static String getShoeIconFilePath(ColorValue color) {
switch(color) {
case BLACK: return "images/shoes_icon/shoes-black.PNG";
case BLUE: return "images/shoes_icon/shoes-blue.PNG";
case BROWN: return "images/shoes_icon/shoes-brown.PNG";
case CREAM: return "images/shoes_icon/shoes-cream.PNG";
case GREEN: return "images/shoes_icon/shoes-green.PNG";
case GREY: return "images/shoes_icon/shoes-grey.PNG";
case KHAKI: return "images/shoes_icon/shoes-khaki.PNG";
case NAVY: return "images/shoes_icon/shoes-navy.PNG";
case ORANGE: return "images/shoes_icon/shoes-orange.PNG";
case PINK: return "images/shoes_icon/shoes-pink.PNG";
case PURPLE: return "images/shoes_icon/shoes-purple.PNG";
case RED: return "images/shoes_icon/shoes-red.PNG";
case WHITE: return "images/shoes_icon/shoes-white.PNG";
case YELLOW: return "images/shoes_icon/shoes-yellow.PNG";
case BLACK: return "/images/shoes_icon/shoes-black.PNG";
case BLUE: return "/images/shoes_icon/shoes-blue.PNG";
case BROWN: return "/images/shoes_icon/shoes-brown.PNG";
case CREAM: return "/images/shoes_icon/shoes-cream.PNG";
case GREEN: return "/images/shoes_icon/shoes-green.PNG";
case GREY: return "/images/shoes_icon/shoes-grey.PNG";
case KHAKI: return "/images/shoes_icon/shoes-khaki.PNG";
case NAVY: return "/images/shoes_icon/shoes-navy.PNG";
case ORANGE: return "/images/shoes_icon/shoes-orange.PNG";
case PINK: return "/images/shoes_icon/shoes-pink.PNG";
case PURPLE: return "/images/shoes_icon/shoes-purple.PNG";
case RED: return "/images/shoes_icon/shoes-red.PNG";
case WHITE: return "/images/shoes_icon/shoes-white.PNG";
case YELLOW: return "/images/shoes_icon/shoes-yellow.PNG";
default: throw new IllegalArgumentException("No such color");
}
}

public static String getTopIconFilePath(ColorValue color) {
switch(color) {
case BLACK: return "images/top_icon/top-black.PNG";
case BLUE: return "images/top_icon/top-blue.PNG";
case BROWN: return "images/top_icon/top-brown.PNG";
case CREAM: return "images/top_icon/top-cream.PNG";
case GREEN: return "images/top_icon/top-green.PNG";
case GREY: return "images/top_icon/top-grey.PNG";
case KHAKI: return "images/top_icon/top-khaki.PNG";
case NAVY: return "images/top_icon/top-navy.PNG";
case ORANGE: return "images/top_icon/top-orange.PNG";
case PINK: return "images/top_icon/top-pink.PNG";
case PURPLE: return "images/top_icon/top-purple.PNG";
case RED: return "images/top_icon/top-red.PNG";
case WHITE: return "images/top_icon/top-white.PNG";
case YELLOW: return "images/top_icon/top-yellow.PNG";
case BLACK: return "/images/top_icon/top-black.PNG";
case BLUE: return "/images/top_icon/top-blue.PNG";
case BROWN: return "/images/top_icon/top-brown.PNG";
case CREAM: return "/images/top_icon/top-cream.PNG";
case GREEN: return "/images/top_icon/top-green.PNG";
case GREY: return "/images/top_icon/top-grey.PNG";
case KHAKI: return "/images/top_icon/top-khaki.PNG";
case NAVY: return "/images/top_icon/top-navy.PNG";
case ORANGE: return "/images/top_icon/top-orange.PNG";
case PINK: return "/images/top_icon/top-pink.PNG";
case PURPLE: return "/images/top_icon/top-purple.PNG";
case RED: return "/images/top_icon/top-red.PNG";
case WHITE: return "/images/top_icon/top-white.PNG";
case YELLOW: return "/images/top_icon/top-yellow.PNG";
default: throw new IllegalArgumentException("No such color");
}
}
Expand Down
41 changes: 27 additions & 14 deletions src/main/java/seedu/address/ui/BrowserPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
*/
public class BrowserPanel extends UiPart<Region> {

public static final String DEFAULT_IMAGE_PATH = "/images/default_welcome_smiley_icon.png";
public static final String DEFAULT_NAME_LABEL = "Select an apparel";
public static final String DEFAULT_CLOTHING_TYPE_LABEL = "to";
public static final String DEFAULT_COLOR_LABEL = "display";
public static final String DEFAULT_USAGE_COUNT_LABEL = "an";
public static final String DEFAULT_STATUS_LABEL = "apparel";

private static final String FXML = "BrowserPanel.fxml";

private final Logger logger = LogsCenter.getLogger(getClass());
Expand All @@ -41,7 +48,8 @@ public BrowserPanel(ObservableValue<Apparel> selectedApparel) {

// To prevent triggering events for typing inside the loaded Web page.
getRoot().setOnKeyPressed(Event::consume);

// Show default screen
showApparelDetails(null);
selectedApparel.addListener((observable, oldValue, newValue) -> {
if (newValue == null) {
showApparelDetails(null);
Expand All @@ -51,44 +59,49 @@ public BrowserPanel(ObservableValue<Apparel> selectedApparel) {
});
}


/**
* Fill all text fields to show details about the apparel.
* If the specified apparel is null, all text fields are cleared.
*/
private void showApparelDetails(Apparel apparel) {
public void showApparelDetails(Apparel apparel) {

if (apparel == null) {
nameLabel.setText("Click");
clothingTypeLabel.setText("to");
colorLabel.setText("display");
statusLabel.setText("an");
usageCountLabel.setText("apparel");
nameLabel.setText(DEFAULT_NAME_LABEL);
clothingTypeLabel.setText(DEFAULT_CLOTHING_TYPE_LABEL);
colorLabel.setText(DEFAULT_COLOR_LABEL);
statusLabel.setText(DEFAULT_STATUS_LABEL);
usageCountLabel.setText(DEFAULT_USAGE_COUNT_LABEL);

// set to default spalsh image when the list is empty
Image image = new Image(getClass().getResource(DEFAULT_IMAGE_PATH).toString());
apparelImageView.setImage(image);
} else {
// Fill the image
Image image;
ColorValue cv = apparel.getColor().getPrimary();
switch(apparel.getClothingType().getClothingTypeValue()) {
case TOP:
image = new Image(FileUtil.getTopIconFilePath(cv));
image = new Image(getClass()
.getResource(FileUtil.getTopIconFilePath(cv)).toString(), true);
break;
case BOTTOM:
image = new Image(FileUtil.getBottomIconFilePath(cv));
image = new Image(getClass()
.getResource(FileUtil.getBottomIconFilePath(cv)).toString(), true);
break;
case BELT:
image = new Image(FileUtil.getBeltIconFilePath(cv));
image = new Image(getClass()
.getResource(FileUtil.getBeltIconFilePath(cv)).toString(), true);
break;
case SHOES:
image = new Image(FileUtil.getShoeIconFilePath(cv));
image = new Image(getClass()
.getResource(FileUtil.getShoeIconFilePath(cv)).toString(), true);
break;
default:
throw new IllegalArgumentException("No such clothing type.");
}
apparelImageView.setImage(image);

// Fill the labels with info from the apparel Object
System.out.println("apparel = " + apparel.toString());
System.out.println("apparel usage = " + apparel.getUsageCount());
nameLabel.setText(apparel.getName().fullName);
clothingTypeLabel.setText(apparel.getClothingType().toString());
colorLabel.setText(apparel.getColor().toString());
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions src/main/resources/view/BrowserPanel.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>

<?import javafx.scene.image.Image?>
<StackPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<SplitPane dividerPositions="0.65" orientation="HORIZONTAL" prefHeight="600.0" prefWidth="800.0">
<StackPane xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1">
<SplitPane fx:id="browserApparelPane" dividerPositions="0.65" orientation="HORIZONTAL" prefHeight="600.0" prefWidth="800.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<ImageView fx:id="apparelImageView" fitHeight="300.0" fitWidth="400.0" layoutX="299.0" layoutY="73.0" pickOnBounds="true" preserveRatio="true"
AnchorPane.leftAnchor="30.0" AnchorPane.rightAnchor="30.0" AnchorPane.topAnchor="50.0" AnchorPane.bottomAnchor="50.0" >
<ImageView fx:id="apparelImageView" fitWidth="500.0" layoutX="299.0" layoutY="73.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="179.64556884765625" AnchorPane.leftAnchor="100.0" AnchorPane.topAnchor="50.0">
<image>
<Image url="/images/test.jpg"></Image>
<Image url="/images/default_welcome_smiley_icon.png" />
</image>
</ImageView>
</children>
Expand All @@ -43,7 +42,7 @@
<Label text="COLOR:" GridPane.rowIndex="2" />
<Label text="STATUS:" GridPane.rowIndex="3" />
<Label text="TIMES WORN:" GridPane.rowIndex="4" />
<Label fx:id="nameLabel" text="Click" GridPane.columnIndex="1" />
<Label fx:id="nameLabel" text="Select an apparel" GridPane.columnIndex="1" />
<Label fx:id="clothingTypeLabel" text="to" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label fx:id="colorLabel" text="display" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label fx:id="statusLabel" text="an" GridPane.columnIndex="1" GridPane.rowIndex="3" />
Expand Down
93 changes: 46 additions & 47 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,56 @@

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
title="Fashion Match" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
<scene>
<Scene>
<stylesheets>
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
</stylesheets>
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
<scene>
<Scene>
<stylesheets>
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
</stylesheets>

<VBox>
<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>
<VBox>
<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>

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

<SplitPane id="splitPane" fx:id="splitPane" dividerPositions="0.4" VBox.vgrow="ALWAYS">
<StackPane fx:id="browserPlaceholder" prefWidth="340" >
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
</StackPane>
<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="250" prefHeight="250" maxHeight="250">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>

<VBox fx:id="personList" minWidth="340" prefWidth="340" SplitPane.resizableWithParent="false">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
</SplitPane>

<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>
<SplitPane id="splitPane" fx:id="splitPane" dividerPositions="0.4" VBox.vgrow="ALWAYS">
<VBox fx:id="personList" minWidth="340" prefWidth="340" SplitPane.resizableWithParent="false">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="200" prefHeight="200" maxHeight="200">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>
<StackPane fx:id="browserPlaceholder" prefWidth="340" >
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
</StackPane>
</SplitPane>

<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
</Scene>
</scene>
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
</Scene>
</scene>
</fx:root>
Loading

0 comments on commit 3857830

Please sign in to comment.