diff --git a/src/main/java/seedu/address/commons/util/FileUtil.java b/src/main/java/seedu/address/commons/util/FileUtil.java index 36cdfe6f4cd3..1fc57a5015a7 100644 --- a/src/main/java/seedu/address/commons/util/FileUtil.java +++ b/src/main/java/seedu/address/commons/util/FileUtil.java @@ -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"); } } diff --git a/src/main/java/seedu/address/ui/BrowserPanel.java b/src/main/java/seedu/address/ui/BrowserPanel.java index cf09770f24f4..f7f2a24c96a2 100644 --- a/src/main/java/seedu/address/ui/BrowserPanel.java +++ b/src/main/java/seedu/address/ui/BrowserPanel.java @@ -19,6 +19,13 @@ */ public class BrowserPanel extends UiPart { + 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()); @@ -41,7 +48,8 @@ public BrowserPanel(ObservableValue 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); @@ -51,35 +59,42 @@ public BrowserPanel(ObservableValue 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."); @@ -87,8 +102,6 @@ private void showApparelDetails(Apparel apparel) { 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()); diff --git a/src/main/resources/images/default_welcome_smiley_icon.png b/src/main/resources/images/default_welcome_smiley_icon.png new file mode 100644 index 000000000000..e9b3812f0476 Binary files /dev/null and b/src/main/resources/images/default_welcome_smiley_icon.png differ diff --git a/src/main/resources/view/BrowserPanel.fxml b/src/main/resources/view/BrowserPanel.fxml index f995143217bb..a24526594233 100644 --- a/src/main/resources/view/BrowserPanel.fxml +++ b/src/main/resources/view/BrowserPanel.fxml @@ -2,6 +2,7 @@ + @@ -9,16 +10,14 @@ - - - + + - + - + @@ -43,7 +42,7 @@