home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-10-27 | 3.0 KB | 89 lines |
- package com.symantec.itools.swing;
-
- import java.beans.*;
- import java.util.ResourceBundle;
- import com.symantec.itools.swing.beans.BeanDescriptorAttributes;
- import com.symantec.itools.beans.HelperBeanInfo;
- import com.symantec.itools.swing.DesignTimeResourceBundle;
- import com.symantec.itools.vcafe.beans.PropertyDescriptorAttributes;
- import com.symantec.itools.vcafe.beans.PropertyHelpIDs;
-
- public final class JWrappingLabelBeanInfo
- extends HelperBeanInfo
- {
- public JWrappingLabelBeanInfo()
- {
- setInheritSuperBeanInfo(true);
-
- ResourceBundle resources = ResourceBundle.getBundle("com.symantec.itools.swing.DesignTimeResourceBundle");
- String folderName = resources.getString(DesignTimeResourceBundle.SWING_ADDITIONS_FOLDER_TOOLBAR_KEY);
- setComponentLibraryFolder(folderName);
- setToolbarFolder(folderName);
-
- setWinHelpKey(winHelpID);
- setIsContainer(Boolean.FALSE);
- }
-
- public PropertyDescriptor[] getPropertyDescriptors()
- {
- try
- {
- PropertyDescriptor alignmentPD = new PropertyDescriptor("textAlignment", m_JWrappingLabelClass);
- alignmentPD.setPropertyEditorClass(TextAlignmentPropertyEditor.class);
- alignmentPD.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JWRAPPINGLABEL_TEXT_ALIGNMENT_HELP_ID));
-
- PropertyDescriptor textPD = new PropertyDescriptor("text", m_JWrappingLabelClass);
- textPD.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JWRAPPINGLABEL_TEXT_HELP_ID));
-
- PropertyDescriptor[] rv = { alignmentPD, textPD };
- return rv;
- }
- catch(IntrospectionException e)
- {
- e.printStackTrace();
- }
-
- //Error, return no properties
- return new PropertyDescriptor[0];
- }
-
- public int getDefaultPropertyIndex()
- {
- //Text is our default property
- return 1;
- }
-
- public java.awt.Image getIcon(int iconKind)
- {
- // Inherit icons from JLabel's BeanInfo
-
- if (m_JLabelBeanInfo == null)
- {
- try
- {
- Class JLabelClass = Class.forName("com.sun.java.swing.JLabel");
- m_JLabelBeanInfo = Introspector.getBeanInfo(JLabelClass);
- }
- catch(ClassNotFoundException classNotFoundException)
- {
- }
- catch(IntrospectionException introspectionException)
- {
- }
- }
-
- if (m_JLabelBeanInfo != null)
- return m_JLabelBeanInfo.getIcon(iconKind);
- return super.getIcon(iconKind);
- }
-
- protected Class getBeanClass()
- {
- return m_JWrappingLabelClass;
- }
-
- private static BeanInfo m_JLabelBeanInfo = null;
-
- protected final static String winHelpID = "0x600FF";
- protected final static Class m_JWrappingLabelClass = JWrappingLabel.class;
- }