home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 2.0 KB | 65 lines |
- package borland.samples.intl.beans;
-
- import java.beans.*;
- import java.util.*;
- import java.awt.*;
- import java.awt.event.*;
- import borland.jbcl.model.*;
-
- public class LocaleChooserMultipleLocaleSelector extends LocaleChooserLocaleSelector {
-
- public LocaleChooserMultipleLocaleSelector() {
- localeChooser.setAllowMultiSelect(true);
- }
-
- public String getJavaInitializationString() {
- Locale [] locale = localeChooser.getSelectedLocales();
-
- String localeInitString = "new java.util.Locale [] {\n";
- for (int i = 0; i < locale.length; i++) {
- localeInitString += "new java.util.Locale(\"" + locale[i].getLanguage() + "\", \"";
- if (locale[i].getCountry().length() == 0) {
- localeInitString += "\")";
- } else {
- localeInitString += locale[i].getCountry() + "\"";
- if (locale[i].getVariant().length() == 0) {
- localeInitString += ")";
- } else {
- localeInitString += ",\"" + locale[i].getVariant() + "\")";
- }
- }
- localeInitString += ",\n";
- }
- localeInitString += " } ";
- System.out.println(localeInitString + "\n:" + this.getClass().getName() + ".getJavaInitializationString()");
- return localeInitString;
- }
-
- public void setValue(Object o) {
- try {
- Locale [] locale = (Locale []) ((Locale []) o).clone();
- for (int i = 0; i < locale.length; i++) {
- System.out.print(locale[i]+";");
- }
- System.out.println(":" + this.getClass().getName() +".setValue()");
- localeChooser.setSelectedLocales(locale);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public Object getValue() {
- Locale [] l = localeChooser.getSelectedLocales();
- for (int i = 0; i < l.length; i++) {
- System.out.println(l[i]);
- }
- System.out.println(":" + this.getClass().getName() + ".getValue()");
- return localeChooser.getSelectedLocales();
- }
-
- public String getAsText() {
- System.out.println(this.getClass().getName() + ".getAsText():");
- return getJavaInitializationString();
- }
- }
-