View Javadoc
1   /*
2    * Copyright (c) 1998, 2013, Oracle and/or its affiliates. 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.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package build.tools.swingbeaninfo;
27  
28  import java.util.HashMap;
29  
30  /**
31   * Class that holds information for populating a FeatureDescriptor. For the class,
32   * This information represents the BeanDescriptor, for a property, it represents
33   * a PropertyDescriptor.
34   */
35  public class DocBeanInfo {
36  
37      // Values of the BeanFlags
38      public static final int BOUND = 1;
39      public static final int EXPERT = 2;
40      public static final int CONSTRAINED = 4;
41      public static final int HIDDEN = 8;
42      public static final int PREFERRED = 16 ;
43  
44      public String name;
45      public int beanflags;
46      public String desc;
47      public String displayname;
48      public String propertyeditorclass;
49      public String customizerclass;
50  
51      public HashMap attribs;
52      public HashMap enums;
53  
54      public DocBeanInfo(){}
55  
56      public DocBeanInfo(String p, int flags, String d,
57                           String displayname, String pec, String cc,
58                           HashMap attribs, HashMap enums) {
59          this.name = p;
60          this.beanflags = flags;
61          this.desc = d;
62          this.displayname = displayname;
63          this.propertyeditorclass = pec;
64          this.customizerclass = cc;
65  
66          this.attribs = attribs;
67          this.enums = enums;
68      }
69  
70      public String toString() {
71          StringBuffer buffer = new StringBuffer("*****");
72          buffer.append("\nProperty: " + name);
73          buffer.append("\tDescription: " + desc);
74          buffer.append("\nDisplayname: " + displayname);
75          buffer.append("\nPropertyEditorClass: " + propertyeditorclass);
76          buffer.append("\nCustomizerClass: " + customizerclass);
77  
78          if ((beanflags & BOUND) != 0)
79              buffer.append("\nBound: true");
80  
81          if ((beanflags & EXPERT) != 0)
82              buffer.append("\nExpert: true");
83  
84          if ((beanflags & CONSTRAINED) != 0)
85              buffer.append("\nConstrained: true");
86  
87          if ((beanflags & HIDDEN) !=0)
88              buffer.append("\nHidden:  true");
89  
90          if ((beanflags & PREFERRED) !=0)
91  
92          if (attribs != null)
93              buffer.append(attribs.toString());
94  
95          if (enums != null)
96              buffer.append(enums.toString());
97  
98          return buffer.toString();
99      }
100 
101 }