Ignore:
Timestamp:
2020-06-17T21:47:17+02:00 (4 years ago)
Author:
simon04
Message:

see #19381 - Upload dialog: make warnings less intrusive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    r16237 r16672  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.BorderLayout;
    76import java.awt.GridBagLayout;
    87import java.awt.event.ActionEvent;
     
    2019
    2120import javax.swing.BorderFactory;
     21import javax.swing.BoxLayout;
    2222import javax.swing.JCheckBox;
    2323import javax.swing.JEditorPane;
     
    7676    protected JPanel buildUploadCommentPanel() {
    7777        JPanel pnl = new JPanel(new GridBagLayout());
    78         pnl.setBorder(BorderFactory.createTitledBorder(tr("Tags of changeset {0}", "")));
    79 
    80         JEditorPane commentLabel = new JMultilineLabel("<html><b>" + tr("Provide a brief comment for the changes you are uploading:"));
    81         pnl.add(commentLabel, GBC.eol().insets(0, 5, 10, 3).fill(GBC.HORIZONTAL));
     78        pnl.setBorder(BorderFactory.createTitledBorder(tr("Provide a brief comment for the changes you are uploading:")));
     79
    8280        hcbUploadComment.setToolTipText(tr("Enter an upload comment"));
    8381        hcbUploadComment.setMaxTextLength(Changeset.MAX_CHANGESET_TAG_LENGTH);
     
    8785        hcbUploadComment.getEditorComponent().addFocusListener(commentModelListener);
    8886        pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL));
    89 
    90         JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") + ":</b>");
    91         pnl.add(sourceLabel, GBC.eol().insets(0, 8, 10, 0).fill(GBC.HORIZONTAL));
     87        JLabel hcbUploadCommentFeedback = new JLabel();
     88        pnl.add(hcbUploadCommentFeedback, GBC.eol().insets(0, 3, 0, 0).fill(GBC.HORIZONTAL));
     89        new UploadTextComponentValidator.UploadCommentValidator(hcbUploadComment.getEditorComponent(), hcbUploadCommentFeedback);
     90        return pnl;
     91    }
     92
     93    protected JPanel buildUploadSourcePanel() {
     94        JPanel pnl = new JPanel(new GridBagLayout());
     95        pnl.setBorder(BorderFactory.createTitledBorder(tr("Specify the data source for the changes")));
     96
    9297        JEditorPane obtainSourceOnce = new JMultilineLabel(
    9398                "<html>(<a href=\"urn:changeset-source\">" + tr("just once") + "</a>)</html>");
     
    119124        hcbUploadSource.getEditorComponent().addFocusListener(sourceModelListener);
    120125        pnl.add(hcbUploadSource, GBC.eol().fill(GBC.HORIZONTAL));
     126        JLabel hcbUploadSourceFeedback = new JLabel();
     127        pnl.add(hcbUploadSourceFeedback, GBC.eol().insets(0, 3, 0, 0).fill(GBC.HORIZONTAL));
     128        new UploadTextComponentValidator.UploadSourceValidator(hcbUploadSource.getEditorComponent(), hcbUploadSourceFeedback);
    121129        if (obtainSourceAutomatically.isSelected()) {
    122130            automaticallyAddSource();
     
    181189
    182190    protected void build() {
    183         setLayout(new BorderLayout());
     191        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    184192        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    185         add(buildUploadCommentPanel(), BorderLayout.NORTH);
    186         add(pnlUploadParameterSummary, BorderLayout.CENTER);
     193        add(buildUploadCommentPanel());
     194        add(buildUploadSourcePanel());
     195        add(pnlUploadParameterSummary);
    187196        if (Config.getPref().getBoolean("upload.show.review.request", true)) {
    188             add(cbRequestReview, BorderLayout.SOUTH);
     197            JPanel pnl = new JPanel(new GridBagLayout());
     198            pnl.add(cbRequestReview, GBC.eol().fill(GBC.HORIZONTAL));
     199            add(pnl);
    189200            cbRequestReview.addItemListener(e -> changesetReviewModel.setReviewRequested(e.getStateChange() == ItemEvent.SELECTED));
    190201        }
Note: See TracChangeset for help on using the changeset viewer.