Ticket #18523: 18523.ui_revert.patch

File 18523.ui_revert.patch, 3.6 KB (added by taylor.smock, 4 years ago)

Revert UI while leaving logic (advanced pref upload.source.obtainautomatically can be set)

  • src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

     
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.BorderLayout;
    67import java.awt.GridBagLayout;
    78import java.awt.event.ActionEvent;
    89import java.awt.event.ActionListener;
     
    2728import javax.swing.event.ChangeEvent;
    2829import javax.swing.event.ChangeListener;
    2930import javax.swing.event.HyperlinkEvent;
     31import javax.swing.event.HyperlinkListener;
    3032
    3133import org.openstreetmap.josm.data.osm.Changeset;
    3234import org.openstreetmap.josm.gui.MainApplication;
     
    8688        pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL));
    8789
    8890        JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") + ":</b>");
    89         pnl.add(sourceLabel, GBC.eol().insets(0, 8, 10, 0).fill(GBC.HORIZONTAL));
    9091        JEditorPane obtainSourceOnce = new JMultilineLabel(
    9192                "<html><a href=\"urn:changeset-source\">" + tr("just once") + "</a></html>");
    9293        obtainSourceOnce.addHyperlinkListener(e -> {
     
    105106        obtainSource.add(obtainSourceAutomatically, GBC.std().anchor(GBC.WEST));
    106107        obtainSource.add(obtainSourceOnce, GBC.std().anchor(GBC.WEST));
    107108        obtainSource.add(new JLabel(), GBC.eol().fill(GBC.HORIZONTAL));
    108         pnl.add(obtainSource, GBC.eol().insets(0, 0, 10, 3).fill(GBC.HORIZONTAL));
    109 
     109       
     110        // Revert back to previous UI due to #18523.
     111        // pnl.add(sourceLabel, GBC.eol().insets(0, 8, 10, 0).fill(GBC.HORIZONTAL));
     112        // pnl.add(obtainSource, GBC.eol().insets(0, 0, 10, 3).fill(GBC.HORIZONTAL));
     113        JMultilineLabel obtainSourceTmp = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes")
     114            + "</b> (<a href=\"urn:changeset-source\">" + tr("obtain from current layers") + "</a>)<b>:</b>");
     115        obtainSourceTmp.addHyperlinkListener(obtainSourceOnce.getListeners(HyperlinkListener.class)[0]);
     116        pnl.add(obtainSourceTmp, GBC.eol().insets(0, 8, 10, 3).fill(GBC.HORIZONTAL));
     117       
    110118        hcbUploadSource.setToolTipText(tr("Enter a source"));
    111119        hcbUploadSource.setMaxTextLength(Changeset.MAX_CHANGESET_TAG_LENGTH);
    112120        populateHistoryComboBox(hcbUploadSource, SOURCE_HISTORY_KEY, getDefaultSources());
     
    120128        pnl.addAncestorListener(new AncestorListener() {
    121129            @Override
    122130            public void ancestorAdded(AncestorEvent event) {
     131                obtainSourceAutomatically.setSelected(Config.getPref().getBoolean("upload.source.obtainautomatically"));
    123132                if (obtainSourceAutomatically.isSelected())
    124133                    automaticallyAddSource();
    125134            }
     
    176185    }
    177186
    178187    protected void build() {
    179         setLayout(new GridBagLayout());
     188        setLayout(new BorderLayout());
    180189        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    181         add(buildUploadCommentPanel(), GBC.eol().fill(GBC.BOTH));
    182         add(pnlUploadParameterSummary, GBC.eol().fill(GBC.BOTH));
    183         add(cbRequestReview, GBC.eol().fill(GBC.BOTH));
     190        add(buildUploadCommentPanel(), BorderLayout.NORTH);
     191        add(pnlUploadParameterSummary, BorderLayout.CENTER);
     192        add(cbRequestReview, BorderLayout.SOUTH);
    184193        cbRequestReview.addItemListener(e -> changesetReviewModel.setReviewRequested(e.getStateChange() == ItemEvent.SELECTED));
    185194    }
    186195