Changeset 16960 in josm for trunk/src/org
- Timestamp:
- 2020-08-29T13:33:25+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r16828 r16960 210 210 // 211 211 layerList = new LayerList(model); 212 TableHelper.setFont(layerList, getClass()); 212 213 layerList.setSelectionModel(selectionModel); 213 214 layerList.addMouseListener(new PopupMenuHandler()); … … 919 920 Icon icon = layer.getIcon(); 920 921 if (layerList != null && icon != null) { 921 layerList.setRowHeight(idx, Math.max( 16, icon.getIconHeight()));922 layerList.setRowHeight(idx, Math.max(layerList.getRowHeight(), icon.getIconHeight())); 922 923 } 923 924 selectionModel.setSelectionInterval(idx, idx); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r16598 r16960 315 315 private void buildTagsTable() { 316 316 // setting up the tags table 317 TableHelper.setFont(tagTable, getClass()); 317 318 tagData.setColumnIdentifiers(new String[]{tr("Key"), tr("Value")}); 318 319 tagTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); … … 339 340 340 341 private void buildMembershipTable() { 342 TableHelper.setFont(membershipTable, getClass()); 341 343 membershipData.setColumnIdentifiers(new String[]{tr("Member Of"), tr("Role"), tr("Position")}); 342 344 membershipTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTable.java
r15048 r16960 9 9 import javax.swing.ListSelectionModel; 10 10 import javax.swing.SwingUtilities; 11 12 import org.openstreetmap.josm.gui.util.TableHelper; 11 13 12 14 /** … … 32 34 33 35 protected void build() { 36 TableHelper.setFont(this, getClass()); 34 37 setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 35 38 addMouseListener(new DoubleClickAdapter()); -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r16419 r16960 51 51 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 52 52 import org.openstreetmap.josm.gui.util.GuiHelper; 53 import org.openstreetmap.josm.gui.util.TableHelper; 53 54 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 54 55 import org.openstreetmap.josm.gui.widgets.JosmComboBox; … … 144 145 columnmodel = new NamedResultTableColumnModel(); 145 146 tblSearchResults = new JTable(model, columnmodel); 147 TableHelper.setFont(tblSearchResults, DownloadDialog.class); 146 148 tblSearchResults.setSelectionModel(selectionModel); 147 149 JScrollPane scrollPane = new JScrollPane(tblSearchResults); -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r16644 r16960 14 14 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 15 15 import org.openstreetmap.josm.data.osm.history.History; 16 import org.openstreetmap.josm.gui.util.TableHelper; 16 17 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 17 18 … … 41 42 final NodeListTableColumnModel columnModel = new NodeListTableColumnModel(); 42 43 final JTable table = new JTable(tableModel, columnModel); 44 TableHelper.setFont(table, getClass()); 43 45 tableModel.addTableModelListener(new ReversedChangeListener(table, columnModel, tr("The nodes of this way are in reverse order"))); 44 46 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java
r16609 r16960 13 13 import org.openstreetmap.josm.data.osm.RelationMemberData; 14 14 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 15 import org.openstreetmap.josm.gui.util.TableHelper; 15 16 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 16 17 … … 32 33 final RelationMemberTableColumnModel columnModel = new RelationMemberTableColumnModel(); 33 34 final JTable table = new JTable(tableModel, columnModel); 35 TableHelper.setFont(table, getClass()); 34 36 tableModel.addTableModelListener(new ReversedChangeListener( 35 37 table, columnModel, tr("The members of this relation are in reverse order"))); -
trunk/src/org/openstreetmap/josm/gui/history/TagInfoViewer.java
r16597 r16960 25 25 import org.openstreetmap.josm.gui.dialogs.properties.HelpTagAction; 26 26 import org.openstreetmap.josm.gui.dialogs.properties.TaginfoAction; 27 import org.openstreetmap.josm.gui.util.TableHelper; 27 28 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 28 29 … … 67 68 TagTableModel tagTableModel = model.getTagTableModel(pointInTime); 68 69 JTable table = new JTable(tagTableModel, new TagTableColumnModel()); 70 TableHelper.setFont(table, getClass()); 69 71 table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 70 72 selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel()); -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r16457 r16960 34 34 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; 35 35 import org.openstreetmap.josm.gui.util.GuiHelper; 36 import org.openstreetmap.josm.gui.util.TableHelper; 36 37 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 37 38 import org.openstreetmap.josm.io.XmlWriter; … … 69 70 setShowGrid(false); 70 71 setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 72 TableHelper.setFont(this, getClass()); 71 73 GuiHelper.setBackgroundReadable(this, UIManager.getColor("Button.background")); 72 74 setIntercellSpacing(new Dimension(6, 0)); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java
r16942 r16960 318 318 super(model); 319 319 this.content = content; 320 TableHelper.setFont(this, getClass()); 320 321 } 321 322 -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/WMTSLayerSelection.java
r16553 r16960 24 24 25 25 import org.openstreetmap.josm.data.imagery.WMTSTileSource.Layer; 26 import org.openstreetmap.josm.gui.util.TableHelper; 26 27 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 27 28 import org.openstreetmap.josm.tools.GBC; … … 96 97 list = new JTable( 97 98 new AbstractTableModelExtension(layers)); 99 TableHelper.setFont(list, getClass()); 98 100 list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 99 101 list.setAutoCreateRowSorter(true); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r16601 r16960 338 338 iconPathsModel = new IconPathTableModel(selectionModel); 339 339 tblIconPaths = new JTable(iconPathsModel); 340 TableHelper.setFont(tblIconPaths, getClass()); 340 341 tblIconPaths.setSelectionModel(selectionModel); 341 342 tblIconPaths.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java
r16553 r16960 23 23 import javax.swing.table.TableCellEditor; 24 24 25 import org.openstreetmap.josm.gui.util.TableHelper; 25 26 import org.openstreetmap.josm.gui.widgets.JosmTextField; 26 27 import org.openstreetmap.josm.tools.GBC; … … 55 56 tableModel = newTableModel(); 56 57 table = new JTable(tableModel); 58 TableHelper.setFont(table, PreferencesTable.class); 57 59 setContent(build(), false); 58 60 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r14153 r16960 16 16 import javax.swing.table.AbstractTableModel; 17 17 18 import org.openstreetmap.josm.gui.util.TableHelper; 18 19 import org.openstreetmap.josm.gui.widgets.JosmTextField; 19 20 import org.openstreetmap.josm.spi.preferences.ListSetting; … … 51 52 p.add(new JLabel(tr("Key: {0}", entry.getKey())), GBC.eol().insets(0, 0, 5, 0)); 52 53 JTable table = new JTable(model); 54 TableHelper.setFont(table, getClass()); 53 55 table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); 54 56 table.setTableHeader(null); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r16846 r16960 31 31 import org.openstreetmap.josm.gui.ExtendedDialog; 32 32 import org.openstreetmap.josm.gui.util.GuiHelper; 33 import org.openstreetmap.josm.gui.util.TableHelper; 33 34 import org.openstreetmap.josm.gui.widgets.JosmTextField; 34 35 import org.openstreetmap.josm.spi.preferences.ListListSetting; … … 59 60 getColumnModel().getColumn(1).setCellEditor(new SettingCellEditor()); 60 61 62 TableHelper.setFont(this, getClass()); 61 63 addMouseListener(new MouseAdapter() { 62 64 @Override public void mouseClicked(MouseEvent e) { -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r16625 r16960 53 53 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 54 54 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 55 import org.openstreetmap.josm.gui.preferences.advanced.PreferencesTable; 55 56 import org.openstreetmap.josm.gui.util.GuiHelper; 57 import org.openstreetmap.josm.gui.util.TableHelper; 56 58 import org.openstreetmap.josm.gui.widgets.FilterField; 57 59 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 307 309 308 310 colors = new JTable(tableModel); 311 TableHelper.setFont(colors, PreferencesTable.class); 309 312 colors.setAutoCreateRowSorter(true); 310 313 FilterField colorFilter = new FilterField().filter(colors, tableModel); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheSettingsPanel.java
r16398 r16960 40 40 import org.openstreetmap.josm.gui.layer.WMTSLayer; 41 41 import org.openstreetmap.josm.gui.util.GuiHelper; 42 import org.openstreetmap.josm.gui.util.TableHelper; 42 43 import org.openstreetmap.josm.gui.widgets.ButtonColumn; 43 44 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 147 148 private static JTable getTableForCache(final CacheAccess<String, BufferedImageCacheEntry> cache, final TableModel tableModel) { 148 149 final JTable ret = new JTable(tableModel); 150 TableHelper.setFont(ret, CacheSettingsPanel.class); 149 151 150 152 ButtonColumn buttonColumn = new ButtonColumn( -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r15115 r16960 41 41 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 42 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 import org.openstreetmap.josm.gui.util.TableHelper; 43 44 import org.openstreetmap.josm.tools.GBC; 44 45 import org.openstreetmap.josm.tools.Logging; … … 198 199 } 199 200 }; 201 TableHelper.setFont(list, getClass()); 200 202 JScrollPane scroll = new JScrollPane(list); 201 203 add(scroll, GBC.eol().fill(GridBagConstraints.BOTH)); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
r16555 r16960 62 62 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 63 63 import org.openstreetmap.josm.gui.util.GuiHelper; 64 import org.openstreetmap.josm.gui.util.TableHelper; 64 65 import org.openstreetmap.josm.gui.widgets.FilterField; 65 66 import org.openstreetmap.josm.gui.widgets.HtmlPanel; … … 224 225 } 225 226 }; 227 TableHelper.setFont(activeTable, getClass()); 226 228 activeTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); 227 229 228 230 defaultModel = new ImageryDefaultLayerTableModel(); 229 231 defaultTable = new JTable(defaultModel); 232 TableHelper.setFont(defaultTable, getClass()); 230 233 defaultTable.setAutoCreateRowSorter(true); 231 234 defaultFilter = new FilterField().filter(defaultTable, defaultModel); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeSelectionPanel.java
r13544 r16960 22 22 import org.openstreetmap.josm.data.projection.Projections; 23 23 import org.openstreetmap.josm.gui.preferences.projection.CodeProjectionChoice.CodeComparator; 24 import org.openstreetmap.josm.gui.util.TableHelper; 24 25 import org.openstreetmap.josm.gui.widgets.JosmTextField; 25 26 import org.openstreetmap.josm.tools.GBC; … … 97 98 98 99 table = new JTable(model); 100 TableHelper.setFont(table, getClass()); 99 101 table.setAutoCreateRowSorter(true); 100 102 JScrollPane scroll = new JScrollPane(table); -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r16913 r16960 41 41 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 42 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 import org.openstreetmap.josm.gui.util.TableHelper; 43 44 import org.openstreetmap.josm.gui.widgets.FilterField; 44 45 import org.openstreetmap.josm.gui.widgets.JosmComboBox; … … 194 195 195 196 // This is the list of shortcuts: 197 TableHelper.setFont(shortcutTable, getClass()); 196 198 shortcutTable.setModel(model); 197 199 shortcutTable.getSelectionModel().addListSelectionListener(action); -
trunk/src/org/openstreetmap/josm/gui/util/TableHelper.java
r16601 r16960 3 3 4 4 import java.awt.Component; 5 import java.awt.Font; 5 6 import java.util.stream.IntStream; 6 7 … … 14 15 15 16 import org.openstreetmap.josm.gui.dialogs.IEnabledStateUpdating; 17 import org.openstreetmap.josm.spi.preferences.Config; 16 18 17 19 /** … … 162 164 selectionModel.setValueIsAdjusting(false); 163 165 } 166 167 /** 168 * Sets the table font size based on the font scaling from the preferences 169 * @param table the table 170 * @param parent the parent component used for determining the preference key 171 * @see JTable#setFont(Font) 172 * @see JTable#setRowHeight(int) 173 */ 174 public static void setFont(JTable table, Class<? extends Component> parent) { 175 double fontFactor = Config.getPref().getDouble("gui.scale.table.font", 176 Config.getPref().getDouble("gui.scale.table." + parent.getSimpleName() + ".font", 1.0)); 177 if (fontFactor == 1.0) { 178 return; 179 } 180 Font font = table.getFont(); 181 table.setFont(font.deriveFont((float) (font.getSize2D() * fontFactor))); 182 // need to setRowHeight, see comment in javax.swing.plaf.basic.BasicTableUI.installDefaults 183 table.setRowHeight((int) (table.getRowHeight() * fontFactor)); 184 } 164 185 } -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmTable.java
r10070 r16960 17 17 import javax.swing.table.TableModel; 18 18 19 import org.openstreetmap.josm.gui.util.TableHelper; 20 19 21 /** 20 22 * Generic table offering custom cell navigation features. … … 34 36 protected JosmTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm) { 35 37 super(dm, cm, sm); 38 TableHelper.setFont(this, getClass()); 36 39 } 37 40 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r16791 r16960 194 194 }; 195 195 196 TableHelper.setFont(propertyTable, getClass()); 196 197 propertyTable.setAutoCreateRowSorter(true); 197 198 propertyTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
Note:
See TracChangeset
for help on using the changeset viewer.