Skip to content

Commit

Permalink
come on!
Browse files Browse the repository at this point in the history
  • Loading branch information
vahovahovah committed Jun 26, 2020
1 parent e80bffb commit e9a28de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/graphics/ProductAdsThumb.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@ public void setProduct(Product product) {
}

public void initialize () {
Image productImage = product.getProductImage();
image.setImage(productImage);
name.setText(product.getName());
price.setText(String.valueOf(product.getPrice()));
if (product.hasOff()) {
offImage.setImage(new Image(Paths.get("src/main/resources/images/offImage.png").toUri().toString()));
offLabel.setText(getOffPercentage() + "% OFF!");
offLabel.setVisible(true);
offImage.setVisible(true);
if (product != null) {
Image productImage = product.getProductImage();
image.setImage(productImage);
name.setText(product.getName());
price.setText(String.valueOf(product.getPrice()));
if (product.hasOff()) {
offImage.setImage(new Image(Paths.get("src/main/resources/images/offImage.png").toUri().toString()));
offLabel.setText(getOffPercentage() + "% OFF!");
offLabel.setVisible(true);
offImage.setVisible(true);
}
} else {
image.setImage(new Image("src/main/resources/images/shop-logo.png"));
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/graphics/SlideShow.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public void handle(MouseEvent event) {
}

public void initialize() throws InterruptedException, IOException {
if (Database.getAllProductAds().size() == 0) {
addPage(null);
}
for (Product product : Database.getAllProductAds()) {
addPage(new ProductAdsThumb(product));
}
Expand Down

0 comments on commit e9a28de

Please sign in to comment.