home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / LocaleChooserBeanInfo.java < prev    next >
Text File  |  1997-07-30  |  4KB  |  100 lines

  1. package borland.samples.intl.beans;
  2.  
  3. import java.awt.*;
  4. import java.beans.*;
  5. import java.util.*;
  6. import borland.samples.intl.beans.event.*;
  7.  
  8. public class LocaleChooserBeanInfo extends SimpleBeanInfo {
  9.  
  10.   private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("borland.samples.intl.beans.resources.LocaleChooserRes");
  11.   public PropertyDescriptor[] getPropertyDescriptors() {
  12.     try {
  13.       PropertyDescriptor localeChoices = new PropertyDescriptor("localeChoices",
  14.                                 LocaleChooser.class);
  15.       localeChoices.setPropertyEditorClass(LocaleChooserLocaleChoicesEditor.class);
  16.       localeChoices.setShortDescription(resourceBundle.getString("localeChoices"));
  17.  
  18.       PropertyDescriptor selectedLocales = new PropertyDescriptor("selectedLocales",
  19.                                   LocaleChooser.class);
  20.       selectedLocales.setPropertyEditorClass(LocaleChooserSelectedLocalesEditor.class);
  21.       selectedLocales.setShortDescription(resourceBundle.getString("selectedLocales"));
  22.  
  23.       PropertyDescriptor displayStyle = new PropertyDescriptor("displayStyle",
  24.                                    LocaleChooser.class);
  25.       displayStyle.setPropertyEditorClass(LocaleChooserDisplayStyleEditor.class);
  26.       displayStyle.setShortDescription(resourceBundle.getString("displayStyle"));
  27.  
  28.       PropertyDescriptor acceptLeafNodesOnly = new PropertyDescriptor("acceptLeafNodesOnly",
  29.                                       LocaleChooser.class);
  30.       acceptLeafNodesOnly.setShortDescription(resourceBundle.getString("acceptLeafNodesOnly"));
  31.  
  32.       PropertyDescriptor allowMultiSelect = new PropertyDescriptor("allowMultiSelect",
  33.                                    LocaleChooser.class);
  34.       allowMultiSelect.setShortDescription(resourceBundle.getString("allowMultiSelect"));
  35.  
  36.       PropertyDescriptor title = new PropertyDescriptor("title",
  37.                                 LocaleChooser.class);
  38.       title.setShortDescription(resourceBundle.getString("title"));
  39.  
  40.       PropertyDescriptor collationLocale = new PropertyDescriptor("collationLocale",
  41.                                   LocaleChooser.class);
  42.       collationLocale.setPropertyEditorClass(LocaleChooserCollationLocaleEditor.class);
  43.       collationLocale.setShortDescription(resourceBundle.getString("collationLocale"));
  44.  
  45.       PropertyDescriptor animationEnabled = new PropertyDescriptor("animationEnabled",
  46.                                   LocaleChooser.class);
  47.  
  48.       PropertyDescriptor locale = new PropertyDescriptor("locale",
  49.                              LocaleChooser.class);
  50.  
  51.       PropertyDescriptor background = new PropertyDescriptor("background", 
  52.                                LocaleChooser.class);
  53.  
  54.       PropertyDescriptor foreground = new PropertyDescriptor("foreground", 
  55.                                LocaleChooser.class);
  56.  
  57.       PropertyDescriptor font = new PropertyDescriptor("font", 
  58.                                LocaleChooser.class);
  59.  
  60.       PropertyDescriptor propertyDescriptor[] = { localeChoices, selectedLocales, displayStyle, 
  61.                           acceptLeafNodesOnly, allowMultiSelect, 
  62.                           title, collationLocale, animationEnabled, locale,
  63.                           background, foreground, font };
  64.       return propertyDescriptor;
  65.     } catch (IntrospectionException e) {
  66.       e.printStackTrace();
  67.       return null;
  68.     }
  69.   }
  70.  
  71.   public EventSetDescriptor[] getEventSetDescriptors() {
  72.     try {
  73.       EventSetDescriptor localeChanged = new EventSetDescriptor(LocaleChooser.class,
  74.                                 "localeChangeEvent",
  75.                                 LocaleChangeListener.class,
  76.                                 "localeChanged");
  77.  
  78.       localeChanged.setShortDescription(resourceBundle.getString("localeChanged"));
  79.     
  80.       EventSetDescriptor[] eventDescriptor = { localeChanged };
  81.       return eventDescriptor;
  82.     } catch (IntrospectionException e) {
  83.       e.printStackTrace();
  84.       return null;
  85.     }
  86.   }
  87.  
  88.   public BeanDescriptor getBeanDescriptor() {
  89.     return new BeanDescriptor(LocaleChooser.class);
  90.   }
  91.  
  92.   public Image getIcon(int iconKind) {
  93.     if (iconKind == BeanInfo.ICON_COLOR_32x32) {
  94.       return loadImage("resources/LocaleChooserIconColor32.gif");
  95.     }
  96.     return null;
  97.   }
  98.  
  99. }
  100.