Changeset 5725 in josm
- Timestamp:
- 2013-02-17T20:09:56+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r5720 r5725 92 92 public class RelationListDialog extends ToggleDialog implements DataSetListener { 93 93 /** The display list. */ 94 private JList displaylist;94 private final JList displaylist; 95 95 /** the list model used */ 96 private RelationListModel model;96 private final RelationListModel model; 97 97 98 98 /** the edit action */ 99 private EditAction editAction;99 private final EditAction editAction; 100 100 /** the delete action */ 101 private DeleteAction deleteAction;102 private NewAction newAction;103 private AddToRelation addToRelation;101 private final DeleteAction deleteAction; 102 private final NewAction newAction; 103 private final AddToRelation addToRelation; 104 104 /** the popup menu */ 105 private RelationDialogPopupMenu popupMenu; 106 105 private final RelationDialogPopupMenu popupMenu; 106 107 private final JTextField filter; 108 107 109 /** 108 110 * constructor … … 155 157 displaylist.addListSelectionListener(selectAction); 156 158 157 fi nal JTextField filter = new DisableShortcutsOnFocusGainedTextField();159 filter = new DisableShortcutsOnFocusGainedTextField(); 158 160 filter.setToolTipText(tr("Relation list filter")); 159 161 filter.getDocument().addDocumentListener(new DocumentListener() { … … 228 230 DataSet.removeSelectionListener(addToRelation); 229 231 } 232 233 private void resetFilter() { 234 filter.setText(null); 235 } 230 236 231 237 /** … … 293 299 } else { 294 300 model.setSelectedRelations(relations); 295 Integer i = model.get RelationIndex(relations.iterator().next());301 Integer i = model.getVisibleRelationIndex(relations.iterator().next()); 296 302 if (i != null) { // Not all relations have to be in the list (for example when the relation list is hidden, it's not updated with new relations) 297 303 displaylist.scrollRectToVisible(displaylist.getCellBounds(i, i)); … … 907 913 if (sel == null || sel.isEmpty()) 908 914 return; 915 if (!getVisibleRelations().containsAll(sel)) { 916 resetFilter(); 917 } 909 918 for (Relation r: sel) { 910 int i = relations.indexOf(r);919 int i = getVisibleRelationIndex(r); 911 920 if (i<0) { 912 921 continue; … … 928 937 return i; 929 938 } 939 940 private Integer getVisibleRelationIndex(Relation rel) { 941 int i = getVisibleRelations().indexOf(rel); 942 if (i<0) 943 return null; 944 return i; 945 } 930 946 931 947 public void updateTitle() {
Note:
See TracChangeset
for help on using the changeset viewer.