home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
LocaleChooserSelectedLocalesEditor.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
3KB
|
84 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 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();
}
}