home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Main.bin / JWrappingLabelBeanInfo.java < prev    next >
Text File  |  1998-10-27  |  3KB  |  89 lines

  1. package com.symantec.itools.swing;
  2.  
  3. import java.beans.*;
  4. import java.util.ResourceBundle;
  5. import com.symantec.itools.swing.beans.BeanDescriptorAttributes;
  6. import com.symantec.itools.beans.HelperBeanInfo;
  7. import com.symantec.itools.swing.DesignTimeResourceBundle;
  8. import com.symantec.itools.vcafe.beans.PropertyDescriptorAttributes;
  9. import com.symantec.itools.vcafe.beans.PropertyHelpIDs;
  10.  
  11. public final class JWrappingLabelBeanInfo
  12.     extends HelperBeanInfo
  13. {
  14.     public JWrappingLabelBeanInfo()
  15.     {
  16.         setInheritSuperBeanInfo(true);
  17.         
  18.         ResourceBundle resources = ResourceBundle.getBundle("com.symantec.itools.swing.DesignTimeResourceBundle");
  19.         String folderName = resources.getString(DesignTimeResourceBundle.SWING_ADDITIONS_FOLDER_TOOLBAR_KEY);
  20.         setComponentLibraryFolder(folderName);
  21.         setToolbarFolder(folderName);
  22.         
  23.         setWinHelpKey(winHelpID);
  24.         setIsContainer(Boolean.FALSE);
  25.     }
  26.     
  27.     public PropertyDescriptor[] getPropertyDescriptors()
  28.     {
  29.         try
  30.         {
  31.             PropertyDescriptor alignmentPD = new PropertyDescriptor("textAlignment", m_JWrappingLabelClass);
  32.             alignmentPD.setPropertyEditorClass(TextAlignmentPropertyEditor.class);
  33.             alignmentPD.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JWRAPPINGLABEL_TEXT_ALIGNMENT_HELP_ID));
  34.             
  35.             PropertyDescriptor textPD = new PropertyDescriptor("text", m_JWrappingLabelClass);
  36.             textPD.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JWRAPPINGLABEL_TEXT_HELP_ID));
  37.             
  38.             PropertyDescriptor[] rv = { alignmentPD, textPD };
  39.             return rv;
  40.         }
  41.         catch(IntrospectionException e)
  42.         {
  43.             e.printStackTrace();
  44.         }
  45.         
  46.         //Error, return no properties
  47.         return new PropertyDescriptor[0];
  48.     }
  49.     
  50.     public int getDefaultPropertyIndex()
  51.     {
  52.         //Text is our default property
  53.         return 1;
  54.     }
  55.     
  56.     public java.awt.Image getIcon(int iconKind)
  57.     {
  58.         // Inherit icons from JLabel's BeanInfo
  59.         
  60.         if (m_JLabelBeanInfo == null)
  61.         {
  62.             try
  63.             {
  64.                 Class JLabelClass = Class.forName("com.sun.java.swing.JLabel");
  65.                 m_JLabelBeanInfo = Introspector.getBeanInfo(JLabelClass);
  66.             }
  67.             catch(ClassNotFoundException classNotFoundException)
  68.             {
  69.             }
  70.             catch(IntrospectionException introspectionException)
  71.             {
  72.             }
  73.         }
  74.         
  75.         if (m_JLabelBeanInfo != null)
  76.             return m_JLabelBeanInfo.getIcon(iconKind);
  77.         return super.getIcon(iconKind);
  78.     }
  79.     
  80.     protected Class getBeanClass()
  81.     {
  82.         return m_JWrappingLabelClass;
  83.     }
  84.     
  85.     private static BeanInfo m_JLabelBeanInfo = null;
  86.     
  87.     protected final static String winHelpID = "0x600FF";
  88.     protected final static Class m_JWrappingLabelClass = JWrappingLabel.class;
  89. }