home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / LocaleChooserDisplayStyleEditor.java < prev    next >
Encoding:
Java Source  |  1997-07-30  |  1.2 KB  |  60 lines

  1. package borland.samples.intl.beans;
  2.  
  3. public class LocaleChooserDisplayStyleEditor
  4.         extends java.beans.PropertyEditorSupport {
  5.  
  6.   int style;
  7.  
  8.   public String[] getTags() {
  9.     String tags[] = {
  10.       "ISO",
  11.       "TARGET_LOCALE",
  12.       "CURRENT_LOCALE"
  13.     };
  14.     return tags;
  15.   }
  16.  
  17.   public String getJavaInitializationString() {
  18.     switch (style) {
  19.     case LocaleChooser.ISO:
  20.       return "LocaleChooser.ISO";
  21.     case LocaleChooser.TARGET_LOCALE:
  22.       return "LocaleChooser.TARGET_LOCALE";
  23.     default:
  24.       return "LocaleChooser.CURRENT_LOCALE";
  25.     }
  26.   }
  27.  
  28.   public void setAsText(String text) {
  29.     if (text.equals("ISO")) {
  30.       style = LocaleChooser.ISO;
  31.     } else if (text.equals("TARGET_LOCALE")) {
  32.       style = LocaleChooser.TARGET_LOCALE;
  33.     } else {
  34.       style = LocaleChooser.CURRENT_LOCALE;
  35.     }
  36.   }
  37.  
  38.   public String getAsText() {
  39.     switch (style) {
  40.     case LocaleChooser.ISO:
  41.       return "ISO";
  42.     case LocaleChooser.TARGET_LOCALE:
  43.       return "TARGET_LOCALE";
  44.     default:
  45.       return "CURRENT_LOCALE";
  46.     }
  47.   }
  48.  
  49.   public void setValue(Object o) {
  50.     style = ((Integer) o).intValue();
  51.     firePropertyChange();
  52.   }
  53.  
  54.   public Object getValue() {
  55.     return new Integer(style);
  56.   }
  57.  
  58. }
  59.  
  60.