public Map<IPropertyName, Object> getChangeMap() { final Map<IPropertyName, Object> result = new HashMap<>(); if (MathUtils.equals(treeTableColumn.getMinWidth(), originalSizing.getMinWidth()) == false) { result.put(minWidthName, treeTableColumn.getMinWidth()); } if (MathUtils.equals(treeTableColumn.getPrefWidth(), originalSizing.getPrefWidth()) == false) { result.put(prefWidthName, treeTableColumn.getPrefWidth()); } if (MathUtils.equals(treeTableColumn.getMaxWidth(), originalSizing.getMaxWidth()) == false) { result.put(maxWidthName, treeTableColumn.getMaxWidth()); } return result; }
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())); } } }
public ColumnSizing(TreeTableColumn<?, ?> tc) { this.minWidth = tc.getMinWidth(); this.maxWidth = tc.getMaxWidth(); this.prefWidth = tc.getPrefWidth(); }