getContent().add(weapnsTable); OpenPatricianSmallWaxButton btn1 = new OpenPatricianSmallWaxButton("1"); btn1.setId("amountONE"); btn1.getStyleClass().add("actionButton"); btn1.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.ONE); OpenPatricianSmallWaxButton btn5 = new OpenPatricianSmallWaxButton("5"); btn5.setId("amountFIVE"); btn5.getStyleClass().add("actionButton"); btn5.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.FIVE); OpenPatricianSmallWaxButton btnMax = new OpenPatricianSmallWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.BaseTradeDialog.max", new Object[]{}, locale.getCurrentLocal())); btnMax.setId("amountMAX"); btnMax.getStyleClass().add("actionButton"); btnMax.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.MAX);
public OpenPatricianSmallWaxButtonSkin(final OpenPatricianSmallWaxButton button) { super(button); InputStream is = getClass().getResourceAsStream("sealingWaxFlattend.png"); Image img = new Image(is); final ImageView imageView = new ImageView(img); final Label label = new Label(); label.textProperty().bind(button.textProperty()); label.getStyleClass().add("OpenPatricianSmallWaxButtonLabeled"); label.onMouseClickedProperty().bind(button.onActionProperty()); label.textProperty().bind(button.textProperty()); imageView.onMouseReleasedProperty().bind(button.onActionProperty()); StackPane stack = new StackPane(); stack.getChildren().addAll(imageView, label); Group group = new Group(stack); group.setManaged(false); button.setPrefHeight(img.getHeight()); button.setPrefWidth(img.getWidth()); button.setMaxHeight(img.getHeight()); getChildren().add(group); }
final int actionButtonX = (WIDTH - 124) / 2; final OpenPatricianSmallWaxButton previous = new OpenPatricianSmallWaxButton("<"); previous.getStyleClass().add("actionButton"); previous.setLayoutX(actionButtonX - 62 - 4); previous.setLayoutY(CLOSE_BTN_Y_POS - 48); previous.setOnAction(createPreviousAction()); previous.setDisable(notices.size() <= 1); final OpenPatricianSmallWaxButton next = new OpenPatricianSmallWaxButton(">"); next.getStyleClass().add("actionButton"); next.setLayoutX(actionButtonX + 124 + 4); next.setLayoutY(CLOSE_BTN_Y_POS - 48); next.setOnAction(createNextAction()); next.setDisable(notices.size() <= 1); next.setDisable(!newValue); previous.setDisable(!newValue); }); getContent().addAll(previous, next, action);
OpenPatricianSmallWaxButton btn1 = new OpenPatricianSmallWaxButton("1"); btn1.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.ONE); OpenPatricianSmallWaxButton btn5 = new OpenPatricianSmallWaxButton("5"); btn5.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.FIVE); OpenPatricianSmallWaxButton btnMax = new OpenPatricianSmallWaxButton(max); btnMax.setOnAction(arg0 -> { try { movableAmount.setValue(ETransferAmount.MAX);
OpenPatricianSmallWaxButton weaponBuyBtn = new OpenPatricianSmallWaxButton(""); weaponBuyBtn.disableProperty().bind(getAmountInArmory(weapon).greaterThan(0).not()); weaponBuyBtn.setId("buyWeapon"+weapon); weaponBuyBtn.textProperty().bind(weaponBuyPrice.asString()); row.add(new ControlTableCell(weaponBuyBtn)); weaponBuyBtn.setOnAction(evt -> { if (!weaponBuyBtn.isDisable()) { IHumanPlayer player = city.getPlayer(); ICompany company = player.getCompany(); OpenPatricianSmallWaxButton weaponSellBtn = new OpenPatricianSmallWaxButton(""); weaponSellBtn.disableProperty().bind(weaponStorage.getWeaponProperty(weapon).greaterThan(0).not()); weaponSellBtn.setId("sellWeapon"+weapon); weaponSellBtn.textProperty().bind(weaponSellPrice.asString()); row.add(new ControlTableCell(weaponSellBtn)); weaponSellBtn.setOnAction(evt -> { if (!weaponSellBtn.isDisable()) { IHumanPlayer player = city.getPlayer(); ICompany company = player.getCompany();
final OpenPatricianSmallWaxButton previous = new OpenPatricianSmallWaxButton("<"); previous.setId("prev"); previous.getStyleClass().add("actionButton"); previous.setLayoutX(actionButtonX - 62 - 4); previous.setLayoutY(CLOSE_BTN_Y_POS - 48); previous.setOnAction(createPreviousAction()); BooleanProperty disableNavigation = disableNavigation(); previous.disableProperty().bind(disableNavigation); final OpenPatricianSmallWaxButton next = new OpenPatricianSmallWaxButton(">"); next.setId("next"); next.getStyleClass().add("actionButton"); next.setLayoutX(actionButtonX + 124 + 4); next.setLayoutY(CLOSE_BTN_Y_POS - 48); next.setOnAction(createNextAction()); next.disableProperty().bind(disableNavigation);
OpenPatricianSmallWaxButton toShip = new OpenPatricianSmallWaxButton("<"); toShip.setId("toShip"+weapon); toShip.setOnAction(event -> { if (!toShip.isDisabled()) { boolean placed = shipService.placeWeapon(weapon, ship); if (placed) { toShip.disableProperty().bind(disableToShip); } else { toShip.disableProperty().bind(weaponStorage.getWeaponProperty(EWeapon.HAND_WEAPON).lessThan(1)); OpenPatricianSmallWaxButton toOffice = new OpenPatricianSmallWaxButton(">"); toOffice.setId("toOffice"+weapon); toOffice.setOnAction(event -> { if (!toOffice.isDisabled()) { boolean removed = shipService.removeWeapon(weapon, ship); if (removed) { toOffice.disableProperty().bind(shipAmountBinding.lessThan(1)); row.add(new ControlTableCell(toOffice)); // to office DynamicTextTableCell officeAmount = new DynamicTextTableCell();
box.getChildren().add(btn); } else { OpenPatricianSmallWaxButton btn = new OpenPatricianSmallWaxButton(s); btn.getStyleClass().add("actionButton"); btn.setOnAction((evt) -> { try { buttonTemplate.getAction().run(); getContent().add(box); getCloseButton().setVisible(template.isClosable());
final OpenPatricianSmallWaxButton previous = new OpenPatricianSmallWaxButton("<"); previous.getStyleClass().add("actionButton"); previous.setOnAction(createPreviousAction(ware)); previous.disableProperty().bind(removeEnabled); row.add(new ControlTableCell(previous)); final OpenPatricianSmallWaxButton next = new OpenPatricianSmallWaxButton(">"); next.getStyleClass().add("actionButton"); next.setOnAction(createNextAction(ware)); next.disableProperty().bind(donateEnabled); row.add(new ControlTableCell(next));
BooleanBinding enablePrevNext = dialogUtil.enableShipCatalogueForShips(city.getPlayersShips()); final OpenPatricianSmallWaxButton prevShip = new OpenPatricianSmallWaxButton("<"); prevShip.setOnAction(dialogUtil.createPreviousActionForShips(city.getPlayersShips(), currentShip)); prevShip.setDisable(!enablePrevNext.get()); shipCatalogue.add(prevShip, 0, 0); final OpenPatricianSmallWaxButton nextShip = new OpenPatricianSmallWaxButton(">"); nextShip.setOnAction(dialogUtil.createNextActionForShips(city.getPlayersShips(), currentShip)); nextShip.setDisable(!enablePrevNext.get()); shipCatalogue.add(nextShip, 2, 0); enablePrevNext.addListener((observableValue, oldValue, newValue) -> { nextShip.setDisable(!newValue); prevShip.setDisable(!newValue); }); Text ship = new Text();
row.add(new ControlTableCell(baleAmount)); OpenPatricianSmallWaxButton buyBtn = new OpenPatricianSmallWaxButton(""); buyBtn.textProperty().bind(buyPrice(ware, amountAvailableProp, amountToTransfer)); buyBtn.setOnAction(arg0 -> new BuyJFXProxyAction(ware, createTransferable(), actionFactory).run()); row.add(new ControlTableCell(buyBtn)); OpenPatricianSmallWaxButton sellBtn = new OpenPatricianSmallWaxButton(""); sellBtn.textProperty().bind(sellPrice(ware, amountAvailableProp, amountToTransfer)); sellBtn.setOnAction(arg0 -> new SellJFXProxyAction(ware, createTransferable(), actionFactory).run()); row.add(new ControlTableCell(sellBtn)); ReadOnlyIntegerProperty storedAmountProperty = getStoredAmountProperty(ware, ship, optOffice);
@Override public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue, Boolean newValue) { nextShip.setDisable(!newValue); prevShip.setDisable(!newValue); } });
row.add(weaponAmountInArmory); IntegerBinding weaponPrice = buyPriceBinding(weapon); OpenPatricianSmallWaxButton weaponBuyBtn = new OpenPatricianSmallWaxButton(""); weaponBuyBtn.disableProperty().bind(getAmountInArmory(weapon).greaterThan(0).not()); weaponBuyBtn.setId("buyWeapon"+weapon); weaponBuyBtn.textProperty().bind(weaponPrice.asString()); row.add(new ControlTableCell(weaponBuyBtn)); weaponBuyBtn.setOnAction(evt -> { if (!weaponBuyBtn.isDisable()) { IHumanPlayer player = city.getPlayer(); ICompany company = player.getCompany();
sailorsPane.add(nbInTavern, 0, 1); GridPane.setHalignment(nbInTavern, HPos.CENTER); final OpenPatricianSmallWaxButton toTavernBtn = new OpenPatricianSmallWaxButton("<"); toTavernBtn.setOnAction(mouseEvent -> { try { if (sailorsOnShip.get() > 0) { toTavernBtn.setDisable(true); final OpenPatricianSmallWaxButton toShipBtn = new OpenPatricianSmallWaxButton(">"); toShipBtn.setOnAction(mouseEvent -> { try { if (sailorsInTavern.get() > 0) { toShipBtn.setDisable(true);
final OpenPatricianSmallWaxButton previous = new OpenPatricianSmallWaxButton("<"); previous.setId("previous"); previous.getStyleClass().add("actionButton"); previous.setOnAction(event -> previous()); previous.visibleProperty().bind(visibleNavigation); setLeft(previous); final OpenPatricianSmallWaxButton next = new OpenPatricianSmallWaxButton(">"); next.setId("next"); next.getStyleClass().add("actionButton"); next.setOnAction(event -> next()); next.visibleProperty().bind(visibleNavigation); setRight(next);
public CloseButtonDialog() { super(); title = new SimpleStringProperty(this,"title", ""); closeLabel = new SimpleStringProperty(this,"closeLabel", ""); Label titleLbl = new Label(); titleLbl.getStyleClass().add("dialogTitle"); titleLbl.textProperty().bind(title); StackPane titlePane = new StackPane(); titlePane.setLayoutY(2*FRAME_BORDER); titlePane.getChildren().addAll(new PlaceHolder(WIDTH, 1), titleLbl); getContent().add(titlePane); closeButton = new OpenPatricianSmallWaxButton("X"); closeButton.getStyleClass().add("closeButton"); closeButton.setLayoutX(WIDTH - CLOSE_BUTTON_WIDTH - CLOSE_BUTTON_PADDING); closeButton.setLayoutY(CLOSE_BTN_Y_POS); closeButton.setOnAction(event -> { try { executeOnCloseButtonClicked(); } catch (RuntimeException e) { logger.error("Failed to close dialog", e); } }); closeButton.getStyleClass().add("buttonLabel"); getContent().add(closeButton); }
DecoratedText decoratedTask = createCurrentTask(); HBox navigationBar = new HBox(15); OpenPatricianSmallWaxButton back = new OpenPatricianSmallWaxButton("<"); back.getStyleClass().add("actionButton"); back.setId("back"); back.setOnAction(createPreviousAction()); OpenPatricianSmallWaxButton next = new OpenPatricianSmallWaxButton(">"); next.getStyleClass().add("actionButton"); next.setId("next"); next.setOnAction(createNextAction()); OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton");
OpenPatricianSmallWaxButton yes = new OpenPatricianSmallWaxButton(messageSource.getMessage("yes", new Object[]{}, locale.getCurrentLocal())); yes.getStyleClass().add("actionButton"); yes.setOnAction((evt) -> { try { cityHall.getBallotResult().get().vote(true); OpenPatricianSmallWaxButton no = new OpenPatricianSmallWaxButton(messageSource.getMessage("no", new Object[]{}, locale.getCurrentLocal())); no.getStyleClass().add("actionButton"); no.setOnAction((evt) -> { try { cityHall.getBallotResult().get().vote(false); content.getChildren().add(text); HBox box = new HBox(10); OpenPatricianSmallWaxButton yes = new OpenPatricianSmallWaxButton(messageSource.getMessage("yes", new Object[]{}, locale.getCurrentLocal())); yes.getStyleClass().add("actionButton"); yes.setId("yes"); yes.setOnAction((evt) -> { try { cityHall.getBallotResult().get().vote(true); OpenPatricianSmallWaxButton no = new OpenPatricianSmallWaxButton(messageSource.getMessage("no", new Object[]{}, locale.getCurrentLocal())); no.getStyleClass().add("actionButton"); no.setId("no"); no.setOnAction((evt) -> { try { cityHall.getBallotResult().get().vote(false);
dealerAmount.textProperty().bind(dealerOwnedAmount.asString()); row.add(new ControlTableCell(dealerAmount)); OpenPatricianSmallWaxButton buyButton = new OpenPatricianSmallWaxButton(""); buyButton.getStyleClass().add("actionButton"); buyButton.setId("buy"+weapon); buyButton.setDisable(storage == null); final IntegerBinding buyPriceBinding = buyPriceBinding(movableAmount, weapon); buyButton.textProperty().bind(buyPriceBinding.asString()); buyButton.setOnAction(mouseEvent -> { if (storage != null) { try { OpenPatricianSmallWaxButton sellButton = new OpenPatricianSmallWaxButton(""); sellButton.getStyleClass().add("actionButton"); final IntegerBinding sellPriceBinding = sellPriceBinding(weapon, amountToSell); sellButton.textProperty().bind(sellPriceBinding.asString()); sellButton.setOnAction(mouseEvent -> { try { int amount = amountToSell.get();
final OpenPatricianSmallWaxButton prevShip = new OpenPatricianSmallWaxButton("<"); prevShip.setId("prevShip"); prevShip.getStyleClass().add("actionButton"); prevShip.setOnAction(createPreviousActionForShips(ships, currentShip)); prevShip.setDisable(!enablePrevNext.get()); shipSelectionPane.add(prevShip, 0, 1); GridPane.setHalignment(prevShip, HPos.LEFT); GridPane.setHalignment(sailorIconView, HPos.CENTER); final OpenPatricianSmallWaxButton nextShip = new OpenPatricianSmallWaxButton(">"); nextShip.setId("nextShip"); nextShip.getStyleClass().add("actionButton"); nextShip.setOnAction(createNextActionForShips(ships, currentShip)); nextShip.setDisable(!enablePrevNext.get()); shipSelectionPane.add(nextShip, 4, 1); GridPane.setHalignment(nextShip, HPos.RIGHT);