Changeset 17709 in josm for trunk/src/org
- Timestamp:
- 2021-04-07T21:20:49+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r17475 r17709 19 19 20 20 import javax.swing.BorderFactory; 21 import javax.swing.BoxLayout;22 21 import javax.swing.JCheckBox; 23 22 import javax.swing.JEditorPane; … … 208 207 209 208 protected void build() { 210 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));209 setLayout(new GridBagLayout()); 211 210 setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); 212 add(buildUploadCommentPanel()); 213 add(buildUploadSourcePanel()); 214 add(pnlUploadParameterSummary); 211 GBC gbc = GBC.eol().insets(0, 0, 0, 20).fill(GBC.HORIZONTAL); 212 add(buildUploadCommentPanel(), gbc); 213 add(buildUploadSourcePanel(), gbc); 214 add(pnlUploadParameterSummary, gbc); 215 215 if (Config.getPref().getBoolean("upload.show.review.request", true)) { 216 JPanel pnl = new JPanel(new GridBagLayout()); 217 pnl.add(cbRequestReview, GBC.eol().fill(GBC.HORIZONTAL)); 218 add(pnl); 216 add(cbRequestReview, gbc); 219 217 cbRequestReview.addItemListener(e -> changesetReviewModel.setReviewRequested(e.getStateChange() == ItemEvent.SELECTED)); 220 218 } 221 JPanel pnl = new JPanel(new GridBagLayout()); 222 pnl.add(areaValidatorFeedback, GBC.eol().fill(GBC.HORIZONTAL)); 223 add(pnl); 219 add(areaValidatorFeedback, gbc); 220 add(new JPanel(), GBC.std().fill(GBC.BOTH)); 224 221 } 225 222 -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r14977 r17709 157 157 cbCloseAfterUpload.addItemListener(new CloseAfterUploadItemStateListener()); 158 158 159 gc.gridx = 0;160 gc.gridy = 5;161 gc.gridwidth = 4;162 gc.weightx = 1.0;163 gc.weighty = 1.0;164 gc.fill = GridBagConstraints.BOTH;165 add(new JPanel(), gc);166 167 159 rbUseNew.getModel().addItemListener(new RadioButtonHandler()); 168 160 rbExisting.getModel().addItemListener(new RadioButtonHandler()); -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r17708 r17709 6 6 import static org.openstreetmap.josm.tools.I18n.trn; 7 7 8 import java.awt.BorderLayout; 8 9 import java.awt.Component; 9 10 import java.awt.Dimension; … … 34 35 import javax.swing.JOptionPane; 35 36 import javax.swing.JPanel; 37 import javax.swing.JSplitPane; 36 38 import javax.swing.JTabbedPane; 39 import javax.swing.border.TitledBorder; 37 40 38 41 import org.openstreetmap.josm.data.APIDataSet; … … 81 84 private UploadStrategySelectionPanel pnlUploadStrategySelectionPanel; 82 85 86 private TitledBorder tagSettingsBorder; 83 87 /** checkbox for selecting whether an atomic upload is to be used */ 84 88 private TagSettingsPanel pnlTagSettings; … … 122 126 */ 123 127 protected JPanel buildContentPanel() { 124 JPanel pnl = new JPanel(new GridBagLayout());125 pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));128 final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 129 splitPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 126 130 127 131 // the panel with the list of uploaded objects 128 132 pnlUploadedObjects = new UploadedObjectsSummaryPanel(); 129 pnl.add(pnlUploadedObjects, GBC.eol().fill(GBC.BOTH)); 133 pnlUploadedObjects.setMinimumSize(new Dimension(200, 50)); 134 splitPane.setLeftComponent(pnlUploadedObjects); 130 135 131 136 // a tabbed pane with configuration panels in the lower half 132 137 tpConfigPanels = new CompactTabbedPane(); 138 splitPane.setRightComponent(tpConfigPanels); 133 139 134 140 pnlBasicUploadSettings = new BasicUploadSettingsPanel(changesetCommentModel, changesetSourceModel, changesetReviewModel); 135 141 tpConfigPanels.add(pnlBasicUploadSettings); 136 tpConfigPanels.setTitleAt(0, tr(" Settings"));142 tpConfigPanels.setTitleAt(0, tr("Description")); 137 143 tpConfigPanels.setToolTipTextAt(0, tr("Decide how to upload the data and which changeset to use")); 138 144 145 tagSettingsBorder = BorderFactory.createTitledBorder(tr("Tags of new changeset")); 139 146 pnlTagSettings = new TagSettingsPanel(changesetCommentModel, changesetSourceModel, changesetReviewModel); 140 tpConfigPanels.add(pnlTagSettings); 141 tpConfigPanels.setTitleAt(1, tr("Tags of new changeset")); 142 tpConfigPanels.setToolTipTextAt(1, tr("Apply tags to the changeset data is uploaded to")); 143 147 pnlTagSettings.setBorder(tagSettingsBorder); 144 148 pnlChangesetManagement = new ChangesetManagementPanel(changesetCommentModel); 145 tpConfigPanels.add(pnlChangesetManagement);146 tpConfigPanels.setTitleAt(2, tr("Changesets"));147 tpConfigPanels.setToolTipTextAt(2, tr("Manage open changesets and select a changeset to upload to"));148 149 149 pnlUploadStrategySelectionPanel = new UploadStrategySelectionPanel(); 150 tpConfigPanels.add(pnlUploadStrategySelectionPanel); 151 tpConfigPanels.setTitleAt(3, tr("Advanced")); 152 tpConfigPanels.setToolTipTextAt(3, tr("Configure advanced settings")); 153 154 pnl.add(tpConfigPanels, GBC.eol().fill(GBC.HORIZONTAL)); 155 156 pnl.add(buildActionPanel(), GBC.eol().fill(GBC.HORIZONTAL)); 150 JPanel pnlChangeset = new JPanel(new GridBagLayout()); 151 pnlChangeset.add(pnlChangesetManagement, GBC.eop().fill(GBC.HORIZONTAL)); 152 pnlChangeset.add(pnlUploadStrategySelectionPanel, GBC.eop().fill(GBC.HORIZONTAL)); 153 pnlChangeset.add(pnlTagSettings, GBC.eol().fill(GBC.BOTH)); 154 tpConfigPanels.add(pnlChangeset); 155 tpConfigPanels.setTitleAt(1, tr("Settings")); 156 157 JPanel pnl = new JPanel(new BorderLayout()); 158 pnl.add(splitPane, BorderLayout.CENTER); 159 pnl.add(buildActionPanel(), BorderLayout.SOUTH); 157 160 return pnl; 158 161 } … … 212 215 // 213 216 pnlBasicUploadSettings.getUploadParameterSummaryPanel().setConfigurationParameterRequestListener( 214 new ConfigurationParameterRequestHandler() { 215 @Override 216 public void handleUploadStrategyConfigurationRequest() { 217 tpConfigPanels.setSelectedIndex(3); 218 } 219 220 @Override 221 public void handleChangesetConfigurationRequest() { 222 tpConfigPanels.setSelectedIndex(2); 223 } 224 } 217 () -> tpConfigPanels.setSelectedIndex(2) 225 218 ); 226 219 … … 419 412 WindowGeometry.centerInWindow( 420 413 MainApplication.getMainFrame(), 421 new Dimension( 400, 600)414 new Dimension(800, 600) 422 415 ) 423 416 ).applySafe(this); … … 465 458 static boolean isUploadCommentTooShort(String comment) { 466 459 String s = Utils.strip(comment); 467 boolean result = true; 468 if (!s.isEmpty()) { 469 UnicodeBlock block = Character.UnicodeBlock.of(s.charAt(0)); 470 if (block != null && block.toString().contains("CJK")) { 471 result = s.length() < 4; 472 } else { 473 result = s.length() < 10; 474 } 475 } 476 return result; 460 if (s.isEmpty()) { 461 return true; 462 } 463 UnicodeBlock block = Character.UnicodeBlock.of(s.charAt(0)); 464 if (block != null && block.toString().contains("CJK")) { 465 return s.length() < 4; 466 } else { 467 return s.length() < 10; 468 } 477 469 } 478 470 … … 599 591 setChangesetTags(dataSet, cs == null); // keep comment/source of first tab for new changesets 600 592 if (cs == null) { 601 t pConfigPanels.setTitleAt(1,tr("Tags of new changeset"));593 tagSettingsBorder.setTitle(tr("Tags of new changeset")); 602 594 } else { 603 t pConfigPanels.setTitleAt(1,tr("Tags of changeset {0}", cs.getId()));595 tagSettingsBorder.setTitle(tr("Tags of changeset {0}", cs.getId())); 604 596 } 605 597 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
r16730 r17709 9 9 import java.beans.PropertyChangeListener; 10 10 import java.util.Optional; 11 import java.util.stream.Stream; 11 12 12 13 import javax.swing.BorderFactory; … … 23 24 import org.openstreetmap.josm.spi.preferences.Config; 24 25 import org.openstreetmap.josm.tools.ImageProvider; 26 import org.openstreetmap.josm.tools.StreamUtils; 25 27 26 28 /** … … 37 39 private transient Changeset selectedChangeset; 38 40 private boolean closeChangesetAfterNextUpload; 39 private transient ConfigurationParameterRequestHandlerconfigHandler;41 private transient Runnable configHandler; 40 42 41 43 /** … … 48 50 49 51 protected String buildChangesetSummary() { 50 StringBuilder msg = new StringBuilder(96);51 52 if (selectedChangeset == null || selectedChangeset.isNew()) { 52 msg.append(tr("Objects are uploaded to a <strong>new changeset</strong>."));53 return tr("Objects are uploaded to a <strong>new changeset</strong>."); 53 54 } else { 54 msg.append(tr("Objects are uploaded to the <strong>open changeset</strong> {0} with upload comment ''{1}''.",55 return tr("Objects are uploaded to the <strong>open changeset</strong> {0} with upload comment ''{1}''.", 55 56 selectedChangeset.getId(), 56 57 selectedChangeset.getComment() 57 )); 58 } 59 msg.append(' '); 58 ); 59 } 60 } 61 62 protected String buildChangesetSummary2() { 60 63 if (closeChangesetAfterNextUpload) { 61 msg.append(tr("The changeset is going to be <strong>closed</strong> after this upload"));64 return tr("The changeset is going to be <strong>closed</strong> after this upload"); 62 65 } else { 63 msg.append(tr("The changeset is <strong>left open</strong> after this upload")); 64 } 65 msg.append(" (<a href=\"urn:changeset-configuration\">").append(tr("configure changeset")).append("</a>)"); 66 return msg.toString(); 66 return tr("The changeset is <strong>left open</strong> after this upload"); 67 } 67 68 } 68 69 … … 80 81 81 82 int numRequests = spec.getNumRequests(numObjects); 82 String msg = null;83 83 if (useOneChangeset) { 84 84 lblWarning.setVisible(false); 85 85 if (numRequests == 0) { 86 msg =trn(86 return trn( 87 87 "Uploading <strong>{0} object</strong> to <strong>1 changeset</strong>", 88 88 "Uploading <strong>{0} objects</strong> to <strong>1 changeset</strong>", … … 90 90 ); 91 91 } else if (numRequests == 1) { 92 msg =trn(92 return trn( 93 93 "Uploading <strong>{0} object</strong> to <strong>1 changeset</strong> using <strong>1 request</strong>", 94 94 "Uploading <strong>{0} objects</strong> to <strong>1 changeset</strong> using <strong>1 request</strong>", … … 96 96 ); 97 97 } else if (numRequests > 1) { 98 msg =tr("Uploading <strong>{0} objects</strong> to <strong>1 changeset</strong> using <strong>{1} requests</strong>",98 return tr("Uploading <strong>{0} objects</strong> to <strong>1 changeset</strong> using <strong>{1} requests</strong>", 99 99 numObjects, numRequests); 100 100 } 101 msg = msg + " (<a href=\"urn:advanced-configuration\">" + tr("advanced configuration") + "</a>)";102 101 } else { 103 102 lblWarning.setVisible(true); 104 103 if (numRequests == 0) { 105 msg =tr("{0} objects exceed the max. allowed {1} objects in a changeset on the server ''{2}''. " +106 "Please <a href=\"urn: advanced-configuration\">configure</a> how to proceed with <strong>multiple changesets</strong>",104 return tr("{0} objects exceed the max. allowed {1} objects in a changeset on the server ''{2}''. " + 105 "Please <a href=\"urn:changeset-configuration\">configure</a> how to proceed with <strong>multiple changesets</strong>", 107 106 numObjects, maxChunkSize, OsmApi.getOsmApi().getBaseUrl()); 108 107 } else if (numRequests > 1) { 109 msg =tr("Uploading <strong>{0} objects</strong> to <strong>multiple changesets</strong> using <strong>{1} requests</strong>",108 return tr("Uploading <strong>{0} objects</strong> to <strong>multiple changesets</strong> using <strong>{1} requests</strong>", 110 109 numObjects, numRequests); 111 msg = msg + " (<a href=\"urn:advanced-configuration\">" + tr("advanced configuration") + "</a>)";112 110 } 113 111 } 114 return msg;112 return ""; 115 113 } 116 114 … … 120 118 121 119 setLayout(new BorderLayout()); 120 setBorder(BorderFactory.createTitledBorder(tr("Settings:"))); 122 121 add(jepMessage, BorderLayout.CENTER); 123 122 lblWarning = new JLabel(""); … … 131 130 } 132 131 133 public void setConfigurationParameterRequestListener( ConfigurationParameterRequestHandlerhandler) {132 public void setConfigurationParameterRequestListener(Runnable handler) { 134 133 this.configHandler = handler; 135 134 } … … 167 166 .map(url -> tr("… to server: <strong>{0}</strong>", url)) 168 167 .orElse(""); 169 jepMessage.setText("<html>" 170 + "<br>" 171 + buildChangesetSummary() 172 + "<br><br>" 173 + buildStrategySummary() 174 + "<br>" 175 + server 176 + "</html>"); 168 final String html = Stream.of(buildChangesetSummary(), buildChangesetSummary2(), buildStrategySummary(), server) 169 .filter(s -> s != null && !s.isEmpty()) 170 .collect(StreamUtils.toHtmlList()); 171 jepMessage.setText(html); 177 172 validate(); 178 173 } … … 188 183 return; 189 184 if ("urn:changeset-configuration".equals(desc)) { 190 configHandler.handleChangesetConfigurationRequest(); 191 } else if ("urn:advanced-configuration".equals(desc)) { 192 configHandler.handleUploadStrategyConfigurationRequest(); 185 configHandler.run(); 193 186 } 194 187 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r16972 r17709 21 21 import java.util.Map.Entry; 22 22 23 import javax.swing.BorderFactory; 23 24 import javax.swing.ButtonGroup; 24 25 import javax.swing.JLabel; … … 54 55 private transient Map<UploadStrategy, JRadioButton> rbStrategy; 55 56 private transient Map<UploadStrategy, JLabel> lblNumRequests; 56 private transient Map<UploadStrategy, JMultilineLabel> lblStrategies;57 57 private final JosmTextField tfChunkSize = new JosmTextField(4); 58 58 private final JPanel pnlMultiChangesetPolicyPanel = new JPanel(new GridBagLayout()); … … 74 74 protected JPanel buildUploadStrategyPanel() { 75 75 JPanel pnl = new JPanel(new GridBagLayout()); 76 pnl.setBorder(BorderFactory.createTitledBorder(tr("Please select the upload strategy:"))); 76 77 ButtonGroup bgStrategies = new ButtonGroup(); 77 78 rbStrategy = new EnumMap<>(UploadStrategy.class); 78 lblStrategies = new EnumMap<>(UploadStrategy.class);79 79 lblNumRequests = new EnumMap<>(UploadStrategy.class); 80 80 for (UploadStrategy strategy: UploadStrategy.values()) { 81 81 rbStrategy.put(strategy, new JRadioButton()); 82 82 lblNumRequests.put(strategy, new JLabel()); 83 lblStrategies.put(strategy, new JMultilineLabel(""));84 83 bgStrategies.add(rbStrategy.get(strategy)); 85 84 } 86 85 87 // -- headline86 // -- single request strategy 88 87 GridBagConstraints gc = new GridBagConstraints(); 89 88 gc.gridx = 0; 90 gc.gridy = 0;91 gc.weightx = 1.0;92 gc.weighty = 0.0; 93 gc.gridwidth = 4;89 gc.gridy = 1; 90 gc.weightx = 0.0; 91 gc.weighty = 0.0; 92 gc.gridwidth = 1; 94 93 gc.fill = GridBagConstraints.HORIZONTAL; 95 94 gc.insets = new Insets(0, 0, 3, 0); 96 95 gc.anchor = GridBagConstraints.FIRST_LINE_START; 97 pnl.add(new JMultilineLabel(tr("Please select the upload strategy:")), gc); 98 99 // -- single request strategy 100 gc.gridx = 0; 101 gc.gridy = 1; 102 gc.weightx = 0.0; 103 gc.weighty = 0.0; 104 gc.gridwidth = 1; 105 gc.anchor = GridBagConstraints.FIRST_LINE_START; 106 pnl.add(rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY), gc); 107 gc.gridx = 1; 96 JRadioButton radioButton = rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 97 radioButton.setText(tr("Upload data in one request")); 98 pnl.add(radioButton, gc); 99 gc.gridx = 3; 108 100 gc.gridy = 1; 109 101 gc.weightx = 1.0; 110 gc.weighty = 0.0;111 gc.gridwidth = 2;112 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);113 lbl.setText(tr("Upload data in one request"));114 pnl.add(lbl, gc);115 gc.gridx = 3;116 gc.gridy = 1;117 gc.weightx = 0.0;118 102 gc.weighty = 0.0; 119 103 gc.gridwidth = 1; … … 125 109 gc.weightx = 0.0; 126 110 gc.weighty = 0.0; 127 pnl.add(rbStrategy.get(UploadStrategy.CHUNKED_DATASET_STRATEGY), gc); 128 gc.gridx = 1; 129 gc.gridy = 2; 130 gc.weightx = 1.0; 131 gc.weighty = 0.0; 132 gc.gridwidth = 1; 133 lbl = lblStrategies.get(UploadStrategy.CHUNKED_DATASET_STRATEGY); 134 lbl.setText(tr("Upload data in chunks of objects. Chunk size: ")); 135 pnl.add(lbl, gc); 111 radioButton = rbStrategy.get(UploadStrategy.CHUNKED_DATASET_STRATEGY); 112 radioButton.setText(tr("Upload data in chunks of objects. Chunk size: ")); 113 pnl.add(radioButton, gc); 136 114 gc.gridx = 2; 137 115 gc.gridy = 2; … … 152 130 gc.weightx = 0.0; 153 131 gc.weighty = 0.0; 154 pnl.add(rbStrategy.get(UploadStrategy.INDIVIDUAL_OBJECTS_STRATEGY), gc); 155 gc.gridx = 1; 156 gc.gridy = 3; 157 gc.weightx = 1.0; 158 gc.weighty = 0.0; 159 gc.gridwidth = 2; 160 lbl = lblStrategies.get(UploadStrategy.INDIVIDUAL_OBJECTS_STRATEGY); 161 lbl.setText(tr("Upload each object individually")); 162 pnl.add(lbl, gc); 132 radioButton = rbStrategy.get(UploadStrategy.INDIVIDUAL_OBJECTS_STRATEGY); 133 radioButton.setText(tr("Upload each object individually")); 134 pnl.add(radioButton, gc); 163 135 gc.gridx = 3; 164 136 gc.gridy = 3; … … 340 312 if (maxChunkSize > 0 && numUploadedObjects > maxChunkSize) { 341 313 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(false); 342 J MultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);314 JRadioButton lbl = rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 343 315 lbl.setText(tr("Upload in one request not possible (too many objects to upload)")); 344 316 lbl.setToolTipText(tr("<html>Cannot upload {0} objects in one request because the<br>" … … 361 333 } else { 362 334 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(true); 363 J MultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);335 JRadioButton lbl = rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 364 336 lbl.setText(tr("Upload data in one request")); 365 337 lbl.setToolTipText(null); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r14877 r17709 231 231 AddAction() { 232 232 new ImageProvider("dialogs", "add").getResource().attachImageIcon(this); 233 putValue(SHORT_DESCRIPTION, tr("Add a new tag"));233 putValue(SHORT_DESCRIPTION, tr("Add Tag")); 234 234 TagTable.this.addPropertyChangeListener(this); 235 235 updateEnabledState(); … … 265 265 PasteAction() { 266 266 new ImageProvider("pastetags").getResource().attachImageIcon(this); 267 putValue(SHORT_DESCRIPTION, tr("Paste tags from buffer"));267 putValue(SHORT_DESCRIPTION, tr("Paste Tags")); 268 268 TagTable.this.addPropertyChangeListener(this); 269 269 updateEnabledState();
Note:
See TracChangeset
for help on using the changeset viewer.