X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FConfigItemLocale.java;fp=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FConfigItemLocale.java;h=0000000000000000000000000000000000000000;hp=eef8da0836292df9d52409eee55ecc1915d2c72d;hb=46add0670fdee4bd936a13fe2448c5e20a7ffd0a;hpb=1b5197ed4ceec2025a9a40c417b37c646b756138 diff --git a/src/be/nikiroo/utils/ui/ConfigItemLocale.java b/src/be/nikiroo/utils/ui/ConfigItemLocale.java deleted file mode 100644 index eef8da0..0000000 --- a/src/be/nikiroo/utils/ui/ConfigItemLocale.java +++ /dev/null @@ -1,62 +0,0 @@ -package be.nikiroo.utils.ui; - -import java.awt.Component; -import java.util.Locale; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; - -import be.nikiroo.utils.resources.MetaInfo; - -class ConfigItemLocale> extends ConfigItemCombobox { - private static final long serialVersionUID = 1L; - - /** - * Create a new {@link ConfigItemLocale} for the given {@link MetaInfo}. - * - * @param info - * the {@link MetaInfo} - */ - public ConfigItemLocale(MetaInfo info) { - super(info, true); - } - - // rawtypes for Java 1.6 (and 1.7 ?) support - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - protected JComponent createEmptyField(int item) { - JComboBox field = (JComboBox) super.createEmptyField(item); - field.setRenderer(new DefaultListCellRenderer() { - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, - Object value, int index, boolean isSelected, - boolean cellHasFocus) { - - String svalue = value == null ? "" : value.toString(); - String[] tab = svalue.split("-"); - Locale locale = null; - if (tab.length == 1) { - locale = new Locale(tab[0]); - } else if (tab.length == 2) { - locale = new Locale(tab[0], tab[1]); - } else if (tab.length == 3) { - locale = new Locale(tab[0], tab[1], tab[2]); - } - - String displayValue = svalue; - if (locale != null) { - displayValue = locale.getDisplayName(); - } - - return super.getListCellRendererComponent(list, displayValue, - index, isSelected, cellHasFocus); - } - }); - - return field; - } -}