- Timestamp:
- 2024-03-08T10:02:48+01:00 (10 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/history
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
r18801 r19013 12 12 import javax.swing.JSplitPane; 13 13 import javax.swing.JTabbedPane; 14 import javax.swing.event.ChangeEvent; 15 import javax.swing.event.ChangeListener; 14 16 15 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 23 25 * @since 1709 24 26 */ 25 public class HistoryBrowser extends JPanel implements Destroyable {27 public class HistoryBrowser extends JPanel implements Destroyable, ChangeListener { 26 28 27 29 /** the model */ … … 116 118 boolean samePrimitive = model.isSamePrimitive(history); // needs to be before setHistory 117 119 model.setHistory(history); 120 model.addChangeListener(this); 118 121 if (samePrimitive) { 119 122 // no need to rebuild the UI … … 160 163 if (model != null) { 161 164 model.unlinkAsListener(); 165 model.removeChangeListener(this); 162 166 model = null; 163 167 } … … 169 173 coordinateInfoViewer = null; 170 174 } 175 176 @Override 177 public void stateChanged(ChangeEvent e) { 178 tagInfoViewer.adjustWidths(); 179 } 171 180 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r17471 r19013 19 19 import javax.swing.JOptionPane; 20 20 import javax.swing.SwingUtilities; 21 import javax.swing.event.ChangeEvent; 21 22 22 23 import org.openstreetmap.josm.data.osm.PrimitiveId; … … 148 149 placeOnScreen(dialog); 149 150 dialog.setVisible(true); 151 dialog.getHistoryBrowser().stateChanged(new ChangeEvent(this)); 150 152 dialogs.put(h.getId(), dialog); 151 153 } -
trunk/src/org/openstreetmap/josm/gui/history/TagInfoViewer.java
r17921 r19013 36 36 */ 37 37 public class TagInfoViewer extends HistoryViewerPanel { 38 private JTable reference; 39 private JTable current; 38 40 private static final class RepaintOnFocusChange implements FocusListener { 39 41 @Override … … 63 65 @Override 64 66 protected JTable buildReferenceTable() { 65 return buildTable(PointInTimeType.REFERENCE_POINT_IN_TIME); 67 reference = buildTable(PointInTimeType.REFERENCE_POINT_IN_TIME); 68 return reference; 66 69 } 67 70 68 71 @Override 69 72 protected JTable buildCurrentTable() { 70 return buildTable(PointInTimeType.CURRENT_POINT_IN_TIME); 73 current = buildTable(PointInTimeType.CURRENT_POINT_IN_TIME); 74 return current; 71 75 } 72 76 … … 106 110 return table; 107 111 } 112 113 /** 114 * Use current data to adjust preferredWidth for both tables. 115 * @since 19013 116 */ 117 public void adjustWidths() { 118 // We have two tables with 3 columns each. no column should get more than 1/4 of the size 119 int maxWidth = this.getWidth() / 4; 120 if (maxWidth == 0) 121 maxWidth = Integer.MAX_VALUE; 122 adjustWidths(reference, maxWidth); 123 adjustWidths(current, maxWidth); 124 } 125 126 private static void adjustWidths(JTable table, int maxWidth) { 127 for (int column = 0; column < table.getColumnCount(); column++) { 128 TableHelper.adjustColumnWidth(table, column, maxWidth); 129 } 130 } 108 131 } -
trunk/src/org/openstreetmap/josm/gui/history/TagTableColumnModel.java
r17887 r19013 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import javax.swing.JLabel; 6 7 import javax.swing.table.DefaultTableColumnModel; 7 8 import javax.swing.table.TableColumn; … … 42 43 col.setCellRenderer(renderer); 43 44 col.setPreferredWidth(10); 45 col.setMaxWidth(new JLabel("v" + Long.MAX_VALUE).getMinimumSize().width); // See #23482 44 46 addColumn(col); 45 47 }
Note:
See TracChangeset
for help on using the changeset viewer.