Ignore:
Timestamp:
2021-10-17T15:17:42+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21427 - further simplify UploadDialog (patch by marcello, modified)

  • The dialog was simplified by combining the function of two radiobuttons and one combobox into one combobox.
  • When an open changeset was selected on tab 2, existing tags on the open changeset could overwrite the data the user entered on tab 1. The user might spot this by looking closely at the tag table on tab 2, but then he may not. This non-obvious behaviour was removed.
  • The exception thrown when closing an already closed changeset was fixed.
  • More cosmetic changes to the dialog.
  • Maybe also a solution to #19319, #21387 (added revalidate()).
File:
1 edited

Legend:

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

    r18221 r18283  
    103103    }
    104104
     105    protected void build() {
     106        setLayout(new GridBagLayout());
     107        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
     108        GBC gbc = GBC.eop().fill(GBC.HORIZONTAL);
     109        add(buildUploadCommentPanel(), gbc);
     110        add(buildUploadSourcePanel(), gbc);
     111        add(pnlUploadParameterSummary, gbc);
     112        if (Config.getPref().getBoolean("upload.show.review.request", true)) {
     113            add(cbRequestReview, gbc);
     114            cbRequestReview.addItemListener(this);
     115        }
     116        add(areaValidatorFeedback, gbc);
     117        add(new JPanel(), GBC.std().fill(GBC.BOTH));
     118    }
     119
    105120    protected JPanel buildUploadCommentPanel() {
    106121        JPanel pnl = new JPanel(new GridBagLayout());
     
    114129        editor.addFocusListener(this);
    115130        editor.addActionListener(this);
    116         pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL));
    117         pnl.add(uploadCommentFeedback, GBC.eol().insets(0, 3, 0, 0).fill(GBC.HORIZONTAL));
     131        GBC gbc = GBC.eol().insets(3).fill(GBC.HORIZONTAL);
     132        pnl.add(hcbUploadComment, gbc);
     133        pnl.add(uploadCommentFeedback, gbc);
    118134        return pnl;
    119135    }
     
    142158        obtainSource.add(obtainSourceOnce, GBC.std().anchor(GBC.WEST));
    143159        obtainSource.add(new JLabel(), GBC.eol().fill(GBC.HORIZONTAL));
    144         if (Config.getPref().getBoolean("upload.show.automatic.source", true)) {
    145             pnl.add(obtainSource, GBC.eol().insets(0, 0, 10, 3).fill(GBC.HORIZONTAL));
    146         }
    147160
    148161        hcbUploadSource.setToolTipText(tr("Enter a source"));
     
    153166        editor.addFocusListener(this);
    154167        editor.addActionListener(this);
    155         pnl.add(hcbUploadSource, GBC.eol().fill(GBC.HORIZONTAL));
    156         pnl.add(hcbUploadSourceFeedback, GBC.eol().insets(0, 3, 0, 0).fill(GBC.HORIZONTAL));
    157 
     168        GBC gbc = GBC.eol().insets(3).fill(GBC.HORIZONTAL);
     169        if (Config.getPref().getBoolean("upload.show.automatic.source", true)) {
     170            pnl.add(obtainSource, gbc);
     171        }
     172        pnl.add(hcbUploadSource, gbc);
     173        pnl.add(hcbUploadSourceFeedback, gbc);
    158174        return pnl;
    159175    }
     
    162178     * Initializes this life cycle of the panel.
    163179     *
    164      * Adds any changeset tags to the map.
     180     * Adds the comment and source tags from history, and/or obtains the source from the layer if
     181     * the user said so.
    165182     *
    166183     * @param map Map where tags are added to.
     
    179196        hcbUploadSource.getModel().prefs().load(SOURCE_HISTORY_KEY, getDefaultSources());
    180197        hcbUploadSource.discardAllUndoableEdits();
     198        hcbUploadComment.getEditorComponent().requestFocusInWindow();
     199        uploadCommentValidator.validate();
     200        uploadSourceValidator.validate();
    181201    }
    182202
     
    233253    protected List<UploadTextComponentValidator> getUploadTextValidators() {
    234254        return Arrays.asList(areaValidator, uploadCommentValidator, uploadSourceValidator);
    235     }
    236 
    237     protected void build() {
    238         setLayout(new GridBagLayout());
    239         setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    240         GBC gbc = GBC.eol().insets(0, 0, 0, 20).fill(GBC.HORIZONTAL);
    241         add(buildUploadCommentPanel(), gbc);
    242         add(buildUploadSourcePanel(), gbc);
    243         add(pnlUploadParameterSummary, gbc);
    244         if (Config.getPref().getBoolean("upload.show.review.request", true)) {
    245             add(cbRequestReview, gbc);
    246             cbRequestReview.addItemListener(this);
    247         }
    248         add(areaValidatorFeedback, gbc);
    249         add(new JPanel(), GBC.std().fill(GBC.BOTH));
    250255    }
    251256
     
    266271        // store current value of obtaining source automatically
    267272        Config.getPref().putBoolean("upload.source.obtainautomatically", obtainSourceAutomatically.isSelected());
    268     }
    269 
    270     /**
    271      * Initializes the panel for user input
    272      */
    273     public void startUserInput() {
    274         hcbUploadComment.getEditorComponent().requestFocusInWindow();
    275         uploadCommentValidator.validate();
    276         uploadSourceValidator.validate();
    277273    }
    278274
Note: See TracChangeset for help on using the changeset viewer.