Changeset 1836 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2009-07-25T13:12:07+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed in #3074: "Parent relations" doesn't work without communicating with the server

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
2 edited

Legend:

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

    r1828 r1836  
    5858    private final GenericRelationEditor relationEditor;
    5959
    60     /** state flag for this browser. Initially initialized is false.
    61      * It becomes initialized after the first download of the parent
    62      * relations.
    63      */
    64     private boolean initialized;
    65 
    6660    /**
    6761     * build the GUI
     
    9791    }
    9892
    99 
    100     /**
    101      * Replies true this browser has initialized itself by downloading the reference relations
    102      * parents.
    103      *
    104      * @return true this browser has initialized itself by downloading the reference relations
    105      * parents; false, otherwise
    106      */
    107     public boolean isInitialized() {
    108         return initialized;
    109     }
    110 
    11193    public void init() {
    112         if (initialized) return;
    113         initialized = true;
    114         boolean full = cbReadFull.isSelected();
    115         ReloadTask task = new ReloadTask(full, relationEditor);
    116         Main.worker.submit(task);
     94        model.populate(getLayer().data);
    11795    }
    11896
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java

    r1828 r1836  
    66import javax.swing.AbstractListModel;
    77
     8import org.openstreetmap.josm.data.osm.DataSet;
    89import org.openstreetmap.josm.data.osm.Relation;
    910import org.openstreetmap.josm.data.osm.RelationMember;
     
    6667    }
    6768
     69    /**
     70     * Populates the browser with the list of referring relations in the {@see DataSet} ds.
     71     *
     72     * @param ds the data set
     73     */
     74    public void populate(DataSet ds) {
     75        referrers.clear();
     76        if (ds == null) {
     77            fireModelUpdate();
     78            return;
     79        }
     80        for (Relation parent : ds.relations) {
     81            if (isReferringRelation(parent)) {
     82                referrers.add(parent);
     83            }
     84        }
     85        fireModelUpdate();
     86    }
     87
     88
    6889    public boolean canReload() {
    6990        return relation != null && relation.id > 0;
Note: See TracChangeset for help on using the changeset viewer.