Changeset 4795 in josm


Ignore:
Timestamp:
2012-01-15T19:46:00+01:00 (13 years ago)
Author:
simon04
Message:

fix #5796 - remotecontrol: load_and_zoom/zoom: select relations in the relation toggle dialog

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r4536 r4795  
    211211     */
    212212    public void selectRelation(Relation relation) {
    213         if (relation == null) {
     213        selectRelations(Collections.singleton(relation));
     214    }
     215
     216    /**
     217     * Selects the relations in the list of relations.
     218     * @param relations  the relations to be selected
     219     */
     220    public void selectRelations(Collection<Relation> relations) {
     221        if (relations == null || relations.isEmpty()) {
    214222            model.setSelectedRelations(null);
    215223        } else {
    216             model.setSelectedRelations(Collections.singletonList(relation));
    217             Integer i = model.getRelationIndex(relation);
     224            model.setSelectedRelations(relations);
     225            Integer i = model.getRelationIndex(relations.iterator().next());
    218226            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)
    219227                displaylist.scrollRectToVisible(displaylist.getCellBounds(i, i));
     
    740748         * @return sel the list of selected relations
    741749         */
    742         public void setSelectedRelations(List<Relation> sel) {
     750        public void setSelectedRelations(Collection<Relation> sel) {
    743751            selectionModel.clearSelection();
    744752            if (sel == null || sel.isEmpty())
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r4791 r4795  
    2525import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2626import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog;
     27import org.openstreetmap.josm.tools.Utils;
    2728
    2829/**
     
    173174                        new AutoScaleAction("selection").actionPerformed(null);
    174175                    }
     176                    if (Main.map != null && Main.map.relationListDialog != null) {
     177                        Main.map.relationListDialog.dataChanged(null);
     178                        Main.map.relationListDialog.selectRelations(Utils.filteredCollection(newSel, Relation.class));
     179                    }
    175180                }
    176181            });
Note: See TracChangeset for help on using the changeset viewer.