home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 3.2 KB | 85 lines |
- /*
- * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
- *
- * This SOURCE CODE FILE, which has been provided by Borland as part
- * of a Borland product for use ONLY by licensed users of the product,
- * includes CONFIDENTIAL and PROPRIETARY information of Borland.
- *
- * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
- * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
- * THE PRODUCT.
- *
- * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
- * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
- * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
- * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
- * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
- * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
- * CODE FILE.
- */
- package borland.samples.intl.beans;
-
- import java.util.*;
-
- public class LocaleChooserLocaleChoicesEditor extends LocaleChooserMultipleLocaleSelector {
-
- public LocaleChooserLocaleChoicesEditor() {
- localeChooser.setAllowMultiSelect(true);
- localeChooser.setTitle(resourceBundle.getString("all_runtime_locales"));
- }
-
- 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(): ALL_LOCALES");
- return "LocaleChooser.ALL_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.EVERY_LOCALE)))) {
- // System.out.println(this.getClass().getName() + ".setValue(): ALL_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(): ALL_LOCALES");
- return LocaleChooser.ALL_LOCALES;
- }
- return super.getValue();
- }
-
- public String getAsText() {
- // System.out.println(this.getClass().getName() + ".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(): all_runtime_locales");
- return resourceBundle.getString("all_runtime_locales");
- }
- return super.getAsText();
- }
-
- }
-
-