home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 2.1 KB | 65 lines |
- package borland.samples.intl.beans;
-
- import java.util.*;
-
- public class LocaleChooserSelectedLocalesEditor extends LocaleChooserMultipleLocaleSelector {
-
- public LocaleChooserSelectedLocalesEditor() {
- localeChooser.setAllowMultiSelect(true);
- localeChooser.setTitle(resourceBundle.getString("none_selected"));
- }
-
- public String getJavaInitializationString() {
- Locale [] selectedLocales = localeChooser.getSelectedLocales();
-
- if ((selectedLocales.length == 0) ||
- ((selectedLocales.length == 1) &&
- (selectedLocales[0].equals(LocaleChooser.TITLE_LOCALE)))) {
- System.out.println(this.getClass().getName() + ".getJavaInitializationString(): NO_LOCALES");
- return "LocaleChooser.NO_LOCALES";
- }
- return super.getJavaInitializationString();
- }
-
- public void setValue(Object o) {
- try {
- Locale [] localeChoices = (Locale []) ((Locale []) o).clone();
- if ((localeChoices.length == 0) ||
- ((localeChoices.length == 1) &&
- (localeChoices[0].equals(LocaleChooser.NULL_LOCALE)))) {
- System.out.println(this.getClass().getName() + ".setValue(): NO_LOCALES");
- localeChooser.setSelectedLocales(new Locale [] { LocaleChooser.TITLE_LOCALE });
- } else {
- super.setValue(o);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public Object getValue() {
- Locale [] selectedLocales = localeChooser.getSelectedLocales();
- if ((selectedLocales.length == 0) ||
- ((selectedLocales.length == 1) &&
- (selectedLocales[0].equals(LocaleChooser.TITLE_LOCALE)))) {
- System.out.println(this.getClass().getName() + ".getValue(): NO_LOCALES");
- return LocaleChooser.NO_LOCALES;
- }
- return super.getValue();
- }
-
- public String getAsText() {
- Locale [] selectedLocales = localeChooser.getSelectedLocales();
-
- if ((selectedLocales.length == 0) ||
- ((selectedLocales.length == 1) &&
- (selectedLocales[0].equals(LocaleChooser.TITLE_LOCALE)))) {
- System.out.println(this.getClass().getName() + ".getAsText(): none_selected");
- return resourceBundle.getString("none_selected");
- }
- return super.getAsText();
- }
-
- }
-
-