Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void priceTotal(ActionEvent event) throws IOException{
- FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/Shops.fxml"));
- Parent root = loader.load();
- Stage stage = new Stage();
- stage.setScene(new Scene(root));
- ShopController controller = loader.getController();
- List<Product> listProducts = new ArrayList<Product>();
- for (Product product : productList) {
- listProducts.add(product);
- }
- ShopProductDataAccessor spda = new ShopProductDataAccessor();
- List<ShopPriceView> lst_shops = spda.getShopsForShopping(listProducts);
- ObservableList<ShopPriceView> shopList = FXCollections.observableArrayList(lst_shops);
- controller.setShopList(shopList);
- stage.show();
- }
- /** Après avoir sélectionné un produit dans le menu déroulant, ouvre une
- * view qui affiche tous les magasins avec le prix du produit sélectionné */
- public void checkPrice(ActionEvent event) throws IOException{
- if(!(textNumber.getText().length()>0 && ingredientList.getSelectionModel().getSelectedItem()!=null)){
- Alert alert = new Alert(AlertType.ERROR);
- alert.setTitle("Error Dialog");
- alert.setHeaderText("Error");
- alert.setContentText("Please enter value");
- alert.showAndWait();
- }
- else{
- FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/Shops.fxml"));
- Parent root = loader.load();
- Stage stage = new Stage();
- stage.setScene(new Scene(root));
- ShopController controller = loader.getController();
- // HARDCODING
- ShopProductDataAccessor op = new ShopProductDataAccessor();
- List<ShopPriceView> shopz = op.selectShopsWhereProdExists(new Product(ingredientList.getSelectionModel().getSelectedItem(), op.getUnitOfProduct(ingredientList.getSelectionModel().getSelectedItem()), Integer.valueOf(textNumber.getText())));
- ObservableList<ShopPriceView> slist = FXCollections.observableArrayList(shopz);
- controller.setShopList(slist);
- stage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement