J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | import java.util.HashMap; |
| 27 | |
| 28 | /** |
| 29 | * Class that holds information for populating a FeatureDescriptor. For the class, |
| 30 | * This information represents the BeanDescriptor, for a property, it represents |
| 31 | * a PropertyDescriptor. |
| 32 | */ |
| 33 | public class DocBeanInfo { |
| 34 | |
| 35 | // Values of the BeanFlags |
| 36 | public static final int BOUND = 1; |
| 37 | public static final int EXPERT = 2; |
| 38 | public static final int CONSTRAINED = 4; |
| 39 | public static final int HIDDEN = 8; |
| 40 | public static final int PREFERRED = 16 ; |
| 41 | |
| 42 | public String name; |
| 43 | public int beanflags; |
| 44 | public String desc; |
| 45 | public String displayname; |
| 46 | public String propertyeditorclass; |
| 47 | public String customizerclass; |
| 48 | |
| 49 | public HashMap attribs; |
| 50 | public HashMap enums; |
| 51 | |
| 52 | public DocBeanInfo(){} |
| 53 | |
| 54 | public DocBeanInfo(String p, int flags, String d, |
| 55 | String displayname, String pec, String cc, |
| 56 | HashMap attribs, HashMap enums) { |
| 57 | this.name = p; |
| 58 | this.beanflags = flags; |
| 59 | this.desc = d; |
| 60 | this.displayname = displayname; |
| 61 | this.propertyeditorclass = pec; |
| 62 | this.customizerclass = cc; |
| 63 | |
| 64 | this.attribs = attribs; |
| 65 | this.enums = enums; |
| 66 | } |
| 67 | |
| 68 | public String toString() { |
| 69 | StringBuffer buffer = new StringBuffer("*****"); |
| 70 | buffer.append("\nProperty: " + name); |
| 71 | buffer.append("\tDescription: " + desc); |
| 72 | buffer.append("\nDisplayname: " + displayname); |
| 73 | buffer.append("\nPropertyEditorClass: " + propertyeditorclass); |
| 74 | buffer.append("\nCustomizerClass: " + customizerclass); |
| 75 | |
| 76 | if ((beanflags & BOUND) != 0) |
| 77 | buffer.append("\nBound: true"); |
| 78 | |
| 79 | if ((beanflags & EXPERT) != 0) |
| 80 | buffer.append("\nExpert: true"); |
| 81 | |
| 82 | if ((beanflags & CONSTRAINED) != 0) |
| 83 | buffer.append("\nConstrained: true"); |
| 84 | |
| 85 | if ((beanflags & HIDDEN) !=0) |
| 86 | buffer.append("\nHidden: true"); |
| 87 | |
| 88 | if ((beanflags & PREFERRED) !=0) |
| 89 | |
| 90 | if (attribs != null) |
| 91 | buffer.append(attribs.toString()); |
| 92 | |
| 93 | if (enums != null) |
| 94 | buffer.append(enums.toString()); |
| 95 | |
| 96 | return buffer.toString(); |
| 97 | } |
| 98 | |
| 99 | } |