[vcs-log] when filters change, recalculate columns size

When filters change, commits with author with longer names can become visible. This often leads to author column being too small.
So need to recalculate preferred size in this case.

This of course creates a new problem: if user resizes a column, it should not be automatically adjusted. This is going to be fixed in later commits.
This commit is contained in:
Julia Beliaeva
2017-03-03 23:58:00 +03:00
parent c151998bb6
commit 0a0c40ce6d
2 changed files with 11 additions and 5 deletions
@@ -153,6 +153,8 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
public void updateDataPack(@NotNull VisiblePack visiblePack, boolean permGraphChanged) {
VcsLogGraphTable.Selection previousSelection = getSelection();
boolean filtersChanged = !getModel().getVisiblePack().getFilters().equals(visiblePack.getFilters());
getModel().setVisiblePack(visiblePack);
previousSelection.restore(visiblePack.getVisibleGraph(), true, permGraphChanged);
for (VcsLogHighlighter highlighter : myHighlighters) {
@@ -160,12 +162,11 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
}
setPaintBusy(false);
doLayout();
reLayout(filtersChanged);
}
@Override
public void doLayout() {
if (!myColumnsSizeInitialized) {
public void reLayout(boolean recalculatePreferredSize) {
if (!myColumnsSizeInitialized || recalculatePreferredSize) {
myColumnsSizeInitialized = initFixedColumnsPreferredSize();
}
updateCommitColumnWidth();
@@ -173,6 +174,11 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
super.doLayout();
}
@Override
public void doLayout() {
reLayout(false);
}
private boolean initFixedColumnsPreferredSize() {
Font tableFont = getTableFont();
@@ -68,7 +68,7 @@ public class VcsLogUiUtil {
@NotNull VcsLogData logData,
@NotNull Disposable disposableParent) {
Runnable miniDetailsLoadedListener = () -> {
graphTable.doLayout();
graphTable.reLayout(false);
graphTable.repaint();
};
Runnable containingBranchesListener = () -> {