Changeset 3102 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationMemberTask.java
- Timestamp:
- 10.03.2010 10:00:20 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationMemberTask.java
r3083 r3102 8 8 import java.io.IOException; 9 9 import java.util.Collection; 10 import java.util.HashSet; 11 import java.util.Set; 10 12 11 13 import javax.swing.SwingUtilities; … … 32 34 private boolean cancelled; 33 35 private Exception lastException; 34 private Relation parent;36 private final Set<Relation> parents = new HashSet<Relation>(); 35 37 private Collection<OsmPrimitive> children; 36 38 private OsmDataLayer curLayer; 37 39 private MultiFetchServerObjectReader objectReader; 38 40 39 public DownloadRelationMemberTask(Relation parent, Collection<OsmPrimitive> children, OsmDataLayer curLayer, MemberTableModel memberTableModel,Dialog dialog) {41 public DownloadRelationMemberTask(Relation parent, Collection<OsmPrimitive> children, OsmDataLayer curLayer, Dialog dialog) { 40 42 super(tr("Download relation members"), new PleaseWaitProgressMonitor(dialog), false /* don't ignore exception */); 41 this.parent = parent;43 this.parents.add(parent); 42 44 this.children = children; 43 45 this.curLayer = curLayer; 44 46 } 45 47 46 public DownloadRelationMemberTask(Relation parent, Collection<OsmPrimitive> children, OsmDataLayer curLayer , MemberTableModel memberTableModel) {48 public DownloadRelationMemberTask(Relation parent, Collection<OsmPrimitive> children, OsmDataLayer curLayer) { 47 49 super(tr("Download relation members"), false /* don't ignore exception */); 48 this.parent = parent; 50 this.parents.add(parent); 51 this.children = children; 52 this.curLayer = curLayer; 53 } 54 55 /** 56 * Creates a download task for downloading the child primitives {@code children} for all parent 57 * relations in {@code parents}. 58 * 59 * @param parents the collection of parent relations 60 * @param children the collection of child primitives to download 61 * @param curLayer the current OSM layer 62 */ 63 public DownloadRelationMemberTask(Collection<Relation> parents, Collection<OsmPrimitive> children, OsmDataLayer curLayer) { 64 super(tr("Download relation members"), false /* don't ignore exception */); 65 this.parents.addAll(parents); 49 66 this.children = children; 50 67 this.curLayer = curLayer; … … 71 88 } 72 89 90 protected String buildDownloadFeedbackMessage() { 91 if (parents.size() == 1) { 92 Relation parent = parents.iterator().next(); 93 return trn("Downloading {0} incomplete child of relation ''{1}''", 94 "Downloading {0} incomplete children of relation ''{1}''", 95 children.size(), 96 children.size(), 97 parent.getDisplayName(DefaultNameFormatter.getInstance()) 98 ); 99 } else 100 return trn("Downloading {0} incomplete child of {1} parent relations", 101 "Downloading {0} incomplete children of {1} parent relations", 102 children.size(), 103 children.size(), 104 parents.size() 105 ); 106 } 107 73 108 @Override 74 109 protected void realRun() throws SAXException, IOException, OsmTransferException { … … 80 115 objectReader.append(children); 81 116 progressMonitor.indeterminateSubTask( 82 trn("Downloading {0} incomplete child of relation ''{1}''", 83 "Downloading {0} incomplete children of relation ''{1}''", 84 children.size(), 85 children.size(), 86 parent.getDisplayName(DefaultNameFormatter.getInstance()) 87 ) 117 buildDownloadFeedbackMessage() 88 118 ); 89 119 final DataSet dataSet = objectReader.parseOsm(progressMonitor
Note: See TracChangeset
for help on using the changeset viewer.
