From 0a6e14ca939faca724d8db7840b9b414a2fb7a1c Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Thu, 18 Feb 2016 18:46:51 +0300 Subject: [PATCH] [vcs-log] use bold font to calculate column width --- .../vcs/log/ui/frame/VcsLogGraphTable.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java index 4d3f9c58d8b7..87156c9d72db 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java @@ -67,9 +67,7 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.Collection; -import java.util.Date; -import java.util.EventObject; +import java.util.*; import java.util.List; public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvider { @@ -135,7 +133,7 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi getGraphTableModel().setVisiblePack(visiblePack); previousSelection.restore(visiblePack.getVisibleGraph(), true); - for (VcsLogHighlighter highlighter: myHighlighters) { + for (VcsLogHighlighter highlighter : myHighlighters) { highlighter.update(visiblePack, permGraphChanged); } @@ -177,15 +175,17 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi int maxWidth = 0; for (int row = 0; row < maxRowsToCheck; row++) { String value = getModel().getValueAt(row, i).toString(); - maxWidth = Math.max(getFontMetrics(tableFont).stringWidth(value), maxWidth); + maxWidth = Math.max(getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth(value), maxWidth); if (!value.isEmpty()) sizeCalculated = true; } - column.setMinWidth(Math.min(maxWidth + UIUtil.DEFAULT_HGAP, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH)); - column.setWidth(column.getMinWidth()); + int min = Math.min(maxWidth + UIUtil.DEFAULT_HGAP, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH); + column.setMinWidth(min); + column.setWidth(min); } else if (i == GraphTableModel.DATE_COLUMN) { // all dates have nearly equal sizes - column.setMinWidth(getFontMetrics(tableFont).stringWidth("mm" + DateFormatUtil.formatDateTime(new Date()))); - column.setWidth(column.getMinWidth()); + int min = getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth("mm" + DateFormatUtil.formatDateTime(new Date())); + column.setMinWidth(min); + column.setWidth(min); } } return sizeCalculated;