Changeset 17423 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2020-12-22T09:28:39+01:00 (4 years 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
r17358 r17423 6 6 7 7 import java.awt.BorderLayout; 8 import java.awt.Component; 8 9 import java.awt.Dimension; 9 10 import java.awt.FlowLayout; … … 170 171 private final ArrayList<FlavorListener> clipboardListeners = new ArrayList<>(); 171 172 173 private Component selectedTabPane; 174 private JTabbedPane tabbedPane; 175 172 176 /** 173 177 * Creates a new relation editor for the given relation. The relation will be saved if the user … … 236 240 237 241 getContentPane().setLayout(new BorderLayout()); 238 JTabbedPanetabbedPane = new JTabbedPane();242 tabbedPane = new JTabbedPane(); 239 243 tabbedPane.add(tr("Tags and Members"), pnl); 240 244 referrerBrowser = new ReferringRelationsBrowser(getLayer(), referrerModel); 241 245 tabbedPane.add(tr("Parent Relations"), referrerBrowser); 242 246 tabbedPane.add(tr("Child Relations"), new ChildRelationBrowser(getLayer(), relation)); 247 selectedTabPane = tabbedPane.getSelectedComponent(); 243 248 tabbedPane.addChangeListener(e -> { 244 249 JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource(); … … 248 253 referrerBrowser.init(); 249 254 } 255 // see #20228 256 boolean selIsTagsAndMembers = sourceTabbedPane.getSelectedComponent() == pnl; 257 if (selectedTabPane == pnl && !selIsTagsAndMembers) { 258 unregisterMain(); 259 } else if (selectedTabPane != pnl && selIsTagsAndMembers) { 260 registerMain(); 261 } 262 selectedTabPane = sourceTabbedPane.getSelectedComponent(); 250 263 }); 251 264 … … 313 326 HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/RelationEditor")); 314 327 UndoRedoHandler.getInstance().addCommandQueueListener(this); 328 } 329 330 private void registerMain() { 331 selectionTableModel.register(); 332 memberTableModel.register(); 333 memberTable.registerListeners(); 334 } 335 336 private void unregisterMain() { 337 selectionTableModel.unregister(); 338 memberTableModel.unregister(); 339 memberTable.unregisterListeners(); 315 340 } 316 341 … … 733 758 // 734 759 memberTable.stopHighlighting(); 735 selectionTableModel.unregister();736 memberTableModel.unregister();737 memberTable.unregisterListeners();760 if (tabbedPane != null && tr("Tags and Members").equals(tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()))) { 761 unregisterMain(); 762 } 738 763 if (windowMenuItem != null) { 739 764 MainApplication.getMenu().windowMenu.remove(windowMenuItem); … … 841 866 UndoRedoHandler.getInstance().removeCommandQueueListener(this); 842 867 setRelation(null); 868 selectedTabPane = null; 843 869 super.dispose(); 844 870 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r17217 r17423 134 134 // just trigger a repaint - the display name of the relation members may have changed 135 135 Collection<RelationMember> sel = getSelectedMembers(); 136 GuiHelper.runInEDT AndWait(this::fireTableDataChanged);136 GuiHelper.runInEDT(this::fireTableDataChanged); 137 137 setSelectedMembers(sel); 138 138 }
Note:
See TracChangeset
for help on using the changeset viewer.