Changeset 19279 in josm
- Timestamp:
- 2025-01-10T07:16:23+01:00 (2 weeks ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r19050 r19279 6 6 7 7 import java.awt.BorderLayout; 8 import java.awt.Component;9 8 import java.awt.Dimension; 10 9 import java.awt.FlowLayout; … … 162 161 private final ArrayList<FlavorListener> clipboardListeners = new ArrayList<>(); 163 162 164 private Component selectedTabPane;165 private final JTabbedPane tabbedPane;166 167 163 /** 168 164 * Creates a new relation editor for the given relation. The relation will be saved if the user … … 236 232 237 233 getContentPane().setLayout(new BorderLayout()); 234 final JTabbedPane tabbedPane; 238 235 tabbedPane = new JTabbedPane(); 239 236 tabbedPane.add(tr("Tags and Members"), pnl); … … 241 238 tabbedPane.add(tr("Parent Relations"), referrerBrowser); 242 239 tabbedPane.add(tr("Child Relations"), new ChildRelationBrowser(getLayer(), relation)); 243 selectedTabPane = tabbedPane.getSelectedComponent();244 240 tabbedPane.addChangeListener(e -> { 245 241 JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource(); … … 249 245 referrerBrowser.init(); 250 246 } 251 // see #20228252 boolean selIsTagsAndMembers = sourceTabbedPane.getSelectedComponent() == pnl;253 if (selectedTabPane == pnl && !selIsTagsAndMembers) {254 unregisterMain();255 } else if (selectedTabPane != pnl && selIsTagsAndMembers) {256 registerMain();257 }258 selectedTabPane = sourceTabbedPane.getSelectedComponent();259 247 }); 260 248 … … 329 317 HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/RelationEditor")); 330 318 UndoRedoHandler.getInstance().addCommandQueueListener(this); 331 }332 333 private void registerMain() {334 selectionTableModel.register();335 memberTableModel.register();336 memberTable.registerListeners();337 }338 339 private void unregisterMain() {340 selectionTableModel.unregister();341 memberTableModel.unregister();342 memberTable.unregisterListeners();343 319 } 344 320 … … 789 765 // 790 766 memberTable.stopHighlighting(); 791 if (tabbedPane != null && tr("Tags and Members").equals(tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()))) { 792 unregisterMain(); 793 } 767 selectionTableModel.unregister(); 768 memberTableModel.unregister(); 769 memberTable.unregisterListeners(); 770 794 771 if (windowMenuItem != null) { 795 772 MainApplication.getMenu().windowMenu.remove(windowMenuItem); … … 898 875 super.dispose(); // call before setting relation to null, see #20304 899 876 setRelation(null); 900 selectedTabPane = null;901 877 } 902 878 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r18801 r19279 133 133 // just trigger a repaint - the display name of the relation members may have changed 134 134 Collection<RelationMember> sel = getSelectedMembers(); 135 GuiHelper.runInEDT(this::fireTableDataChanged); 136 setSelectedMembers(sel); 135 GuiHelper.runInEDT(() -> { 136 fireTableDataChanged(); 137 setSelectedMembers(sel); 138 }); 137 139 } 138 140
Note:
See TracChangeset
for help on using the changeset viewer.