Skip to content

Commit

Permalink
Decrease size of table panel when using stem table.
Browse files Browse the repository at this point in the history
Without this change, the table panel height is always higher than
needed (when using stem table), because the stem table is counted
as one of the items in the components list. It is however shown
separately at the top, which is already accounted for by the
stem table margin.
  • Loading branch information
Spayralbe committed Dec 4, 2023
1 parent 4f43f5b commit 5c34665
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,17 @@ private void setLabeledRectanglesLocation(List<LabeledRectangle> components, int
public Dimension getMinimumSize() {
Dimension dimension = new Dimension();
dimension.width = 2 * (ITEM_WIDTH + MARGIN) + MIN_SPACE_BETWEEN_COLUMNS;
int componentsHeight = Math.max(sourceComponents.size(), cdmComponents.size()) * (ITEM_HEIGHT + MARGIN);
int maxComponentsSize = Math.max(sourceComponents.size(), cdmComponents.size());
int componentsHeight = maxComponentsSize * (ITEM_HEIGHT + MARGIN);
dimension.height = Math.min(HEADER_HEIGHT + HEADER_TOP_MARGIN + componentsHeight, maxHeight);

if (ObjectExchange.etl.hasStemTable()) {
dimension.height += STEM_HEIGHT_MARGIN;
// For the table mapping panel, deduct the stem table from the items (as it's not shown as a normal item in the list)
boolean isTablesPanel = cdmComponents.stream().allMatch(n -> (n.getItem() instanceof Table));
if (!cdmComponents.isEmpty() && isTablesPanel) {
dimension.height -= (ITEM_HEIGHT + MARGIN);
}
}

return dimension;
Expand Down

0 comments on commit 5c34665

Please sign in to comment.