001package apps;
002
003import javax.swing.JComponent;
004import jmri.swing.PreferencesPanel;
005import jmri.swing.PreferencesSubPanel;
006import org.openide.util.lookup.ServiceProvider;
007
008/**
009 * Provide PreferencesPanel information for the JPanel provided by
010 * {@link apps.GuiLafConfigPane#doLocale()}.
011 *
012 * @author Randall Wood randall.h.wood@alexandriasoftware.com
013 */
014@ServiceProvider(service = PreferencesPanel.class)
015public class GuiLocalePreferencesPanel implements PreferencesSubPanel {
016
017    GuiLafConfigPane parent = null;
018
019    @Override
020    public String getParentClassName() {
021        return GuiLafConfigPane.class.getName();
022    }
023
024    @Override
025    public void setParent(PreferencesPanel parent) {
026        if (parent instanceof GuiLafConfigPane) {
027            this.parent = (GuiLafConfigPane) parent;
028        }
029    }
030
031    @Override
032    public GuiLafConfigPane getParent() {
033        return this.parent;
034    }
035
036    @Override
037    public String getPreferencesItem() {
038        return this.getParent().getPreferencesItem();
039    }
040
041    @Override
042    public String getPreferencesItemText() {
043        return this.getParent().getPreferencesItemText();
044    }
045
046    @Override
047    public String getTabbedPreferencesTitle() {
048        return ConfigBundle.getMessage("TabbedLayoutLocale"); // NOI18N
049    }
050
051    @Override
052    public String getLabelKey() {
053        return ConfigBundle.getMessage("LabelTabbedLayoutLocale"); // NOI18N
054    }
055
056    @Override
057    public JComponent getPreferencesComponent() {
058        return this.getParent().doLocale();
059    }
060
061    @Override
062    public boolean isPersistant() {
063        return false;
064    }
065
066    @Override
067    public String getPreferencesTooltip() {
068        return null;
069    }
070
071    @Override
072    public void savePreferences() {
073        this.getParent().savePreferences();
074    }
075
076    @Override
077    public boolean isDirty() {
078        return this.getParent().isDirty();
079    }
080
081    @Override
082    public boolean isRestartRequired() {
083        return this.getParent().isRestartRequired();
084    }
085
086    @Override
087    public boolean isPreferencesValid() {
088        return this.getParent().isPreferencesValid();
089    }
090}