- Timestamp:
- 2020-05-17T22:19:47+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/history
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r15772 r16456 13 13 import javax.swing.JTable; 14 14 import javax.swing.ListSelectionModel; 15 import javax.swing.event.TableModelEvent;16 import javax.swing.event.TableModelListener;17 15 18 16 import org.openstreetmap.josm.actions.AutoScaleAction; … … 56 54 final NodeListTableColumnModel columnModel = new NodeListTableColumnModel(); 57 55 final JTable table = new JTable(tableModel, columnModel); 58 tableModel.addTableModelListener(new ReversedChangeListener(table, columnModel ));56 tableModel.addTableModelListener(new ReversedChangeListener(table, columnModel, tr("The nodes of this way are in reverse order"))); 59 57 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 60 58 selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel()); … … 62 60 table.addMouseListener(new DoubleClickAdapter(table)); 63 61 return table; 64 }65 66 static final class ReversedChangeListener implements TableModelListener {67 private final NodeListTableColumnModel columnModel;68 private final JTable table;69 private Boolean reversed;70 private final String nonReversedText;71 private final String reversedText;72 73 ReversedChangeListener(JTable table, NodeListTableColumnModel columnModel) {74 this.columnModel = columnModel;75 this.table = table;76 nonReversedText = tr("Nodes") + (table.getFont().canDisplay('\u25bc') ? " \u25bc" : " (1-n)");77 reversedText = tr("Nodes") + (table.getFont().canDisplay('\u25b2') ? " \u25b2" : " (n-1)");78 }79 80 @Override81 public void tableChanged(TableModelEvent e) {82 if (e.getSource() instanceof DiffTableModel) {83 final DiffTableModel mod = (DiffTableModel) e.getSource();84 if (reversed == null || reversed != mod.isReversed()) {85 reversed = mod.isReversed();86 columnModel.getColumn(0).setHeaderValue(reversed ? reversedText : nonReversedText);87 table.getTableHeader().setToolTipText(88 reversed ? tr("The nodes of this way are in reverse order") : null);89 table.getTableHeader().repaint();90 }91 }92 }93 62 } 94 63 -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java
r15774 r16456 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.history; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.awt.Rectangle; … … 21 23 @Override 22 24 protected JTable buildTable(PointInTimeType pointInTimeType) { 23 JTable table = new JTable( 24 model.getRelationMemberTableModel(pointInTimeType), 25 new RelationMemberTableColumnModel()); 25 DiffTableModel tableModel = model.getRelationMemberTableModel(pointInTimeType); 26 RelationMemberTableColumnModel columnModel = new RelationMemberTableColumnModel(); 27 JTable table = new JTable(tableModel, columnModel); 28 tableModel.addTableModelListener(new ReversedChangeListener( 29 table, columnModel, tr("The members of this relation are in reverse order"))); 26 30 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 27 31 selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
Note:
See TracChangeset
for help on using the changeset viewer.