コード例 #1
0
  public void updateWidth(double dx) {

    // Clamp x2 + dx in [x1, x3]
    final double newX2 = Math.max(x1, Math.min(x3, x2 + dx));
    final double newWidth = newX2 - x1;
    final double newWidthNext = x3 - newX2;

    //        assert (newCellWidth+newNextWidth) ==
    // (downColWidths[colIndex]+downColWidths[colIndex+1]) :
    //                "newCellWidth+newNextWidth=" +  (newCellWidth+newNextWidth) + ", " +
    //                "downColWidths[colIndex]+downColWidths[colIndex+1]=" +
    //                (downColWidths[colIndex]+downColWidths[colIndex+1]);

    // Updates width of treeTableColumn
    treeTableColumn.setPrefWidth(newWidth);
    if (treeTableColumn.getMinWidth() == Region.USE_COMPUTED_SIZE) {
      treeTableColumn.setMinWidth(newWidth);
    } else {
      treeTableColumn.setMinWidth(Math.min(newWidth, treeTableColumn.getMinWidth()));
    }
    if (treeTableColumn.getMaxWidth() == Region.USE_COMPUTED_SIZE) {
      treeTableColumn.setMaxWidth(newWidth);
    } else {
      treeTableColumn.setMaxWidth(Math.max(newWidth, treeTableColumn.getMaxWidth()));
    }

    // Updates with of treeTableColumnNext
    if (treeTableColumnNext != null) {
      treeTableColumnNext.setPrefWidth(newWidthNext);
      if (treeTableColumnNext.getMinWidth() == Region.USE_COMPUTED_SIZE) {
        treeTableColumnNext.setMinWidth(newWidthNext);
      } else {
        treeTableColumnNext.setMinWidth(Math.min(newWidthNext, treeTableColumnNext.getMinWidth()));
      }
      if (treeTableColumnNext.getMaxWidth() == Region.USE_COMPUTED_SIZE) {
        treeTableColumnNext.setMaxWidth(newWidthNext);
      } else {
        treeTableColumnNext.setMaxWidth(Math.max(newWidthNext, treeTableColumnNext.getMaxWidth()));
      }
    }
  }
コード例 #2
0
 public void applyTo(TreeTableColumn<?, ?> tc) {
   tc.setMinWidth(minWidth);
   tc.setMaxWidth(maxWidth);
   tc.setPrefWidth(prefWidth);
 }