@Test public void divideByZeroErrorWhenSizeIsSmall_RT22687() { pagination.setPageCount(15); root.setMaxSize(100, 200); root.getChildren().add(pagination); show(); try { KeyEventFirer keyboard = new KeyEventFirer(pagination); keyboard.doRightArrowPress(); tk.firePulse(); } catch (Exception e) { fail(); } assertEquals(1, pagination.getCurrentPageIndex()); }
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()); }
@Override protected Group createVisual() { // container set-up final Group group = new Group() { @Override public boolean isResizable() { // every node is resizable when it contains a graph return isNesting(); } @Override public void resize(double w, double h) { if (!isResizable()) { return; } // compute new size, based on layout bounds Bounds layoutBounds = getLayoutBounds(); Bounds vboxBounds = vbox.getLayoutBounds(); double vw = vboxBounds.getWidth() + w - layoutBounds.getWidth(); double vh = vboxBounds.getHeight() + h - layoutBounds.getHeight(); vbox.setPrefSize(vw, vh); vbox.resize(vw, vh); } }; // create box for border and background rect = new Rectangle(); rect.setFill( new LinearGradient( 0, 0, 1, 1, true, CycleMethod.REFLECT, Arrays.asList(new Stop(0, new Color(1, 1, 1, 1))))); rect.setStroke(new Color(0, 0, 0, 1)); rect.getStyleClass().add(CSS_CLASS_SHAPE); nestedChildrenPane = createNestedContentPane(); nestedContentStackPane = createNestedContentStackPane(nestedChildrenPane); nestedChildrenPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); nestedContentStackPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); // initialize image view iconImageView = new ImageView(); iconImageView.setImage(null); iconImageView.getStyleClass().add(CSS_CLASS_ICON); // initialize text labelText = new Text(); labelText.setTextOrigin(VPos.TOP); labelText.setText(NODE_LABEL_EMPTY); labelText.getStyleClass().add(CSS_CLASS_LABEL); // build node visual createNodeVisual(group, rect, iconImageView, labelText, nestedContentStackPane); return group; }