Changeset 15600 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-12-19T00:30:56+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r15117 r15600 22 22 import javax.swing.JCheckBox; 23 23 import javax.swing.JEditorPane; 24 import javax.swing.JLabel; 24 25 import javax.swing.JPanel; 25 26 import javax.swing.event.ChangeEvent; … … 82 83 pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL)); 83 84 84 JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") 85 + "</b> (<a href=\"urn:changeset-source\">" + tr("obtain from current layers") + "</a>)<b>:</b>"); 86 sourceLabel.addHyperlinkListener(e -> { 85 JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") + ":</b>"); 86 pnl.add(sourceLabel, GBC.eol().insets(0, 8, 10, 0).fill(GBC.HORIZONTAL)); 87 JEditorPane obtainSourceOnce = new JMultilineLabel( 88 "<html><a href=\"urn:changeset-source\">" + tr("just once") + "</a></html>"); 89 obtainSourceOnce.addHyperlinkListener(e -> { 87 90 if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { 88 final String source = MainApplication.getMap().mapView.getLayerInformationForSourceTag(); 89 hcbUploadSource.setText(Utils.shortenString(source, Changeset.MAX_CHANGESET_TAG_LENGTH)); 90 changesetSourceModel.setComment(hcbUploadSource.getText()); // Fix #9965 91 automaticallyAddSource(); 91 92 } 92 93 }); 93 pnl.add(sourceLabel, GBC.eol().insets(0, 8, 10, 3).fill(GBC.HORIZONTAL)); 94 JCheckBox obtainSourceAutomatically = new JCheckBox(tr("Automatically obtain source from current layers")); 95 obtainSourceAutomatically.setSelected(Config.getPref().getBoolean("upload.source.obtainautomatically", false)); 96 obtainSourceAutomatically.addActionListener(e -> { 97 if (obtainSourceAutomatically.isSelected()) 98 automaticallyAddSource(); 99 100 obtainSourceOnce.setVisible(!obtainSourceAutomatically.isSelected()); 101 }); 102 JPanel obtainSource = new JPanel(new GridBagLayout()); 103 obtainSource.add(obtainSourceAutomatically, GBC.std().anchor(GBC.WEST)); 104 obtainSource.add(obtainSourceOnce, GBC.std().anchor(GBC.WEST)); 105 obtainSource.add(new JLabel(), GBC.eol().fill(GBC.HORIZONTAL)); 106 pnl.add(obtainSource, GBC.eol().insets(0, 0, 10, 3).fill(GBC.HORIZONTAL)); 94 107 95 108 hcbUploadSource.setToolTipText(tr("Enter a source")); … … 100 113 hcbUploadSource.getEditorComponent().addFocusListener(sourceModelListener); 101 114 pnl.add(hcbUploadSource, GBC.eol().fill(GBC.HORIZONTAL)); 115 if (obtainSourceAutomatically.isSelected()) { 116 automaticallyAddSource(); 117 } 102 118 return pnl; 119 } 120 121 /** 122 * Add the source tags 123 */ 124 protected void automaticallyAddSource() { 125 final String source = MainApplication.getMap().mapView.getLayerInformationForSourceTag(); 126 hcbUploadSource.setText(Utils.shortenString(source, Changeset.MAX_CHANGESET_TAG_LENGTH)); 127 changesetSourceModel.setComment(hcbUploadSource.getText()); // Fix #9965 103 128 } 104 129
Note:
See TracChangeset
for help on using the changeset viewer.