public BorderPane viewStockDrinkList(final ObservableList<CategoryVO> listCategory) { final BorderPane borderPane = new BorderPane(); borderPane.setMinWidth(Screen.getPrimary().getVisualBounds().getWidth()); borderPane.setMinHeight(Screen.getPrimary().getVisualBounds().getHeight()); borderPane.setPadding(new Insets(15, 0, 0, 20)); borderPane.setId("borderxx"); GridPane typesOfDrink = new GridPane(); typesOfDrink.setVgap(20); typesOfDrink.setPadding(new Insets(130, 0, 0, 0)); ToggleGroup groupDrink = new ToggleGroup(); GridPane typesOfDrink2 = new GridPane(); typesOfDrink2.setVgap(20); typesOfDrink2.setPadding(new Insets(130, 30, 0, 0)); final ToggleButton bt1 = new ToggleButton(listCategory.get(0).getCategoryName()); bt1.setToggleGroup(groupDrink); bt1.setId("drinkName"); bt1.setMaxSize(250, 250); typesOfDrink2.add(bt1, 0, 0); // premium whisky bt1.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('wine.jpeg');"); /*borderPane.setCenter(drinks.viewWineStock()); chkRect()*/ borderPane.setCenter( viewStock( listCategory.get(0).getCategotyId(), listCategory.get(0).getCategoryName())); animation.animateLeft(bt1, 0, 0); } }); final ToggleButton bt2 = new ToggleButton(listCategory.get(1).getCategoryName()); bt2.setToggleGroup(groupDrink); bt2.setId("drinkName"); bt2.setMaxSize(250, 250); typesOfDrink.add(bt2, 0, 0); // regular whisky bt2.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('vodka.jpg');"); // borderPane.setCenter(drinks.viewVodkaStock()); borderPane.setCenter( viewStock( listCategory.get(1).getCategotyId(), listCategory.get(1).getCategoryName())); animation.animateRight(bt2, 0, 0); } }); final ToggleButton bt3 = new ToggleButton(listCategory.get(2).getCategoryName()); bt3.setToggleGroup(groupDrink); bt3.setId("drinkName"); bt3.setMaxSize(250, 250); typesOfDrink2.add(bt3, 0, 1); // Premium Vodka bt3.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('beer2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(2).getCategotyId(), listCategory.get(2).getCategoryName())); animation.animateLeft(bt3, 0, 1); } }); final ToggleButton bt4 = new ToggleButton(listCategory.get(3).getCategoryName()); bt4.setToggleGroup(groupDrink); bt4.setId("drinkName"); bt4.setMaxSize(250, 250); typesOfDrink.add(bt4, 0, 1); // Regular Vodka bt4.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('whisky.jpg');"); borderPane.setCenter( viewStock( listCategory.get(3).getCategotyId(), listCategory.get(3).getCategoryName())); animation.animateRight(bt4, 0, 1); } }); final ToggleButton bt5 = new ToggleButton(listCategory.get(4).getCategoryName()); bt5.setToggleGroup(groupDrink); bt5.setId("drinkName"); bt5.setMaxSize(250, 250); typesOfDrink.add(bt5, 0, 4); // Brandy bt5.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('rum2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(4).getCategotyId(), listCategory.get(5).getCategoryName())); animation.animateRight(bt5, 0, 4); } }); final ToggleButton bt6 = new ToggleButton(listCategory.get(5).getCategoryName()); bt6.setToggleGroup(groupDrink); bt6.setId("drinkName"); bt6.setMaxSize(250, 250); typesOfDrink.add(bt6, 0, 5); // Gin bt6.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('Scotch.jpg');"); borderPane.setCenter( viewStock( listCategory.get(5).getCategotyId(), listCategory.get(5).getCategoryName())); animation.animateRight(bt6, 0, 5); } }); final ToggleButton bt7 = new ToggleButton(listCategory.get(6).getCategoryName().replace('&', '\n')); bt7.setToggleGroup(groupDrink); bt7.setId("drinkName"); bt7.setMaxSize(250, 250); typesOfDrink2.add(bt7, 0, 5); // White Rum and Premixes bt7.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(6).getCategotyId(), listCategory.get(6).getCategoryName())); animation.animateLeft(bt7, 0, 5); } }); final ToggleButton bt8 = new ToggleButton(listCategory.get(7).getCategoryName()); bt8.setToggleGroup(groupDrink); bt8.setId("drinkName"); bt8.setMaxSize(250, 250); typesOfDrink.add(bt8, 0, 3); // Regular Rum bt8.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(7).getCategotyId(), listCategory.get(7).getCategoryName())); animation.animateRight(bt8, 0, 3); } }); final ToggleButton bt9 = new ToggleButton(listCategory.get(8).getCategoryName()); bt9.setToggleGroup(groupDrink); bt9.setId("drinkName"); bt9.setMaxSize(250, 250); typesOfDrink.add(bt9, 0, 6); // Beer bt9.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(8).getCategotyId(), listCategory.get(8).getCategoryName())); animation.animateRight(bt9, 0, 6); } }); final ToggleButton bt10 = new ToggleButton(listCategory.get(9).getCategoryName()); bt10.setToggleGroup(groupDrink); bt10.setId("drinkName"); bt10.setMaxSize(250, 250); typesOfDrink2.add(bt10, 0, 3); // Wine bt10.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(9).getCategotyId(), listCategory.get(9).getCategoryName())); animation.animateLeft(bt10, 0, 3); } }); final ToggleButton bt11 = new ToggleButton(listCategory.get(10).getCategoryName()); bt11.setToggleGroup(groupDrink); bt11.setId("drinkName"); bt11.setMaxSize(250, 250); typesOfDrink2.add(bt11, 0, 2); // Premium Scotch bt11.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(10).getCategotyId(), listCategory.get(10).getCategoryName())); animation.animateLeft(bt11, 0, 2); } }); final ToggleButton bt12 = new ToggleButton(listCategory.get(11).getCategoryName()); bt12.setToggleGroup(groupDrink); bt12.setId("drinkName"); bt12.setMaxSize(250, 250); typesOfDrink.add(bt12, 0, 2); // regular Scotch bt12.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(11).getCategotyId(), listCategory.get(11).getCategoryName())); animation.animateRight(bt12, 0, 2); } }); final ToggleButton bt13 = new ToggleButton(listCategory.get(12).getCategoryName()); bt13.setToggleGroup(groupDrink); bt13.setId("drinkName"); bt13.setMaxSize(250, 250); typesOfDrink2.add(bt13, 0, 4); // Beverages bt13.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { // borderPane.setStyle("-fx-background-image: url('othertype2.jpg');"); borderPane.setCenter( viewStock( listCategory.get(12).getCategotyId(), listCategory.get(12).getCategoryName())); animation.animateLeft(bt13, 0, 4); } }); // typesOfDrink.getChildren().addAll(tbWine,tbVodka,tbBeer,tbWisky,tbRum,tbScotch,tbOther); borderPane.setLeft(typesOfDrink); borderPane.setRight(typesOfDrink2); bt2.fire(); return borderPane; }
public entryView(Object object) { getChildren().clear(); getStylesheets().add("css/entryView.css"); giveNode(object); BorderPane mainpane = new BorderPane(); BorderPane centerpane = new BorderPane(); BorderPane bottompane = new BorderPane(); GridPane divgrid = new GridPane(); GridPane maingrid = new GridPane(); Label emptylab = new Label(); Label divlab = new Label(); VBox options = new VBox(); VBox tlist = new VBox(); Button ok = new Button("ok"); Periods periods = new Periods(); TList loadteacher = new TList(); DatePicker date = new DatePicker(); BorderPane datepane = new BorderPane(); BorderPane nextpane = new BorderPane(); Button next = new Button("next"); options.setId("options"); tlist.setId("tlist"); divgrid.setId("divgrid"); bottompane.setId("bottompane"); periods.setId("period"); divlab.setId("divlabel"); datepane.setId("datepane"); nextpane.setId("nextpane"); emptylab.setPrefHeight(100); bottompane.setStyle("-fx-background-color:#ecf0f1;"); StringConverter converter = new StringConverter<LocalDate>() { DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); @Override public String toString(LocalDate date) { if (date != null) { return dateFormatter.format(date); } else { return ""; } } @Override public LocalDate fromString(String string) { if (string != null && !string.isEmpty()) { return LocalDate.parse(string, dateFormatter); } else { return null; } } }; date.setConverter(converter); date.setPromptText("dd-MM-yyyy".toLowerCase()); date.setValue(LocalDate.now()); maingrid = div.loadDiv(); list = (ListView) div.takelist(); periods.period(); list.getSelectionModel().select(0); divlab.setText((String) list.getItems().get(0)); list.setOnMouseClicked( e -> { divlab.setText((String) list.getSelectionModel().getSelectedItem()); periods.getChildren().clear(); periods.period(); }); final Node node = maingrid.getChildren().get(0); Platform.runLater( new Runnable() { @Override public void run() { node.requestFocus(); } }); next.setOnAction( e -> { // list.getSelectionModel().getSelectedIndex()+1 list.getSelectionModel().select(list.getSelectionModel().getSelectedIndex() + 1); divlab.setText((String) list.getSelectionModel().getSelectedItem()); }); nextpane.setRight(next); datepane.setRight(date); options.getChildren().clear(); options.getChildren().add(maingrid); divgrid.setHgap(5); // divgrid.add(emptylab, 0, 1); divgrid.add(datepane, 1, 0); divgrid.add(divlab, 0, 2); divgrid.add(periods, 1, 2); divgrid.add(nextpane, 1, 3); divgrid.setAlignment(Pos.TOP_CENTER); mainpane.setCenter(centerpane); mainpane.setLeft(options); mainpane.setRight(loadteacher); centerpane.setCenter(divgrid); centerpane.setBottom(bottompane); bottompane.setRight(ok); addCloseButton cb = new addCloseButton(); cb.addxb(1); setTop(cb); setCenter(mainpane); }