IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
95 | 95 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetHandler; |
96 | 96 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType; |
97 | 97 | import org.openstreetmap.josm.gui.util.HighlightHelper; |
| 98 | import org.openstreetmap.josm.gui.util.TableHelper; |
98 | 99 | import org.openstreetmap.josm.gui.widgets.CompileSearchTextDecorator; |
99 | 100 | import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField; |
100 | 101 | import org.openstreetmap.josm.gui.widgets.JosmTextField; |
… |
… |
|
308 | 309 | // setting up the tags table |
309 | 310 | tagData.setColumnIdentifiers(new String[]{tr("Key"), tr("Value")}); |
310 | 311 | tagTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
| 312 | tagTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
311 | 313 | tagTable.getTableHeader().setReorderingAllowed(false); |
312 | 314 | |
313 | 315 | tagTable.getColumnModel().getColumn(0).setCellRenderer(cellRenderer); |
… |
… |
|
332 | 334 | private void buildMembershipTable() { |
333 | 335 | membershipData.setColumnIdentifiers(new String[]{tr("Member Of"), tr("Role"), tr("Position")}); |
334 | 336 | membershipTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
| 337 | membershipTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
335 | 338 | |
336 | 339 | TableColumnModel mod = membershipTable.getColumnModel(); |
337 | 340 | membershipTable.getTableHeader().setReorderingAllowed(false); |
… |
… |
|
669 | 672 | selectSth.setVisible(!hasSelection); |
670 | 673 | pluginHook.setVisible(hasSelection); |
671 | 674 | |
| 675 | // resize tables to fit content |
| 676 | TableHelper.computeColumnsWidth(tagTable); |
| 677 | TableHelper.computeColumnsWidth(membershipTable); |
| 678 | |
672 | 679 | int selectedIndex; |
673 | 680 | if (selectedTag != null && (selectedIndex = findViewRow(tagTable, tagData, selectedTag)) != -1) { |
674 | 681 | tagTable.changeSelection(selectedIndex, 0, false, false); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
33 | 33 | } |
34 | 34 | tbl.getColumnModel().getColumn(col).setPreferredWidth(Math.min(maxwidth+10, maxColumnWidth)); |
35 | 35 | } |
| 36 | |
| 37 | /** |
| 38 | * adjust the table's columns to fit their content best |
| 39 | * requires JTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| 40 | * @param tbl table |
| 41 | */ |
| 42 | public static void computeColumnsWidth(JTable tbl) { |
| 43 | for (int column = 0; column < tbl.getColumnCount(); column++) { |
| 44 | adjustColumnWidth(tbl, column, Integer.MAX_VALUE); |
| 45 | } |
| 46 | } |
36 | 47 | } |