Changeset 17323 in josm


Ignore:
Timestamp:
2020-11-18T20:16:58+01:00 (13 days ago)
Author:
Don-vip
Message:

fix #20099 - make sure "OSM Server" preferences display a vertical scrollbar if needed

Location:
trunk/src/org/openstreetmap/josm/gui/preferences
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r17316 r17323  
    7272import org.openstreetmap.josm.plugins.PluginHandler;
    7373import org.openstreetmap.josm.plugins.PluginInformation;
    74 import org.openstreetmap.josm.tools.CheckParameterUtil;
    7574import org.openstreetmap.josm.tools.GBC;
    7675import org.openstreetmap.josm.tools.ImageProvider;
     
    213212    }
    214213
     214    /**
     215     * Panel used for preference settings.
     216     * @since 4968
     217     */
    215218    public static final class PreferencePanel extends JPanel implements PreferenceTab {
    216219        private final transient TabPreferenceSetting preferenceSetting;
     
    218221        private PreferencePanel(TabPreferenceSetting preferenceSetting) {
    219222            super(new GridBagLayout());
    220             CheckParameterUtil.ensureParameterNotNull(preferenceSetting);
    221             this.preferenceSetting = preferenceSetting;
     223            this.preferenceSetting = Objects.requireNonNull(preferenceSetting, "preferenceSetting");
    222224            buildPanel();
    223225        }
     
    249251    }
    250252
     253    /**
     254     * Scroll pane used for large {@link PreferencePanel}s.
     255     * @since 4968
     256     */
    251257    public static final class PreferenceScrollPane extends JScrollPane implements PreferenceTab {
    252258        private final transient TabPreferenceSetting preferenceSetting;
    253259
    254         private PreferenceScrollPane(Component view, TabPreferenceSetting preferenceSetting) {
    255             super(view);
    256             this.preferenceSetting = preferenceSetting;
    257         }
    258 
    259260        private PreferenceScrollPane(PreferencePanel preferencePanel) {
    260             this(preferencePanel.getComponent(), preferencePanel.getTabPreferenceSetting());
     261            super(preferencePanel.getComponent());
     262            this.preferenceSetting = preferencePanel.getTabPreferenceSetting();
    261263            GuiHelper.setDefaultIncrement(this);
    262264        }
     
    312314     */
    313315    public PreferencePanel createPreferenceTab(TabPreferenceSetting caller, boolean inScrollPane) {
    314         CheckParameterUtil.ensureParameterNotNull(caller, "caller");
    315         PreferencePanel p = new PreferencePanel(caller);
    316 
    317         PreferenceTab tab = p;
    318         if (inScrollPane) {
    319             PreferenceScrollPane sp = new PreferenceScrollPane(p);
    320             tab = sp;
    321         }
    322         tabs.add(tab);
     316        PreferencePanel p = new PreferencePanel(Objects.requireNonNull(caller, "caller"));
     317        tabs.add(inScrollPane ? new PreferenceScrollPane(p) : p);
    323318        return p;
    324319    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreference.java

    r17162 r17323  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.GridBagConstraints;
    67import java.awt.GridBagLayout;
    78import java.beans.PropertyChangeListener;
     
    5354    }
    5455
     56    private static GBC eopFilledHorizontal() {
     57        return GBC.eop().fill(GridBagConstraints.HORIZONTAL);
     58    }
     59
    5560    @Override
    5661    public void addGui(PreferenceTabbedPane gui) {
    5762        JPanel panel = new JPanel(new GridBagLayout());
    58         panel.add(pnlApiUrlPreferences, GBC.eop().fill(GBC.HORIZONTAL));
    59         panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL));
    60         panel.add(pnlAuthPreferences, GBC.eop().fill(GBC.HORIZONTAL));
    61         panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL));
    62         panel.add(pnlFeaturesPreferences, GBC.eop().fill(GBC.HORIZONTAL));
    63         panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL));
    64         panel.add(pnlOverpassPreferences, GBC.eop().fill(GBC.HORIZONTAL));
     63        panel.add(pnlApiUrlPreferences, eopFilledHorizontal());
     64        panel.add(new JSeparator(), eopFilledHorizontal());
     65        panel.add(pnlAuthPreferences, eopFilledHorizontal());
     66        panel.add(new JSeparator(), eopFilledHorizontal());
     67        panel.add(pnlFeaturesPreferences, eopFilledHorizontal());
     68        panel.add(new JSeparator(), eopFilledHorizontal());
     69        panel.add(pnlOverpassPreferences, eopFilledHorizontal());
    6570
    6671        pnlApiUrlPreferences.initFromPreferences();
     
    7277        HelpUtil.setHelpContext(panel, HelpUtil.ht("/Preferences/Connection"));
    7378        panel.add(Box.createVerticalGlue(), GBC.eol().fill());
    74         gui.createPreferenceTab(this).add(panel, GBC.eol().fill());
     79        createPreferenceTabWithScrollPane(gui, panel);
    7580    }
    7681
Note: See TracChangeset for help on using the changeset viewer.