/** * Add the additional buttons evenly spaced to the left of the close button. * @param buttons varargs of small wax buttons */ public void addButtomControlButtons(OpenPatricianSmallWaxButton...buttons) { double availableSpace = WIDTH - CLOSE_BUTTON_WIDTH - 2*CLOSE_BUTTON_PADDING; double widthButtonAndGap = availableSpace/buttons.length; Preconditions.checkState(widthButtonAndGap >= CLOSE_BUTTON_WIDTH, "Cannot draw buttons as there is not enough space"); double gap = widthButtonAndGap - CLOSE_BUTTON_WIDTH; double x = CLOSE_BUTTON_PADDING; for (OpenPatricianSmallWaxButton btn : buttons) { btn.setLayoutX(x); btn.setLayoutY(HEIGHT - CLOSE_BUTTON_HEIGHT - CLOSE_BUTTON_PADDING); x += CLOSE_BUTTON_WIDTH + gap; getContent().add(btn); } }
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); }
previous.getStyleClass().add("actionButton"); previous.setLayoutX(actionButtonX - 62 - 4); previous.setLayoutY(CLOSE_BTN_Y_POS - 48); previous.setOnAction(createPreviousAction()); previous.setDisable(notices.size() <= 1); next.getStyleClass().add("actionButton"); next.setLayoutX(actionButtonX + 124 + 4); next.setLayoutY(CLOSE_BTN_Y_POS - 48); next.setOnAction(createNextAction()); next.setDisable(notices.size() <= 1);
previous.getStyleClass().add("actionButton"); previous.setLayoutX(actionButtonX - 62 - 4); previous.setLayoutY(CLOSE_BTN_Y_POS - 48); previous.setOnAction(createPreviousAction()); BooleanProperty disableNavigation = disableNavigation(); next.getStyleClass().add("actionButton"); next.setLayoutX(actionButtonX + 124 + 4); next.setLayoutY(CLOSE_BTN_Y_POS - 48); next.setOnAction(createNextAction()); next.disableProperty().bind(disableNavigation);