001: /*
002: * Generated file - Do not edit!
003: */
004: package com.l2fprod.common.swing;
005:
006: import java.awt.Image;
007: import java.beans.BeanDescriptor;
008: import java.beans.BeanInfo;
009: import java.beans.IntrospectionException;
010: import java.beans.Introspector;
011: import java.beans.PropertyDescriptor;
012: import java.beans.SimpleBeanInfo;
013: import java.util.Vector;
014:
015: /**
016: * BeanInfo class for JFontChooser.
017: */
018: public class JFontChooserBeanInfo extends SimpleBeanInfo {
019:
020: /** Description of the Field */
021: protected BeanDescriptor bd = new BeanDescriptor(
022: com.l2fprod.common.swing.JFontChooser.class);
023: /** Description of the Field */
024: protected Image iconMono16 = loadImage("JFontChooser16-mono.gif");
025: /** Description of the Field */
026: protected Image iconColor16 = loadImage("JFontChooser16.gif");
027: /** Description of the Field */
028: protected Image iconMono32 = loadImage("JFontChooser32-mono.gif");
029: /** Description of the Field */
030: protected Image iconColor32 = loadImage("JFontChooser32.gif");
031:
032: /** Constructor for the JFontChooserBeanInfo object */
033: public JFontChooserBeanInfo()
034: throws java.beans.IntrospectionException {
035: // setup bean descriptor in constructor.
036: bd.setName("JFontChooser");
037:
038: bd
039: .setShortDescription("A component that supports selecting a Font.");
040:
041: bd.setValue("isContainer", Boolean.FALSE);
042:
043: BeanInfo info = Introspector.getBeanInfo(getBeanDescriptor()
044: .getBeanClass().getSuperclass());
045: String order = info.getBeanDescriptor().getValue(
046: "propertyorder") == null ? "" : (String) info
047: .getBeanDescriptor().getValue("propertyorder");
048: PropertyDescriptor[] pd = getPropertyDescriptors();
049: for (int i = 0; i != pd.length; i++) {
050: if (order.indexOf(pd[i].getName()) == -1) {
051: order = order + (order.length() == 0 ? "" : ":")
052: + pd[i].getName();
053: }
054: }
055: getBeanDescriptor().setValue("propertyorder", order);
056: }
057:
058: /**
059: * Gets the additionalBeanInfo
060: *
061: * @return The additionalBeanInfo value
062: */
063: public BeanInfo[] getAdditionalBeanInfo() {
064: Vector bi = new Vector();
065: BeanInfo[] biarr = null;
066: try {
067: for (Class cl = com.l2fprod.common.swing.JFontChooser.class
068: .getSuperclass(); !cl
069: .equals(javax.swing.JComponent.class
070: .getSuperclass()); cl = cl.getSuperclass()) {
071: bi.addElement(Introspector.getBeanInfo(cl));
072: }
073: biarr = new BeanInfo[bi.size()];
074: bi.copyInto(biarr);
075: } catch (Exception e) {
076: // Ignore it
077: }
078: return biarr;
079: }
080:
081: /**
082: * Gets the beanDescriptor
083: *
084: * @return The beanDescriptor value
085: */
086: public BeanDescriptor getBeanDescriptor() {
087: return bd;
088: }
089:
090: /**
091: * Gets the defaultPropertyIndex
092: *
093: * @return The defaultPropertyIndex value
094: */
095: public int getDefaultPropertyIndex() {
096: String defName = "";
097: if (defName.equals("")) {
098: return -1;
099: }
100: PropertyDescriptor[] pd = getPropertyDescriptors();
101: for (int i = 0; i < pd.length; i++) {
102: if (pd[i].getName().equals(defName)) {
103: return i;
104: }
105: }
106: return -1;
107: }
108:
109: /**
110: * Gets the icon
111: *
112: * @param type
113: * Description of the Parameter
114: * @return The icon value
115: */
116: public Image getIcon(int type) {
117: if (type == BeanInfo.ICON_COLOR_16x16) {
118: return iconColor16;
119: }
120: if (type == BeanInfo.ICON_MONO_16x16) {
121: return iconMono16;
122: }
123: if (type == BeanInfo.ICON_COLOR_32x32) {
124: return iconColor32;
125: }
126: if (type == BeanInfo.ICON_MONO_32x32) {
127: return iconMono32;
128: }
129: return null;
130: }
131:
132: /**
133: * Gets the Property Descriptors
134: *
135: * @return The propertyDescriptors value
136: */
137: public PropertyDescriptor[] getPropertyDescriptors() {
138: try {
139: Vector descriptors = new Vector();
140: PropertyDescriptor descriptor = null;
141:
142: try {
143: descriptor = new PropertyDescriptor("selectedFont",
144: com.l2fprod.common.swing.JFontChooser.class);
145: } catch (IntrospectionException e) {
146: descriptor = new PropertyDescriptor("selectedFont",
147: com.l2fprod.common.swing.JFontChooser.class,
148: "getSelectedFont", null);
149: }
150:
151: descriptor
152: .setShortDescription("The current font the chooser is to display");
153:
154: descriptor.setPreferred(true);
155:
156: descriptor.setBound(true);
157:
158: descriptors.add(descriptor);
159:
160: return (PropertyDescriptor[]) descriptors
161: .toArray(new PropertyDescriptor[descriptors.size()]);
162: } catch (Exception e) {
163: // do not ignore, bomb politely so use has chance to discover what went
164: // wrong...
165: // I know that this is suboptimal solution, but swallowing silently is
166: // even worse... Propose better solution!
167: e.printStackTrace();
168: }
169: return null;
170: }
171:
172: }
|