- Timestamp:
- 2010-12-27T17:45:32+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r3518 r3746 3 3 4 4 import java.awt.BorderLayout; 5 import java.util.HashMap; 5 6 import java.util.Map; 6 7 import java.util.Observable; … … 23 24 /** the model for the changeset comment */ 24 25 private ChangesetCommentModel changesetCommentModel; 25 26 /** tags that applied to uploaded changesets by default*/ 27 private Map<String, String> defaultTags = new HashMap<String, String>(); 26 28 27 29 protected void build() { … … 49 51 * @return the default value for "created_by" 50 52 */ 51 p rotectedString getDefaultCreatedBy() {53 public static String getDefaultCreatedBy() { 52 54 Object ua = System.getProperties().get("http.agent"); 53 55 return(ua == null) ? "JOSM" : ua.toString(); … … 82 84 } 83 85 84 p rotected void initNewChangeset() {86 public void initFromChangeset(Changeset cs) { 85 87 String currentComment = getUploadComment(); 86 pnlTagEditor.getModel().clear();87 if (c urrentComment!= null) {88 pnlTagEditor.getModel().add("comment", currentComment);88 Map<String,String> tags = getDefaultTags(); 89 if (cs != null) { 90 tags.putAll(cs.getKeys()); 89 91 } 90 pnlTagEditor.getModel().add("created_by", getDefaultCreatedBy());91 }92 93 protected void initFromExistingChangeset(Changeset cs) {94 String currentComment = getUploadComment();95 Map<String,String> tags = cs.getKeys();96 92 if (tags.get("comment") == null) { 97 93 tags.put("comment", currentComment); 98 94 } 99 tags.put("created_by", getDefaultCreatedBy()); 95 String created_by = tags.get("created_by"); 96 if (created_by == null || "".equals(created_by)) { 97 tags.put("created_by", getDefaultCreatedBy()); 98 } else if (!created_by.contains(getDefaultCreatedBy())) { 99 tags.put("created_by", created_by + ";" + getDefaultCreatedBy()); 100 } 100 101 pnlTagEditor.getModel().initFromTags(tags); 101 }102 103 public void initFromChangeset(Changeset cs) {104 if (cs == null) {105 initNewChangeset();106 } else {107 initFromExistingChangeset(cs);108 }109 102 } 110 103 … … 116 109 public Map<String,String> getTags() { 117 110 return pnlTagEditor.getModel().getTags(); 111 } 112 113 public Map<String,String> getDefaultTags() { 114 Map<String,String> tags = new HashMap<String, String>(); 115 tags.putAll(defaultTags); 116 return tags; 117 } 118 119 public void setDefaultTags(Map<String, String> tags) { 120 defaultTags.clear(); 121 defaultTags.putAll(tags); 118 122 } 119 123 -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r3719 r3746 17 17 import java.util.Collections; 18 18 import java.util.List; 19 import java.util.Map; 19 20 import java.util.logging.Logger; 20 21 … … 297 298 } 298 299 300 public Map<String, String> getDefaultChangesetTags() { 301 return pnlTagSettings.getDefaultTags(); 302 } 303 304 public void setDefaultChangesetTags(Map<String, String> tags) { 305 pnlTagSettings.setDefaultTags(tags); 306 } 307 299 308 /** 300 309 * Replies the {@see UploadStrategySpecification} the user entered in the dialog. … … 369 378 protected boolean warnUploadComment() { 370 379 ExtendedDialog dlg = new ExtendedDialog(UploadDialog.this, 371 tr("Please revise upload comment"),372 new String[] {tr("Revise"), tr("Cancel"), tr("Continue as is")});380 tr("Please revise upload comment"), 381 new String[] {tr("Revise"), tr("Cancel"), tr("Continue as is")}); 373 382 dlg.setContent("<html>" + 374 383 tr("Your upload comment is <i>empty</i>, or <i>very short</i>.<br /><br />" + 375 "This is technically allowed, but please consider that many users who are<br />" +376 "watching changes in their area depend on meaningful changeset comments<br />" +377 "to understand what is going on!<br /><br />" +378 "If you spend a minute now to explain your change, you will make life<br />" +379 380 384 "This is technically allowed, but please consider that many users who are<br />" + 385 "watching changes in their area depend on meaningful changeset comments<br />" + 386 "to understand what is going on!<br /><br />" + 387 "If you spend a minute now to explain your change, you will make life<br />" + 388 "easier for many other mappers.") + 389 "</html>"); 381 390 dlg.setButtonIcons(new Icon[] { 382 ImageProvider.get("ok"),383 ImageProvider.get("cancel"),384 ImageProvider.overlay(385 ImageProvider.get("upload"),386 new ImageIcon(ImageProvider.get("warning-small").getImage().getScaledInstance(10 , 10, Image.SCALE_SMOOTH)),387 ImageProvider.OverlayPosition.SOUTHEAST)});391 ImageProvider.get("ok"), 392 ImageProvider.get("cancel"), 393 ImageProvider.overlay( 394 ImageProvider.get("upload"), 395 new ImageIcon(ImageProvider.get("warning-small").getImage().getScaledInstance(10 , 10, Image.SCALE_SMOOTH)), 396 ImageProvider.OverlayPosition.SOUTHEAST)}); 388 397 dlg.setToolTipTexts(new String[] { 389 tr("Return to the previous dialog to enter a more descriptive comment"),390 tr("Cancel and return to the previous dialog"),391 tr("Ignore this hint and upload anyway")});398 tr("Return to the previous dialog to enter a more descriptive comment"), 399 tr("Cancel and return to the previous dialog"), 400 tr("Ignore this hint and upload anyway")}); 392 401 dlg.setIcon(JOptionPane.WARNING_MESSAGE); 393 402 dlg.toggleEnable("upload_comment_is_empty_or_very_short");
Note:
See TracChangeset
for help on using the changeset viewer.