home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / inprise / JSAMPLES.Z / LocaleChooserBeanInfo.java < prev    next >
Text File  |  1998-05-08  |  6KB  |  120 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20. package borland.samples.intl.beans;
  21.  
  22. import java.awt.*;
  23. import java.beans.*;
  24. import java.util.*;
  25. import borland.samples.intl.beans.event.*;
  26.  
  27. public class LocaleChooserBeanInfo extends SimpleBeanInfo {
  28.  
  29.   ResourceBundle resourceBundle = java.util.ResourceBundle.getBundle("borland.samples.intl.beans.resources.LocaleChooserRes");
  30.  
  31.   public PropertyDescriptor[] getPropertyDescriptors() {
  32.     try {
  33.       PropertyDescriptor localeChoices = new PropertyDescriptor("localeChoices",
  34.                                                                 LocaleChooser.class);
  35.       localeChoices.setPropertyEditorClass(LocaleChooserLocaleChoicesEditor.class);
  36.       localeChoices.setShortDescription(resourceBundle.getString("localeChoices"));
  37.  
  38.       PropertyDescriptor selectedLocales = new PropertyDescriptor("selectedLocales",
  39.                                                                   LocaleChooser.class);
  40.       selectedLocales.setPropertyEditorClass(LocaleChooserSelectedLocalesEditor.class);
  41.       selectedLocales.setShortDescription(resourceBundle.getString("selectedLocales"));
  42.  
  43.       PropertyDescriptor displayStyle = new PropertyDescriptor("displayStyle",
  44.                                                                LocaleChooser.class);
  45.       displayStyle.setPropertyEditorClass(LocaleChooserDisplayStyleEditor.class);
  46.       displayStyle.setShortDescription(resourceBundle.getString("displayStyle"));
  47.  
  48.       PropertyDescriptor acceptLeafNodesOnly = new PropertyDescriptor("acceptLeafNodesOnly",
  49.                                                                       LocaleChooser.class);
  50.       acceptLeafNodesOnly.setShortDescription(resourceBundle.getString("acceptLeafNodesOnly"));
  51.  
  52.       PropertyDescriptor allowMultiSelect = new PropertyDescriptor("allowMultiSelect",
  53.                                                                    LocaleChooser.class);
  54.       allowMultiSelect.setShortDescription(resourceBundle.getString("allowMultiSelect"));
  55.  
  56.       PropertyDescriptor title = new PropertyDescriptor("title",
  57.                                                         LocaleChooser.class);
  58.       title.setShortDescription(resourceBundle.getString("title"));
  59.  
  60.       PropertyDescriptor collationLocale = new PropertyDescriptor("collationLocale",
  61.                                                                   LocaleChooser.class);
  62.       collationLocale.setPropertyEditorClass(LocaleChooserCollationLocaleEditor.class);
  63.       collationLocale.setShortDescription(resourceBundle.getString("collationLocale"));
  64.  
  65.       PropertyDescriptor animationEnabled = new PropertyDescriptor("animationEnabled",
  66.                                                                   LocaleChooser.class);
  67.  
  68.       PropertyDescriptor locale = new PropertyDescriptor("locale",
  69.                                                          LocaleChooser.class);
  70.  
  71.       PropertyDescriptor background = new PropertyDescriptor("background", 
  72.                                                        LocaleChooser.class);
  73.  
  74.       PropertyDescriptor foreground = new PropertyDescriptor("foreground", 
  75.                                                        LocaleChooser.class);
  76.  
  77.       PropertyDescriptor font = new PropertyDescriptor("font", 
  78.                                                        LocaleChooser.class);
  79.  
  80.       PropertyDescriptor propertyDescriptor[] = { localeChoices, selectedLocales, displayStyle, 
  81.                                                   acceptLeafNodesOnly, allowMultiSelect, 
  82.                                                   title, collationLocale, animationEnabled, locale,
  83.                                                   background, foreground, font };
  84.       return propertyDescriptor;
  85.     } catch (IntrospectionException e) {
  86.       e.printStackTrace();
  87.       return null;
  88.     }
  89.   }
  90.  
  91.   public EventSetDescriptor[] getEventSetDescriptors() {
  92.     try {
  93.       EventSetDescriptor localeChanged = new EventSetDescriptor(LocaleChooser.class,
  94.                                                                 "localeChangeEvent",
  95.                                                                 LocaleChangeListener.class,
  96.                                                                 "localeChanged");
  97.  
  98.       localeChanged.setShortDescription(resourceBundle.getString("localeChanged"));
  99.         
  100.       EventSetDescriptor[] eventDescriptor = { localeChanged };
  101.       return eventDescriptor;
  102.     } catch (IntrospectionException e) {
  103.       e.printStackTrace();
  104.       return null;
  105.     }
  106.   }
  107.  
  108.   public BeanDescriptor getBeanDescriptor() {
  109.     return new BeanDescriptor(LocaleChooser.class);
  110.   }
  111.  
  112.   public Image getIcon(int iconKind) {
  113.     if (iconKind == BeanInfo.ICON_COLOR_32x32) {
  114.       return loadImage("resources/LocaleChooserIconColor32.gif");
  115.     }
  116.     return null;
  117.   }
  118.  
  119. }
  120.