Skip to content

Commit

Permalink
PL-9973 Exception is thrown if text field with description is expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
jreznot committed Nov 3, 2017
1 parent a7d0e45 commit 24b2668
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,23 @@ public void expand(Component component, String height, String width) {
}

if (layoutAdapter.getFlowDirection() == BoxLayoutAdapter.FlowDirection.Y) {
if (StringUtils.isEmpty(height) || "-1px".equals(height) || height.endsWith("%")) {
if (StringUtils.isEmpty(height) || AUTO_SIZE.equals(height) || height.endsWith("%")) {
component.setHeight("100%");
}
} else if (layoutAdapter.getFlowDirection() == BoxLayoutAdapter.FlowDirection.X) {
if (StringUtils.isEmpty(width) || "-1px".equals(width) || width.endsWith("%")) {
if (StringUtils.isEmpty(width) || AUTO_SIZE.equals(width) || width.endsWith("%")) {
component.setWidth("100%");
}
}

JComponent composition = DesktopComponentsHelper.getComposition(component);
layoutAdapter.expand(composition, height, width);
JComponent expandingChild = DesktopComponentsHelper.getComposition(component);

Pair<JPanel, BoxLayoutAdapter> wrapperInfo = wrappers.get(component);
if (wrapperInfo != null) {
expandingChild = wrapperInfo.getFirst();
}

layoutAdapter.expand(expandingChild, height, width);

if (component instanceof DesktopComponent) {
((DesktopComponent) component).setExpanded(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -908,12 +908,18 @@ public void expand(Component component, String height, String width) {
}

// only Y direction
if (StringUtils.isEmpty(height) || "-1px".equals(height) || height.endsWith("%")) {
if (StringUtils.isEmpty(height) || AUTO_SIZE.equals(height) || height.endsWith("%")) {
component.setHeight("100%");
}

JComponent composition = DesktopComponentsHelper.getComposition(component);
layoutAdapter.expand(composition, height, width);
JComponent expandingChild = DesktopComponentsHelper.getComposition(component);

Pair<JPanel, BoxLayoutAdapter> wrapperInfo = wrappers.get(component);
if (wrapperInfo != null) {
expandingChild = wrapperInfo.getFirst();
}

layoutAdapter.expand(expandingChild, height, width);

if (component instanceof DesktopComponent) {
((DesktopComponent) component).setExpanded(true);
Expand Down

0 comments on commit 24b2668

Please sign in to comment.