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