suppress automatic columns layout

This commit is contained in:
Gregory.Shrago
2016-05-10 10:45:18 +03:00
parent 7428ecc022
commit 97ae2e9a74
2 changed files with 34 additions and 14 deletions
@@ -72,6 +72,7 @@ public class DualView extends JPanel {
private final PropertyChangeListener myPropertyChangeListener;
private boolean myZipByHeight;
private boolean mySuppressStore;
public DualView(Object root, DualViewColumnInfo[] columns, @NonNls String columnServiceKey, Project project) {
super(new CardLayout());
@@ -87,7 +88,7 @@ public class DualView extends JPanel {
add(createFlatComponent(columns), FLAT);
(myTreeView.getTreeViewModel()).addTreeModelListener(new TreeModelListener() {
myTreeView.getTreeViewModel().addTreeModelListener(new TreeModelListener() {
public void treeNodesInserted(TreeModelEvent e) {
refreshFlatModel();
}
@@ -113,6 +114,7 @@ public class DualView extends JPanel {
myPropertyChangeListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (mySuppressStore) return;
saveState();
}
};
@@ -202,6 +204,17 @@ public class DualView extends JPanel {
public TableCellRenderer getCellRenderer(int row, int column) {
return createWrappedRenderer(super.getCellRenderer(row, column));
}
@Override
public void doLayout() {
try {
mySuppressStore = true;
super.doLayout();
}
finally {
mySuppressStore = false;
}
}
};
myTreeView.getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
JPanel result = new JPanel(new BorderLayout());
@@ -235,6 +248,22 @@ public class DualView extends JPanel {
}
return c;
}
@Override
public void doLayout() {
try {
mySuppressStore = true;
super.doLayout();
}
finally {
mySuppressStore = false;
}
}
@Override
public void updateColumnSizes() {
// suppress automatic layout, use stored values instead
}
};
myFlatView.setCellSelectionEnabled(false);
myFlatView.setColumnSelectionAllowed(false);
@@ -168,7 +168,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
@Override
public String getPreferredStringValue() {
return "123.4567";
return StringUtil.repeatSymbol('m', 10);
}
}
@@ -189,7 +189,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
@Override
public String getPreferredStringValue() {
return DateFormatUtil.formatPrettyDateTime(Clock.getTime());
return DateFormatUtil.formatPrettyDateTime(Clock.getTime() + 1000);
}
}
@@ -281,7 +281,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
@Override
@NonNls
public String getPreferredStringValue() {
return "author_author";
return StringUtil.repeatSymbol('m', 14);
}
}
@@ -314,7 +314,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
@Override
public String getPreferredStringValue() {
return StringUtil.repeatSymbol('a', 125);
return StringUtil.repeatSymbol('m', 80);
}
public TableCellRenderer getRenderer(VcsFileRevision p0) {
@@ -558,18 +558,10 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
wrapWithTreeElements(myHistorySession.getRevisionList())), myTargetSelection);
}
columnSizesOnce();
myDualView.expandAll();
myDualView.repaint();
}
private void columnSizesOnce() {
if (! myColumnSizesSet) {
myDualView.getFlatView().updateColumnSizes();
myColumnSizesSet = true;
}
}
private void adjustEmptyText() {
VirtualFile virtualFile = myFilePath.getVirtualFile();
if ((virtualFile == null || !virtualFile.isValid()) && !myFilePath.getIOFile().exists()) {
@@ -800,7 +792,6 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
mySplitter.repaint();
myRefresherI.run(true, useLastRevision);
columnSizesOnce();
}
}.callMe();
}