Skip to content

Commit

Permalink
Grid column repackage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Dec 23, 2018
1 parent c45465e commit 0dde5c3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public abstract class LightGrid extends Canvas {
*/
private static final int SELECTION_DRAG_BORDER_THRESHOLD = 2;
private static final boolean MAXIMIZE_SINGLE_COLUMN = false;
// Indicates that last time refreshData was called grid control was hidden (had zero size)
// In that case columns will be repacked even if keepState is true
private boolean controlWasHidden;

public enum EventSource {
MOUSE,
Expand Down Expand Up @@ -488,7 +491,7 @@ public void refreshData(boolean refreshColumns, boolean keepState, boolean fitVa
int savedVSB = keepState ? vScroll.getSelection() : -1;

int[] oldWidths = null;
if (keepState) {
if (keepState && !controlWasHidden) {
// Save widths
oldWidths = new int[columns.size()];
if (!columns.isEmpty()) {
Expand All @@ -497,6 +500,7 @@ public void refreshData(boolean refreshColumns, boolean keepState, boolean fitVa
}
}
}
controlWasHidden = getClientArea().height == 0;

if (refreshColumns) {
this.removeAll();
Expand Down

0 comments on commit 0dde5c3

Please sign in to comment.