001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.preferences;
003
004import static java.awt.GridBagConstraints.BOTH;
005
006import org.openstreetmap.josm.gui.widgets.HideableTabbedPane;
007import org.openstreetmap.josm.tools.GBC;
008
009/**
010 * Abstract base class for {@link TabPreferenceSetting} implementations extensible solely by inner tabs.
011 *
012 * Support for common functionality, like icon, title and adding a tab ({@link SubPreferenceSetting}).
013 * @since 17314
014 */
015public abstract class ExtensibleTabPreferenceSetting extends DefaultTabPreferenceSetting {
016
017    /**
018     * Constructs a new {@code ExtensibleTabPreferenceSetting}.
019     */
020    protected ExtensibleTabPreferenceSetting() {
021        this(null, null, null);
022    }
023
024    protected ExtensibleTabPreferenceSetting(String iconName, String title, String description) {
025        this(iconName, title, description, false);
026    }
027
028    protected ExtensibleTabPreferenceSetting(String iconName, String title, String description, boolean isExpert) {
029        super(iconName, title, description, isExpert, new HideableTabbedPane());
030    }
031
032    @Override
033    public void addGui(PreferenceTabbedPane gui) {
034        gui.createPreferenceTab(this).add(getTabPane(), GBC.eol().fill(BOTH));
035    }
036}