public static void setPayPane(int amount) { message = new Label(Custom.PAY_PTS_MESSAGE); Labels.setLabelStyle(message, Custom.TEXT_SIZE_LARGER, true); StackPane.setAlignment(message, Pos.CENTER); payBtn = new Button(Custom.YES); Buttons.setStoreLargerButtons(payBtn, true); StackPane.setAlignment(payBtn, Pos.BOTTOM_LEFT); payBtn.setOnAction((ae) -> PayPoints.buy(amount)); backBtn = new Button(Custom.NO); Buttons.setStoreLargerButtons(backBtn, true); StackPane.setAlignment(backBtn, Pos.BOTTOM_RIGHT); backBtn.setOnAction((ae) -> PayPoints.goBack()); mainPane = new StackPane(); mainPane.setStyle(Custom.WINDOW_STYLING); mainPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100); mainPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100); mainPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5); mainPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5); mainPane.setBorder( new Border( new BorderStroke( Paint.valueOf("#000000"), BorderStrokeStyle.SOLID, new CornerRadii(30), new BorderWidths(5)))); mainPane.getChildren().addAll(message, payBtn, backBtn); mainPane.setPadding(new Insets(10, 10, 10, 10)); StackPane.setAlignment(mainPane, Pos.CENTER); backPane = new StackPane(); backPane.getChildren().add(mainPane); backPane.setStyle(Custom.MENU_BACKGROUND); getRoot().getChildren().add(backPane); }
@PostConstruct public void onStartPerspective( PerspectiveLayout perspectiveLayout, FXComponentLayout layout, ResourceBundle resourceBundle) { // Top Buttons component StackPane topPane = new StackPane(); // Center Component StackPane centerPane = new StackPane(); centerPane.setAlignment(Pos.TOP_CENTER); // Bottom Component bottomPane = new StackPane(); bottomPane.setAlignment(Pos.BOTTOM_CENTER); // Bottom Bar Component bottomBar = new StackPane(); bottomBar.setAlignment(Pos.BOTTOM_CENTER); // Attach to PERSPECTIVE mainSplit = constructSplitPane(constructScrollPane(centerPane), bottomPane); mainPane = constructMainPane(mainSplit, bottomBar); perspectiveLayout.registerTargetLayoutComponent(GuiConfig.TARGET_CONTAINER_TOP, topPane); perspectiveLayout.registerTargetLayoutComponent(GuiConfig.TARGET_CONTAINER_ABOUT, centerPane); perspectiveLayout.registerTargetLayoutComponent(GuiConfig.TARGET_CONTAINER_PANE, bottomPane); perspectiveLayout.registerTargetLayoutComponent(GuiConfig.TARGET_CONTAINER_BAR, bottomBar); // Define main pane borderPane = constructBorderPane(perspectiveLayout, topPane, mainPane); }
public static StackPane looKasutajaLaud() { StackPane kasutjaLaud = new StackPane(); GridPane ruudustik = looRuudustik(); // kasutjaLaud.getChildren().add(ruudustik); for (Laev laev : Laevastik.kasutajaLaevad) { double x = laev.laevaKuju .getTranslateX(); // küsin kõik laeva omadused ja annan need passiivselt edasi double y = laev.laevaKuju.getTranslateY(); double a = laev.laevaKuju.getWidth(); double b = laev.laevaKuju.getHeight(); Paint pilt = laev.laevaKuju.getFill(); Rectangle ship = new Rectangle(a, b, Color.TRANSPARENT); StackPane.setAlignment(ship, Pos.TOP_LEFT); ship.setTranslateX(x); ship.setTranslateY(y); ship.setFill(pilt); kasutjaLaud.getChildren().add(ship); for (int i = 0; i < laev.laevaPikkus; i++) { String koordinaat = laev.laevaKoordinaadid.get(i); int rida = Integer.parseInt(String.valueOf(koordinaat.charAt(0))); int veerg = Integer.parseInt(String.valueOf(koordinaat.charAt(1))); Rectangle kujund = (Rectangle) ruutLaual(ruudustik, rida, veerg); if (kujund != null) { kujund.setId("laev"); } } } kasutjaLaud.getChildren().add(ruudustik); return kasutjaLaud; }
/** * Add a subslide node. * * @param defaultSubSlide the subslide node */ private void addSubSlide(final Node defaultSubSlide) { this.subSlides.add(model().getStepPosition(), defaultSubSlide); this.slideContent.getChildren().add(defaultSubSlide); StackPane.setAlignment(defaultSubSlide, Pos.CENTER); }
public TitledBorder() { titleLabel.setText("default title"); titleLabel.getStyleClass().add("bordered-titled-title"); StackPane.setAlignment(titleLabel, Pos.TOP_CENTER); getStyleClass().add("bordered-titled-border"); getChildren().addAll(titleLabel, contentPane); }
protected Node buildtoolsFiltroAlumno(boolean index) { HBox hBox = new HBox(10); hBox.setMaxHeight(maxHeightCabezera); hBox.setMaxWidth(DefaultAncho); hBox.setMinWidth(DefaultAncho); hBox.setPadding(new Insets(10, 10, 5, 10)); hBox.setStyle("-fx-background-color:black"); hBox.getChildren().add(txtFiltroTitulo); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroAutor); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroEditorial); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtRanking); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); // Agregando el Efecto Bloom Bloom bloom = BloomBuilder.create().threshold(0f).build(); hBox.setEffect(bloom); if (index) { StackPane agrupador = new StackPane(); agrupador.getChildren().add(hBox); agrupador.getChildren().add(imgIndex); StackPane.setAlignment(imgIndex, Pos.BOTTOM_RIGHT); StackPane.setMargin(imgIndex, new Insets(0, -6, -17, 0)); return agrupador; } else { return hBox; } }
private Scene initScene() { MainPane mainPane = ApplicationContextHolder.getContext().getBean(MainPane.class); NotificationsContainer notifications = ApplicationContextHolder.getContext().getBean(NotificationsContainer.class); StackPane main = new StackPane(); StackPane.setAlignment(notifications, Pos.BOTTOM_RIGHT); StackPane.setAlignment(mainPane, Pos.TOP_LEFT); main.getChildren().addAll(mainPane, notifications); StylesConfig styles = ApplicationContextHolder.getContext().getBean(StylesConfig.class); Scene mainScene = new Scene(main); mainScene.getStylesheets().addAll(styles.styles()); mainScene .getAccelerators() .put( new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN), () -> eventStudio().broadcast(new ShowStageRequest(), "LogStage")); return mainScene; }
public BusPlace() { seatsList = new ArrayList<>(); bus.setArcHeight(8); bus.setArcWidth(8); bus.setFill(Color.TRANSPARENT); bus.setStrokeWidth(2); bus.setWidth(500); bus.setHeight(200); bus.setStyle("-fx-stroke:-color-accent"); gridPane.setAlignment(Pos.CENTER); StackPane.setAlignment(gridPane, Pos.CENTER); this.getChildren().addAll(bus, gridPane); }
/** Constructor for the center pane. */ public CenterPane() { // Initializing components popUpParent = new FloatingButton(new SVGIcon(MaterialIcon.SETTINGS, Constants.MIDDLE_ICON, true)); popUpChildTop = new FloatingButton( new SVGIcon(MaterialDesignIcon.THERMOMETER_LINES, Constants.SMALL_ICON, true)); popUpChildBottom = new FloatingButton(new SVGIcon(MaterialIcon.VISIBILITY, Constants.SMALL_ICON, true)); fullscreen = new FloatingButton(new SVGIcon(MaterialIcon.FULLSCREEN, Constants.MIDDLE_ICON, true)); viewSwitcher = new VBox(Constants.INSETS); viewSwitcher.setMaxSize(Constants.MIDDLE_ICON, Double.MAX_VALUE); viewSwitcher.setAlignment(Pos.BOTTOM_CENTER); viewSwitcherPopUp = new VBox(Constants.INSETS); viewSwitcherPopUp.setAlignment(Pos.CENTER); // Setting Alignment in Stackpane StackPane.setAlignment(viewSwitcher, Pos.BOTTOM_RIGHT); StackPane.setAlignment(fullscreen, Pos.TOP_RIGHT); this.setPickOnBounds(false); viewSwitcher.translateYProperty().set(-Constants.INSETS); fullscreen.translateYProperty().set(Constants.INSETS); // Adding components to their parents viewSwitcher.getChildren().addAll(popUpParent); viewSwitcherPopUp.getChildren().addAll(popUpChildTop, popUpChildBottom); this.getChildren().addAll(viewSwitcher, fullscreen); // Styling components with CSS // CHECKSTYLE.OFF: MultipleStringLiterals this.getStyleClass().addAll("padding-small"); // CHECKSTYLE.ON: MultipleStringLiterals }
/** MOB - Man Overboard */ private void createMOBWidget(Scene scene) { Alarm mob = new Mob(); root.getChildren().add(mob); mob.addEventHandler( MouseEvent.MOUSE_CLICKED, (MouseEvent event) -> { if (first == true) { driver = instrumentDriverManagerServices.open( DATA_PATH + "/data/sounds/alarm10.wav", "true", "100"); first = false; } else { driver.off(); first = true; } }); mob.setTranslateX(400.0); mob.setTranslateY(-10.0); StackPane.setAlignment(mob, Pos.BOTTOM_CENTER); }
/** * Build and return the footer panel. * * @return the footer panel */ protected Node getFooterPanel() { this.pageLabel = LabelBuilder.create() .text(String.valueOf(model().getSlide().getPage())) .font(PrezFonts.PAGE.get()) .build(); final AnchorPane ap = AnchorPaneBuilder.create().children(this.pageLabel).build(); AnchorPane.setRightAnchor(this.pageLabel, 20.0); final StackPane sp = StackPaneBuilder.create() .styleClass("footer") .prefHeight(35.0) .minHeight(Region.USE_PREF_SIZE) .maxHeight(Region.USE_PREF_SIZE) .children(ap) .build(); StackPane.setAlignment(ap, Pos.CENTER_RIGHT); return sp; }
private void initialize() { this.setVisible(false); this.getStyleClass().add(DEFAULT_STYLE_CLASS); contentHolder = new StackPane(); contentHolder.setBackground( new Background(new BackgroundFill(Color.WHITE, new CornerRadii(2), null))); JFXDepthManager.setDepth(contentHolder, 4); contentHolder.setPickOnBounds(false); // ensure stackpane is never resized beyond it's preferred size contentHolder.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); overlayPane = new StackPane(); overlayPane.getChildren().add(contentHolder); overlayPane.getStyleClass().add("jfx-dialog-overlay-pane"); StackPane.setAlignment(contentHolder, Pos.CENTER); overlayPane.setVisible(false); overlayPane.setBackground( new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.1), null, null))); // close the dialog if clicked on the overlay pane if (overlayClose.get()) overlayPane.addEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler); // prevent propagating the events to overlay pane contentHolder.addEventHandler(MouseEvent.ANY, (e) -> e.consume()); }
@FXML public void initialize() { StackPane.setAlignment(tfAmountDue, Pos.CENTER_LEFT); StackPane.setAlignment(tfAmountEntry, Pos.CENTER_RIGHT); cancelOption.setOnMouseClicked( event -> App.confirm.showAndWait( "Are you sure? Any changes will not be saved.", App.main::backRefresh)); sendOption.setOnMouseClicked( event -> { if (getItem().getProductEntries().isEmpty()) { Platform.runLater(() -> App.notify.showAndWait("Nothing to send.")); } else if (getItem().changeProperty().get().compareTo(BigDecimal.ZERO) < 0) { Platform.runLater( () -> App.notify.showAndWait("Payment Due : " + getItem().dueProperty().get())); } else if (getItem() .getProductEntries() .stream() .anyMatch( pe -> pe.hasStatus(ProductEntryStatus.HOLD) || pe.hasStatus(ProductEntryStatus.REQUEST_HOLD))) { Platform.runLater(() -> App.notify.showAndWait("Can't close orders with held items.")); } else { SalesOrderStatus prevStatus = getItem().getStatus(); getItem().setStatus(SalesOrderStatus.REQUEST_CLOSE); App.apiProxy.postSalesOrder( getItem(), new RunLaterCallback<Long>() { @Override public void laterSuccess(Long aLong) { getItem().setId(aLong); App.main.setSwapRefresh(App.changeDuePresenter, getItem()); // Print takeout receipt on pay if (App.properties.getBool("print-pay-takeout") && getItem().hasType(SalesOrderType.TAKEOUT)) App.dispatcher.requestPrint("receipt", App.jobBuilder.check(getItem(), true)); // Print dinein receipt on pay else if (App.properties.getBool("print-pay-dinein") && getItem().hasType(SalesOrderType.DINEIN)) App.dispatcher.requestPrint("receipt", App.jobBuilder.check(getItem(), true)); // TODO : Remove hardcoded scenario - print receipt for take out orders that pay // immediately else if (getItem().hasType(SalesOrderType.TAKEOUT) && getItem().hasStatus(SalesOrderStatus.REQUEST_CLOSE) && prevStatus == SalesOrderStatus.REQUEST_OPEN) App.dispatcher.requestPrint("receipt", App.jobBuilder.check(getItem(), true)); } @Override public void laterFailure(ErrorInfo error) { super.laterFailure(error); getItem().setStatus(prevStatus); } }); } }); gratuityOption.setOnMouseClicked( event -> { if (getItem().canHaveGratuity() && !getItem().hasGratuity()) { getItem().setGratuityPercent(App.properties.getBd("gratuity-percent")); } else { getItem().setGratuityPercent(BigDecimal.ZERO); } }); printOption.setOnMouseClicked( event -> Platform.runLater( () -> { if (getItem().canPrint()) { App.main.backRefresh(); App.dispatcher.requestPrint("receipt", App.jobBuilder.check(getItem(), false)); } else { App.notify.showAndWait("Changes must be sent before printing."); } })); voidOption.setOnMouseClicked( event -> { if (getItem().hasStatus(SalesOrderStatus.VOID) || getItem().hasStatus(SalesOrderStatus.CLOSED)) { App.confirm.showAndWait( "Reopen Sales Order?", () -> { SalesOrderStatus prevStatus = getItem().getStatus(); getItem().setStatus(SalesOrderStatus.REQUEST_OPEN); App.apiProxy.postSalesOrder( getItem(), new RunLaterCallback<Long>() { @Override public void laterSuccess(Long aLong) { App.notify.showAndWait("Sales Order " + aLong + " Reopened."); App.main.backRefresh(); } @Override public void laterFailure(ErrorInfo error) { super.laterFailure(error); getItem().setStatus(prevStatus); } }); }); } else { App.confirm.showAndWait( "Void Sales Order?", () -> { SalesOrderStatus prevStatus = getItem().getStatus(); getItem().setStatus(SalesOrderStatus.REQUEST_VOID); App.apiProxy.postSalesOrder( getItem(), new RunLaterCallback<Long>() { @Override public void laterSuccess(Long aLong) { Platform.runLater( () -> { App.main.backRefresh(); App.notify.showAndWait("Sales Order " + aLong + " Voided."); }); } @Override public void laterFailure(ErrorInfo error) { super.laterFailure(error); getItem().setStatus(prevStatus); } }); }); } }); lvChargeEntries.setCellFactory( param -> { ViewChargeEntry presenter = Presenter.load("/view/order/view_charge_entry.fxml"); presenter.fixWidth(lvChargeEntries); presenter.onClick( event -> Platform.runLater( () -> { ChargeEntry ce = presenter.getItem(); if (ce.hasStatus(ChargeEntryStatus.REQUEST_APPLY)) { getItem().chargeEntriesProperty().remove(ce); } else if (ce.hasStatus(ChargeEntryStatus.APPLIED) && App.employee.hasPermission(Permission.VOID_CHARGE_ENTRY)) { ce.setStatus(ChargeEntryStatus.REQUEST_VOID); } else if (ce.hasStatus(ChargeEntryStatus.REQUEST_VOID)) { ce.setStatus(ChargeEntryStatus.APPLIED); } })); return new PresenterCellAdapter<>(presenter); }); lvPaymentEntries.setCellFactory( param -> { ViewPaymentEntry presenter = Presenter.load("/view/order/view_payment_entry.fxml"); presenter.fixWidth(lvPaymentEntries); presenter.onClick( event -> Platform.runLater( () -> { PaymentEntry pe = presenter.getItem(); if (pe.hasStatus(PaymentEntryStatus.REQUEST_PAID)) { getItem().paymentEntriesProperty().remove(pe); } else if (pe.hasStatus(PaymentEntryStatus.PAID) && App.employee.hasPermission(Permission.VOID_PAYMENT_ENTRY)) { pe.setStatus(PaymentEntryStatus.REQUEST_VOID); } else if (pe.hasStatus(PaymentEntryStatus.REQUEST_VOID)) { pe.setStatus(PaymentEntryStatus.PAID); } })); return new PresenterCellAdapter<>(presenter); }); lvCharges.setCellFactory( param -> { ViewCharge presenter = Presenter.load("/view/order/view_charge.fxml"); presenter.fixWidth(lvCharges); presenter.onClick( event -> Platform.runLater( () -> { ChargeEntry entry = new ChargeEntry(presenter.getItem()); lvChargeEntries.getItems().add(entry); })); return new PresenterCellAdapter<>(presenter); }); }
@SuppressWarnings("unchecked") public StackPane viewStock(String categoryId, String categoryName) { stack = new StackPane(); GridPane grid = new GridPane(); grid.setVgap(8); grid.setPadding(new Insets(30)); final ObservableList<ItemVO> dataTable; // final ObservableList<ItemVO> dataTable1; // final ObservableList<ItemVO> dataTable2; ObservableList<CategoryTypeVO> typeList; Rectangle roundRect = RectangleBuilder.create() .x(50) .y(50) .width(Screen.getPrimary().getVisualBounds().getWidth() - 428) .height(Screen.getPrimary().getVisualBounds().getHeight() - 150) .arcWidth(30) .arcHeight(30) .build(); roundRect.setFill(Color.DARKGRAY); roundRect.setOpacity(0.2); roundRect.setStroke(Color.TRANSPARENT); HBox hlabel = new HBox(); hlabel.setMaxWidth(Screen.getPrimary().getVisualBounds().getWidth() - 170); hlabel.setMaxHeight(30); hlabel.setStyle("-fx-background-color:black;"); hlabel.setOpacity(0.3); hlabel.setLayoutX(20); try { typeList = FXCollections.observableArrayList(); typeList = UtiliesDAO.getUtiliesDAO().fetchTypes(categoryId); dataTable = FXCollections.observableArrayList(); dataTable.addAll(stockDetailsService.viewStock(categoryId)); /*dataTable1 = FXCollections.observableArrayList(); dataTable2 = FXCollections.observableArrayList(); for(int i=0;i<dataTable.size();i++) { dataTable1.add(dataTable.get(i++)); if(i<=dataTable.size()-1) { dataTable2.add(dataTable.get(i)); } }*/ final Label label = new Label(categoryName + " Stock"); final Text text5 = new Text(25, 175, categoryName + " Stock"); text5.setFill(Color.DARKORANGE); // text5.setFont(Font.font ("Edwardian Script ITC", 50)); text5.setFont(Font.loadFont("file:resources/fonts/ITCEDSCR.TTF", 50)); final Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0); final Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(9.0); text5.setEffect(lighting); label.setAlignment(Pos.CENTER_LEFT); // grid.add(label,1,0); final TableView<ItemVO> table1 = new TableView<ItemVO>(); table1.setEditable(false); // table1.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);//400,300 table1.setMinSize(roundRect.getWidth() * 0.41, roundRect.getHeight() * 0.519); // 400,300 table1.setMaxSize(roundRect.getWidth() - 50, roundRect.getHeight() - 200); table1.getSelectionModel().setCellSelectionEnabled(false); table1.setStyle("-fx-background-color: transparent;"); TableColumn<ItemVO, String> itemName = new TableColumn<ItemVO, String>("Item"); itemName.setResizable(false); itemName.setMaxWidth(roundRect.getWidth() * 0.5); itemName.setMinWidth(roundRect.getWidth() * 0.5); // 200 itemName.setCellValueFactory(new PropertyValueFactory<ItemVO, String>("itemName")); TableColumn<ItemVO, Integer> quantity = new TableColumn<ItemVO, Integer>("Quantity#"); quantity.setResizable(false); quantity.setMinWidth(roundRect.getWidth() * 0.107); // 200 /*quantity.setCellValueFactory( new PropertyValueFactory<ItemVO, Integer>("quantity"));*/ for (final CategoryTypeVO type : typeList) { TableColumn<ItemVO, Integer> col = new TableColumn<ItemVO, Integer>(type.getTypeName()); col.setMinWidth(roundRect.getWidth() * 0.107); // 100 col.setResizable(false); col.setCellValueFactory( new Callback<CellDataFeatures<ItemVO, Integer>, ObservableValue<Integer>>() { @Override public ObservableValue<Integer> call(CellDataFeatures<ItemVO, Integer> item) { ItemVO itemVO = item.getValue(); if (itemVO == null) { return null; // or perhaps // return new ReadOnlyObjectWrapper<Integer>(null); } else { ObservableMap<String, ItemTypeVO> itemTypesMap = FXCollections.observableHashMap(); itemTypesMap = item.getValue().getListType(); return new ReadOnlyObjectWrapper<Integer>( itemTypesMap.get(type.getTypeId()).getQuantity()); } } }); col.setCellFactory( new Callback<TableColumn<ItemVO, Integer>, TableCell<ItemVO, Integer>>() { @Override public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) { // TODO Auto-generated method stub return new TableCell<ItemVO, Integer>() { @Override public void updateItem(Integer item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { setText(item.toString()); if (item <= 5) { this.getStyleClass().add("celllow"); setTextFill(Color.RED); } } } }; } }); quantity.getColumns().add(col); } if (quantity.getColumns().size() >= 5 && quantity.getColumns().size() <= 7) { itemName.setMinWidth(itemName.getWidth() - (quantity.getColumns().size() - 4) * 100); } if (quantity.getColumns().size() > 7) { itemName.setMinWidth(itemName.getWidth() - ((7 - 4) * 100)); } table1.setItems(dataTable); final TableColumn[] columns1 = {itemName, quantity}; table1.getColumns().addAll(columns1); table1 .getColumns() .addListener( new ListChangeListener() { public boolean suspended; @Override public void onChanged(Change change) { change.next(); if (change.wasReplaced() && !suspended) { this.suspended = true; table1.getColumns().setAll(columns1); this.suspended = false; } } }); /*//final TableView<ItemVO> table2 = new TableView<ItemVO>(); table2.setEditable(false); table2.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519); table2.setMinSize(roundRect.getWidth()*0.35, roundRect.getHeight()*0.519);//400,300 table2.setStyle("-fx-background-color: transparent;"); TableColumn<ItemVO,String> itemName2 = new TableColumn<ItemVO,String> ("Item"); itemName2.setMinWidth(roundRect.getWidth()*0.3);//200 itemName2.setCellValueFactory( new PropertyValueFactory<ItemVO, String>("itemName")); TableColumn<ItemVO, Integer> quantity2 = new TableColumn<ItemVO, Integer> ("Quantity#"); quantity2.setMinWidth(roundRect.getWidth()*0.107);//200 quantity.setCellValueFactory( new PropertyValueFactory<ItemVO, Integer>("quantity")); for (final CategoryTypeVO type : typeList) { TableColumn<ItemVO, Integer> col2 = new TableColumn<ItemVO, Integer>(type.getTypeName()); col2.setMinWidth(roundRect.getWidth()*0.107);//100 col2.setResizable(false); col2.setCellValueFactory(new Callback<CellDataFeatures<ItemVO,Integer>, ObservableValue<Integer>>() { @Override public ObservableValue<Integer> call(CellDataFeatures<ItemVO,Integer> item) { ItemVO itemVO = item.getValue(); if (itemVO == null) { return null ; // or perhaps // return new ReadOnlyObjectWrapper<Integer>(null); } else { ObservableMap<String,ItemTypeVO> itemTypesMap = FXCollections.observableHashMap(); itemTypesMap = item.getValue().getListType(); return new ReadOnlyObjectWrapper<Integer>(itemTypesMap.get(type.getTypeId()).getQuantity()); } } }); col2.setCellFactory(new Callback<TableColumn<ItemVO,Integer>, TableCell<ItemVO,Integer>>() { @Override public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) { // TODO Auto-generated method stub return new TableCell<ItemVO, Integer>(){ @Override public void updateItem(Integer item, boolean empty) { super.updateItem(item, empty); if(item!=null) { setText(item.toString()); if(item<=5) { this.getStyleClass().add("celllow"); setTextFill(Color.RED); } } } }; } }); quantity2.getColumns().add(col2); } table2.setItems(dataTable2); final TableColumn[] columns2 = {itemName2, quantity2}; table2.getColumns().addAll(columns2); table2.getColumns().addListener(new ListChangeListener() { public boolean suspended; @Override public void onChanged(Change change) { change.next(); if (change.wasReplaced() && !suspended) { this.suspended = true; table2.getColumns().setAll(columns2); this.suspended = false; } } });*/ Rectangle qtyRect = RectangleBuilder.create().x(50).y(50).width(10).height(10).build(); qtyRect.setFill(Color.rgb(240, 128, 128)); grid.add(table1, 0, 12); // grid.add(table2,1,12); grid.setAlignment(Pos.TOP_CENTER); Text man_text = new Text(CommonConstants.STAR_MSG); man_text.setFill(Color.DARKKHAKI); man_text.setFont(Font.font("Arial", 12)); Text msg_qty = new Text(CommonConstants.QTY_MSG1); msg_qty.setFill(Color.DARKKHAKI); msg_qty.setFont(Font.font("Arial", 12)); Text msg_qtyLow = new Text(CommonConstants.QTY_LOW); msg_qtyLow.setFill(Color.DARKKHAKI); msg_qtyLow.setFont(Font.font("Arial", 12)); StackPane.setMargin(grid, new Insets(10, 0, 0, 0)); StackPane.setMargin(qtyRect, new Insets(197, 850, 100, 0)); StackPane.setAlignment(qtyRect, Pos.BASELINE_CENTER); StackPane.setMargin(msg_qtyLow, new Insets(197, 765, 100, 0)); StackPane.setAlignment(msg_qtyLow, Pos.BASELINE_CENTER); StackPane.setAlignment(roundRect, Pos.TOP_CENTER); StackPane.setMargin(text5, new Insets(50, 8, 8, 8)); StackPane.setAlignment(text5, Pos.TOP_CENTER); StackPane.setMargin(man_text, new Insets(197, 100, 20, 0)); StackPane.setAlignment(man_text, Pos.BASELINE_RIGHT); StackPane.setMargin(msg_qty, new Insets(210, 95, 20, 0)); StackPane.setAlignment(msg_qty, Pos.BASELINE_RIGHT); stack.getChildren().addAll(text5, roundRect, grid, man_text, msg_qty, qtyRect, msg_qtyLow); } catch (Exception e) { e.printStackTrace(); } return stack; }
public Cutaway(SubScene scene, double width, double height) { // Make sure "world" is a group assert scene.getRoot().getClass().equals(Group.class); setFillWidth(true); setPrefSize(width, height + controlSize); setMaxSize(width, height + controlSize); this.setBorder( new Border( new BorderStroke( Color.DARKKHAKI, BorderStrokeStyle.SOLID, new CornerRadii(25), new BorderWidths(5)))); Rectangle closeSquare = new Rectangle(controlSize, controlSize, Color.LIGHTCORAL); closeSquare.setOnMouseClicked( (MouseEvent me) -> { this.fireEvent(new CloseCutawayEvent(this)); }); Circle dragCircle = new Circle(controlSize / 2, Color.STEELBLUE); HBox top = new HBox(20, closeSquare, dragCircle); dragCircle.setVisible(false); StackPane.setAlignment(closeSquare, Pos.TOP_RIGHT); StackPane.setMargin(closeSquare, new Insets(50)); top.setBackground( new Background( new BackgroundFill(Color.KHAKI, new CornerRadii(20, 20, 0, 0, false), Insets.EMPTY))); top.setAlignment(Pos.TOP_RIGHT); top.setOnMousePressed( (MouseEvent me) -> { cutawayPosX = me.getSceneX(); cutawayPosY = me.getSceneY(); cutawayOldX = me.getSceneX(); cutawayOldY = me.getSceneY(); }); top.setOnMouseDragged( (MouseEvent me) -> { cutawayOldX = cutawayPosX; cutawayOldY = cutawayPosY; cutawayPosX = me.getSceneX(); cutawayPosY = me.getSceneY(); cutawayDeltaX = (cutawayPosX - cutawayOldX); cutawayDeltaY = (cutawayPosY - cutawayOldY); setTranslateX(getTranslateX() + cutawayDeltaX); setTranslateY(getTranslateY() + cutawayDeltaY); }); getChildren().addAll(top, imageView); worldToView = (Group) scene.getRoot(); camera.setNearClip(0.1); camera.setFarClip(15000.0); camera.setTranslateZ(-1500); params.setCamera(camera); params.setDepthBuffer(true); params.setFill(Color.rgb(0, 0, 0, 0.5)); viewTimer = new AnimationTimer() { @Override public void handle(long now) { redraw(); } }; setOnMouseEntered( e -> { requestFocus(); }); }
@Override public void start(Stage primaryStage) { try { screen = primaryStage; screen.setOnCloseRequest( e -> { engine.interrupt(); }); lives = new SimpleDoubleProperty(1); lives.addListener( e -> { if (lives.get() == 0) { engine.interrupt(); newGame.setText("Start new game"); changeScene(); } }); logo = new Image(getClass().getResourceAsStream("logo.png"), 256, 256, true, true); logoView = new ImageView(logo); menu = new StackPane(logoView); livesText = new Text(String.valueOf((int) lives.get())); slowDownsText = new Text(String.valueOf(slowDownCount)); score = new Text("Score"); scorePoints = new Text(String.valueOf(points)); livesText.setFill(Color.BEIGE); slowDownsText.setFill(Color.BEIGE); score.setFill(Color.BEIGE); scorePoints.setFill(Color.BEIGE); live = new Image(getClass().getResourceAsStream("live.png")); slowDown = new Image(getClass().getResourceAsStream("slowdown.png")); spotView = new ImageView(new Image(getClass().getResourceAsStream("spot.png"))); liveView = new ImageView(live); slowDownView = new ImageView(slowDown); liveCounterView = new ImageView(live); slowDownCounterView = new ImageView(slowDown); spotView.setVisible(false); liveView.setVisible(false); slowDownView.setVisible(false); spotView.setOnMouseClicked( e -> { spotView.setVisible(false); clicked = true; points++; if (time > 400) { time -= 20; } scorePoints.setText(String.valueOf(points * 10)); }); liveView.setOnMouseClicked( e -> { liveView.setVisible(false); clicked = true; points++; lives.set(lives.get() + 1); livesText.setText(String.valueOf((int) lives.get())); scorePoints.setText(String.valueOf(points * 10)); }); slowDownView.setOnMouseClicked( e -> { slowDownView.setVisible(false); clicked = true; points++; slowDownCount++; slowDownsText.setText(String.valueOf(slowDownCount)); scorePoints.setText(String.valueOf(points * 10)); }); slowDownCounterView.setOnMouseClicked( e -> { if (slowDownCount > 0) { slowDownCount--; slowDownsText.setText(String.valueOf(slowDownCount)); time += 150; } }); Separator sepOne = new Separator(Orientation.VERTICAL); sepOne.setOpacity(0.1); Separator sepTwo = new Separator(Orientation.VERTICAL); sepTwo.setOpacity(0.1); HBox header = new HBox( 5, liveCounterView, livesText, sepOne, slowDownCounterView, slowDownsText, sepTwo, score, scorePoints); header.setAlignment(Pos.CENTER_LEFT); header.setStyle( "-fx-background-color:linear-gradient(#242424 50%, #2D2D2D 75%, #3C3C3C 100%);"); header.setPadding(new Insets(3, 1, 3, 1)); playField = new StackPane(spotView, liveView, slowDownView); playField.setAlignment(Pos.TOP_LEFT); playField.setStyle( "-fx-background-color: linear-gradient(#9d9e9d 5%, #6b6a6b 20%, #343534 80%, #242424 100%);"); root = new BorderPane(playField, header, null, null, null); root.setStyle("-fx-border-color: #13BFF8"); playScene = new Scene(root, 300, 500); newGame = new Button("Start"); newGame.setStyle( "-fx-background-color: linear-gradient(TRANSPARENT 50%, #FFFFFF 100%); -fx-text-fill: #FFFFFF; -fx-min-width: 128px;"); newGame.setOnMouseEntered( e -> newGame.setStyle( "-fx-background-color: linear-gradient(TRANSPARENT 10%, #FFFFFF 100%); -fx-text-fill: #FFFFFF; -fx-min-width: 128px;")); newGame.setOnMouseExited( e -> newGame.setStyle( "-fx-background-color: linear-gradient(TRANSPARENT 50%, #FFFFFF 100%); -fx-text-fill: #FFFFFF; -fx-min-width: 128px;")); newGame.setTranslateY(80); newGame.setOnMouseClicked( e -> { points = 0; time = 1500; clicked = false; slowDownCount = 0; lives.set(1); livesText.setText(String.valueOf((int) lives.get())); screen.setScene(playScene); engine = new Engine(this); engine.start(); }); menu.getChildren().add(newGame); menuScene = new Scene(menu, 256, 256); menu.setStyle( "-fx-background-color: linear-gradient(#9d9e9d 5%, #6b6a6b 20%, #343534 80%, #242424 100%); -fx-border-color: #13BFF8;"); primaryStage.setScene(menuScene); primaryStage.setResizable(false); primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.show(); } catch (Exception e) { e.printStackTrace(); } }
public void setPubScene() { /** Done by Marco */ xPane.setStyle( "-fx-background-image: url(" + "\"" + Pub.getImage(Pub.getIndexById(this.id)) + "\"" + "); "); description = new StackPane(); events = new StackPane(); rating = new StackPane(); rating.setId("rating"); description.setId("description"); descriptionGrid.setId("description-text"); pubName = new Label("- " + Pub.getName(Pub.getIndexById(this.id)) + " -"); age = new Label(Pub.getAge(Pub.getIndexById(this.id)) + " years \uF000"); age.setId("infoLabel"); open = new Label(Pub.getOpening(Pub.getIndexById(this.id)) + " \uF017"); open.setId("infoLabel"); address = new Label(Pub.getAddress(Pub.getIndexById(this.id)) + " \uF124"); address.setId("infoLabel"); type = new Label(Pub.getType(Pub.getIndexById(this.id)) + " \uF005"); type.setId("infoLabel"); /** End of Marco's work */ /** Done by Aseel */ discountForStudents = new Label(Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) + " \uF02D"); if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 1) { discountForStudents = new Label("Discounts " + " \uF02D"); } else if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 0) { discountForStudents = new Label("No Discounts " + "\uF02D"); } discountForStudents.setId("infoLabel"); entranceFees = new Label(Pub.getHasFee(Pub.getIndexById(this.id)) + "\uf153"); if (Pub.getHasFee(Pub.getIndexById(this.id)) == 1) { entranceFees = new Label("Fees " + " \uF153"); } else if (Pub.getHasFee(Pub.getIndexById(this.id)) == 0) { entranceFees = new Label("No Fees " + "\uF153"); } entranceFees.setId("infoLabel"); /** End of Aseel's work */ /** Done by Marco */ map.setMinWidth(1000); map.setMaxHeight(250); browser.load( "http://locateme.marcokoivisto.me/?lat=" + Pub.getLat(Pub.getIndexById(this.id)) + "&lon=" + Pub.getLon(Pub.getIndexById(this.id))); int nrStars = Pub.getNrStars(Pub.getIndexById(this.id)); String stars = ""; for (int i = 0; i < nrStars; i++) { stars += "\uF005 "; } rates = new Label(stars); rates.setId("ratingOfStars"); rating.getChildren().add(rates); rating.setAlignment(Pos.CENTER); xPane.add(pubName, 1, 1); descriptionGrid.add(discountForStudents, 1, 1); descriptionGrid.add(entranceFees, 2, 1); descriptionGrid.add(age, 3, 1); descriptionGrid.add(open, 4, 1); descriptionGrid.add(type, 5, 1); descriptionGrid.add(address, 6, 1); /** End of Marco's work */ /** Done by Marco */ descriptionGrid.setAlignment(Pos.CENTER); description.getChildren().addAll(descriptionGrid); eventDescriptionGrid.add(eventLabel, 1, 1); eventDescriptionGrid.add(eventPane, 1, 2); GridPane.setHalignment(eventLabel, HPos.CENTER); eventDescriptionGrid.setAlignment(Pos.CENTER); events.getChildren().addAll(eventDescriptionGrid); eventName = new Label(Pub.getEventName(Pub.getIndexById(this.id))); eventDescription = new Label(Pub.getEventDescription(Pub.getIndexById(this.id))); eventGrid.add(eventName, 1, 1); eventGrid.add(eventDescription, 1, 2); eventName.setId("eventName"); eventDescription.setId("eventDescription"); eventPane.getChildren().add(eventGrid); eventGrid.setId("event"); events.setId("eventField"); xPane.add(rating, 1, 2); xPane.add(description, 1, 3); xPane.add(map, 1, 4); if (Pub.getEventName(Pub.getIndexById(this.id)) != "") { xPane.add(events, 1, 5); } pubName.setId("pub_name"); GridPane.setHalignment(pubName, HPos.CENTER); GridPane.setValignment(pubName, VPos.TOP); GridPane.setValignment(back, VPos.TOP); GridPane.setHalignment(star, HPos.RIGHT); GridPane.setValignment(star, VPos.TOP); xPane.add(star, 1, 1); header.setFitWidth(1000); header.setPreserveRatio(true); /** End of Marco's work */ /** Done by Shafiq & Antonino */ int rate = PubDataAccessor.checkRate(this.id); star.setText(rate + " \uF08A"); /** End of Shafiq & Antonino's WORK */ }
@Override public void start(Stage stage) { DropShadow dropShadow = new DropShadow(10.0, Color.rgb(150, 50, 50, .688)); dropShadow.setOffsetX(4); dropShadow.setOffsetY(6); StackPane stackPane = new StackPane(); stackPane.setAlignment(Pos.CENTER); stackPane.setEffect(dropShadow); Rectangle rectangle = new Rectangle(100, 50, Color.LEMONCHIFFON); rectangle.setArcWidth(30); rectangle.setArcHeight(30); Text text = new Text(); text.setFont(Font.font("Tahoma", FontWeight.BOLD, 18)); stackPane.getChildren().addAll(rectangle, text); final Scene scene = new Scene(stackPane, 400, 200, Color.LIGHTSKYBLUE); stage.setTitle("Custom Binding"); rectangle.widthProperty().bind(scene.widthProperty().divide(2)); rectangle.heightProperty().bind(scene.heightProperty().divide(2)); DoubleBinding opacityBinding = new DoubleBinding() { { // List the dependencies with super.bind() super.bind(scene.widthProperty(), scene.heightProperty()); } @Override protected double computeValue() { // Return the computed value double opacity = (scene.getWidth() + scene.getHeight()) / 1000; return (opacity > 1.0) ? 1.0 : opacity; } }; rectangle.opacityProperty().bind(opacityBinding); text.textProperty().bind((Bindings.format("opacity = %.2f", opacityBinding))); ObjectBinding<Color> colorBinding = new ObjectBinding<Color>() { { super.bind(scene.fillProperty()); } @Override protected Color computeValue() { if (scene.getFill() instanceof Color) { return ((Color) scene.getFill()).darker(); } else { return Color.GRAY; } } }; text.fillProperty().bind(colorBinding); stage.setScene(scene); stage.show(); }
/* ADMIN SCENE */ public void start(Stage primaryStage) throws Exception { /** Done by Marco */ primaryStage.setTitle("PubFinder"); primaryStage.setResizable(false); PubDataAccessor.PubDataAccessor(); /*Welcome scene*/ WelcomeScene.welcomeScene(); welcomeScene = WelcomeScene.welcomeScene; /*Welcome scene*/ /** End of Marcos Work */ /** Done by Shafiq and Anotnino */ /* Admin add scene*/ AdminAddScene.adminAddscene(); adminAddScene = AdminAddScene.adminAddScene; /* Admin add scene*/ /*Admin login scene*/ AdminLoginScene.adminloginscene(); adminLoginScene = AdminLoginScene.adminLoginScene; /*Admin login scene*/ /*Admin choice scene*/ AdminChoiceScene.adminchoicescene(); adminChoiceScene = AdminChoiceScene.adminChoiceScene; /*Admin choice scene*/ /* Admin Edit Scene*/ adminEditScene = AdminEditScene.editScene; /* Admin Edit Scene*/ /** End of Shafiq and Anotonino's Work */ /*Pub button scene*/ pubLayout = new StackPane(); /** Done by Ahmad */ searchNameInput = new TextField(); searchNameInput.setId("search-field"); searchNameInput.setPromptText("NAME"); /** End of Ahmad's Work */ searchStreetInput = new TextField(); searchStreetInput.setId("search-field"); searchStreetInput.setPromptText("STREET"); searchAgeInput = new TextField(); searchAgeInput.setId("search-field"); searchAgeInput.setPromptText("AGE"); /** Done by Aseel */ CheckBox searchStudentDiscount = new CheckBox("DISCOUNTS"); CheckBox searchBySpecialEvents = new CheckBox("EVENTS"); CheckBox searchWithoutFees = new CheckBox("NO FEES"); searchStudentDiscount.setId("check-search"); searchBySpecialEvents.setId("check-search"); searchWithoutFees.setId("check-search"); ComboBox searchByRating = new ComboBox( FXCollections.observableArrayList( "\uF005", "\uF005\uF005", "\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005\uF005")); searchByRating.setTooltip(new Tooltip("RATING")); searchByRating.setPromptText("RATING"); searchByRating.setId("combo-search"); ComboBox searchByArea = new ComboBox( FXCollections.observableArrayList( "All", "Avenyn", "Linné", "Haga", "Järntorget", "Magasinsgatan", "Vasastaden", "Gamlestaden", "Heden", "Masthugget", "Stigberget", "Other")); searchByArea.setTooltip(new Tooltip("AREA")); searchByArea.setPromptText("AREA"); searchByArea.setId("combo-search"); /** End of Aseel's Work */ /** Done by Marco */ pubLayout.setId("pubs"); search = new Button("SEARCH"); search.setId("button-search"); GridPane inputGrid = new GridPane(); inputGrid.setMaxHeight(100); inputGrid.setHgap(10); inputGrid.setVgap(10); inputGrid.setId("searchGrid"); StackPane.setAlignment(inputGrid, Pos.TOP_LEFT); StackPane.setAlignment(search, Pos.TOP_RIGHT); /** End of Marco's Work */ search.setOnAction(e -> searchForPubs()); /** Done by Ahmad */ searchNameInput.setOnKeyReleased( event1 -> { if (event1.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Marco */ searchStreetInput.setOnKeyReleased( event2 -> { if (event2.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Marco's Work */ /** Done by Ahmad */ searchAgeInput.setOnKeyReleased( event3 -> { if (event3.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Shafiq & Anotnino */ searchStudentDiscount.setOnAction( event4 -> { if (searchStudentDiscount.isSelected()) { discount = 1; } if (!searchStudentDiscount.isSelected()) { discount = 0; } }); searchWithoutFees.setOnAction( event5 -> { if (searchWithoutFees.isSelected()) { fee = 0; } if (!searchWithoutFees.isSelected()) { fee = 1; } }); searchBySpecialEvents.setOnAction( event6 -> { if (searchBySpecialEvents.isSelected()) { searchEvent = true; } if (!searchBySpecialEvents.isSelected()) { searchEvent = false; } }); searchByRating.setOnAction( event7 -> { if (searchByRating.getSelectionModel().isSelected(0)) { numberOfStars = 1; } else if (searchByRating.getSelectionModel().isSelected(1)) { numberOfStars = 2; } else if (searchByRating.getSelectionModel().isSelected(2)) { numberOfStars = 3; } else if (searchByRating.getSelectionModel().isSelected(3)) { numberOfStars = 4; } else if (searchByRating.getSelectionModel().isSelected(4)) { numberOfStars = 5; } }); /** End of Shafiq and Anotino's Work */ /** Done by Aseel and Antonino */ searchByArea.setOnAction( event8 -> { if (searchByArea.getSelectionModel().isSelected(0)) { area_checker = 2; } if (searchByArea.getSelectionModel().isSelected(1)) { area = 0; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(2)) { area = 2; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(3)) { area = 3; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(4)) { area = 4; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(5)) { area = 5; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(6)) { area = 6; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(7)) { area = 7; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(8)) { area = 8; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(9)) { area = 9; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(10)) { area = 10; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(11)) { area = 11; area_checker = 1; } }); /** End of Aeel and Antonino's Work */ /** Done by marco */ ScrollPane pubScroll = new ScrollPane(); pubScroll.setId("scroll"); pubScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); pubScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubs = new GridPane(); pubScroll.setContent(pubs); pubs.setId("pub-grid"); pubs.setAlignment(Pos.CENTER); pubLayout.getChildren().add(pubScroll); inputGrid.add(searchNameInput, 1, 1); inputGrid.add(searchStreetInput, 2, 1); inputGrid.add(searchAgeInput, 3, 1); inputGrid.add(searchByRating, 4, 1); inputGrid.add(searchByArea, 5, 1); inputGrid.add(searchStudentDiscount, 6, 1); inputGrid.add(searchBySpecialEvents, 7, 1); inputGrid.add(searchWithoutFees, 8, 1); pubLayout.getChildren().add(inputGrid); pubLayout.getChildren().add(search); noPub = new Label("No pubs found"); searchForPubs(); pubScene = new Scene(pubLayout, 1000, 600); pubScene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub button scene*/ /*Pub scene*/ ScrollPane pubPageLayout = new ScrollPane(); pubPageLayout.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setFitToWidth(true); pubPageLayout.setContent(xPane); xPane.setId("pubScene"); pubPageLayout.setId("gej"); star.setId("starButton"); eventLabel.setId("eventLabel"); /*Items*/ xPane.add(back, 1, 1); back.setId("button-logout"); back.setOnAction( (event) -> { primaryStage.setScene(pubScene); xPane .getChildren() .removeAll(description, rating, overlay, pubName, map, star, rates, events); descriptionGrid .getChildren() .removeAll(age, open, address, type, discountForStudents, entranceFees); events.getChildren().removeAll(eventDescriptionGrid); eventDescriptionGrid.getChildren().removeAll(eventLabel, eventPane); eventPane.getChildren().removeAll(eventGrid); eventGrid.getChildren().removeAll(eventName, eventDescription); star.setText("0 \uF08A"); star.setStyle( "#starButton{-fx-text-fill: #fff;} #starButton:hover{-fx-text-fill: #fff;}"); }); /** End of Marco's work */ /** Done by Shafiq & Antonino */ star.setOnAction( event -> { int rate = PubDataAccessor.checkRate(this.id); int rateUpdate = rate + 1; /** End of Shafiq & Antonino's Work */ /** Done by marco */ star.setText((rateUpdate) + " \uF004"); PubDataAccessor.updateRate(this.id); star.setStyle("-fx-text-fill: #731a2b;"); }); overlay.setHeight(header.getFitHeight()); overlay.setWidth(header.getFitWidth() + 24); overlay.setX(0); overlay.setY(0); overlay.fillProperty().set(javafx.scene.paint.Color.rgb(115, 26, 43, 0.3)); pubPage = new Scene(pubPageLayout, 1000, 600); pubPage.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub scene*/ primaryStage.setScene(welcomeScene); primaryStage.show(); Main.primaryStage = primaryStage; /** End of Marcos work */ }