IDEMPIERE-4514 Grid View Layout Bug (#336)

Fix issue with first time switching of detail tab.
This commit is contained in:
hengsin 2020-10-31 22:24:44 +08:00 committed by GitHub
parent d2a2e3d19f
commit 904c8131be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 7 deletions

View File

@ -912,19 +912,19 @@ public class CompositeADTabbox extends AbstractADTabbox
if (!tabPanel.getGridTab().isSortTab()) {
currentRow = tabPanel.getGridTab().getCurrentRow();
}
tabPanel.query(false, 0, 0);
tabPanel.query(false, 0, 0);
if (currentRow >= 0 && currentRow != tabPanel.getGridTab().getCurrentRow()
&& currentRow < tabPanel.getGridTab().getRowCount()) {
tabPanel.getGridTab().setCurrentRow(currentRow, false);
}
Center center = findCenter(tabPanel.getGridView());
if (center != null)
center.invalidate();
else
tabPanel.invalidate();
}
}
if (!tabPanel.isVisible()) {
tabPanel.setVisible(true);
Executions.schedule(tabPanel.getDesktop(), e -> {
invalidateTabPanel(tabPanel);
}, new Event("onPostActivateDetail", tabPanel));
} else {
invalidateTabPanel(tabPanel);
}
boolean wasForm = false;
if (!tabPanel.isGridView()) {
@ -946,6 +946,14 @@ public class CompositeADTabbox extends AbstractADTabbox
if (wasForm && tabPanel.getTabLevel() == 0 && headerTab.getTabLevel() != 0) // maintain form on header when zooming to a detail tab
tabPanel.switchRowPresentation();
}
private void invalidateTabPanel(IADTabpanel tabPanel) {
Center center = findCenter(tabPanel.getGridView());
if (center != null)
center.invalidate();
else
tabPanel.invalidate();
}
private Center findCenter(GridView gridView) {
if (gridView == null)