private final void defineStretching() { //////////// give resizing hints ObservableList<RowConstraints> rows = getRowConstraints(); logger.info("original row constraints size" + rows.size()); RowConstraints rc; rc = new RowConstraints(); // rc.setPercentHeight( 0 ); rc.setVgrow(Priority.NEVER); rc.setMinHeight(StaticConst.GU); rows.add(rc); rc = new RowConstraints(); // rc.setPercentHeight( 100 ); rc.setVgrow(Priority.ALWAYS); rows.add(rc); rc = new RowConstraints(); // rc.setPercentHeight( 0 ); rc.setVgrow(Priority.NEVER); rows.add(rc); ObservableList<ColumnConstraints> ccs = getColumnConstraints(); logger.info("original column constraints size" + ccs.size()); ColumnConstraints cc; cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); ccs.add(cc); }
private GridPane getNewGrid() { GridPane grid = new GridPane(); grid.setVgap(10); grid.setHgap(5); // grid.setGridLinesVisible(true); grid.paddingProperty().set(new Insets(5)); // GridPane.setVgrow(grid, Priority.ALWAYS); // grid.setMinWidth(500); ColumnConstraints col = new ColumnConstraints(); col.setMinWidth(10); col.setHgrow(Priority.SOMETIMES); col.setFillWidth(true); // col.setPercentWidth(1); col.setPrefWidth(100); grid.getColumnConstraints().addAll(col, col); // ------ RowConstraints row1 = new RowConstraints(); RowConstraints row2 = new RowConstraints(); row1.setMinHeight(10); row1.setVgrow(Priority.SOMETIMES); row1.setFillHeight(true); row1.setPrefHeight(30); row2.setMinHeight(10); row2.setVgrow(Priority.SOMETIMES); row2.setFillHeight(true); row2.setValignment(VPos.CENTER); grid.getRowConstraints().addAll(row1, row2); // ColumnConstraints c = new ColumnConstraints(); // c.setHgrow(Priority.SOMETIMES); // c.setMaxWidth(173.0); // c.setMinWidth(10.0); // c.setPrefWidth(124.0); // grid.getColumnConstraints().add(c); // c = new ColumnConstraints(); // c.setHalignment(HPos.RIGHT); // c.setHgrow(Priority.NEVER); // grid.getColumnConstraints().add(c); // RowConstraints r = new RowConstraints(); // r.setVgrow(Priority.NEVER); // grid.getRowConstraints().add(r); return grid; }
public final void initCanvas(int cols, int rows) { this.currentPad = 0; this.canvasPads.clear(); this.getChildren().clear(); double widthFactor = 1.0 / cols; double heightFactor = 1.0 / rows; GridPane grid = new GridPane(); for (int c = 0; c < cols; c++) { for (int r = 0; r < rows; r++) { TEmbeddedPad pad = new TEmbeddedPad(); this.canvasPads.add(pad); pad.widthProperty().bind(this.widthProperty().multiply(widthFactor)); pad.heightProperty().bind(this.heightProperty().multiply(heightFactor)); grid.add(pad, c, r); } } ColumnConstraints cc = new ColumnConstraints(); // cc1.setPercentWidth(50); cc.setHgrow(Priority.ALWAYS); cc.setFillWidth(true); for (int c = 0; c < cols; c++) { grid.getColumnConstraints().add(cc); } RowConstraints rc = new RowConstraints(); rc.setFillHeight(true); rc.setVgrow(Priority.ALWAYS); for (int r = 0; r < rows; r++) { grid.getRowConstraints().add(rc); } this.getChildren().add(grid); // grid.prefWidthProperty().bind(this.widthProperty()); // grid.prefHeightProperty().bind(this.heightProperty()); // GridPane grid = new GridPane(); // pad.widthProperty().bind(this.widthProperty()); // pad.heightProperty().bind(this.heightProperty()); }
/** Sets the FX constraints. */ private void setConstraints() { // Column 1 has empty constraints. this.getColumnConstraints().add(new ColumnConstraints()); // Column 2 should grow to fill space. ColumnConstraints column2 = new ColumnConstraints(); column2.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(column2); // Rows 1-4 have empty constraints. this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); // Row 5 should RowConstraints row5 = new RowConstraints(); row5.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row5); }
public PlongeeSimpleView() { MN90.getLogger().debug(this, "Construction de la vue PlongeeSimple"); // this.setGridLinesVisible(MN90.AFFICHAGE_GRILLE); this.setGridLinesVisible(true); ColumnConstraints col = new ColumnConstraints(); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(90); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); // col.setPercentWidth(5); col.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(col); RowConstraints row = new RowConstraints(); // row.setPercentHeight(90); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); // row.setPercentHeight(90); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); row.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row); mImgView.setImage(mImgPlongeeFond); mImgView.setFitWidth(100); mImgView.setManaged(true); mImgView.setPreserveRatio(true); mImgView.setSmooth(true); mImgView.setCache(true); this.add(mImgView, 0, 1, 13, 8); this.add(mHeureDepartLabel, 0, 0); mHeureDepartValue.setPrefWidth(100); mHeureDepartValue.setMaxWidth(100); mHeureDepartValue.setMinWidth(100); this.add(mHeureDepartValue, 1, 0, 2, 1); this.add(mProfMaxLabel, 2, 8); mProfMaxValue.setPrefWidth(45); mProfMaxValue.setMaxWidth(45); mProfMaxValue.setMinWidth(45); this.add(mProfMaxValue, 3, 8); this.add(mHeureSortieLabel, 10, 0); mHeureSortieValue.setPrefWidth(100); mHeureSortieValue.setMaxWidth(100); mHeureSortieValue.setMinWidth(100); this.add(mHeureSortieValue, 11, 0, 2, 1); this.add(mDureePlongeeLabel, 2, 7); mDureePlongeeValue.setPrefWidth(45); mDureePlongeeValue.setMaxWidth(45); mDureePlongeeValue.setMinWidth(45); this.add(mDureePlongeeValue, 3, 7); this.add(mPalier3mLabel, 11, 2); mDureePalier3mValue.setPrefWidth(50); mDureePalier3mValue.setMaxWidth(50); mDureePalier3mValue.setMinWidth(50); this.add(mDureePalier3mValue, 11, 3); this.add(mDTRLabel, 10, 8); mDTRValue.setPrefWidth(50); mDTRValue.setMaxWidth(50); mDTRValue.setMinWidth(50); this.add(mDTRValue, 11, 8); this.add(mGPSLabel, 10, 7); mGPSValue.setPrefWidth(50); mGPSValue.setMaxWidth(50); mGPSValue.setMinWidth(50); this.add(mGPSValue, 11, 7); }