001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.visualweb.faces.dt_1_2.component;
043:
044: import java.awt.Image;
045: import java.beans.BeanDescriptor;
046: import java.beans.BeanInfo;
047: import java.beans.IntrospectionException;
048: import java.beans.PropertyDescriptor;
049: import java.util.Locale;
050: import java.util.List;
051: import java.util.ArrayList;
052: import java.util.Arrays;
053: import java.util.ResourceBundle;
054:
055: import com.sun.rave.designtime.CategoryDescriptor;
056: import com.sun.rave.designtime.Constants;
057: import com.sun.rave.designtime.faces.FacetDescriptor;
058: import com.sun.rave.designtime.markup.AttributeDescriptor;
059:
060: import org.netbeans.modules.visualweb.faces.dt.HtmlBeanInfoBase;
061: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
062: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
063:
064: /**
065: * <p>Auto-generated design time metadata class.
066: * Do <strong>NOT</strong> modify; all changes
067: * <strong>will</strong> be lost!</p>
068: */
069:
070: abstract class UINamingContainerBeanInfoBase extends HtmlBeanInfoBase {
071:
072: protected static ResourceBundle resources = ResourceBundle
073: .getBundle(
074: "org.netbeans.modules.visualweb.faces.dt_1_2.component.Bundle-JSF",
075: Locale.getDefault(),
076: UINamingContainerBeanInfoBase.class
077: .getClassLoader());
078:
079: /**
080: * <p>Construct a new <code>UINamingContainerBeanInfoBase</code>.</p>
081: */
082: public UINamingContainerBeanInfoBase() {
083:
084: beanClass = javax.faces.component.UINamingContainer.class;
085: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/UINamingContainer_C16";
086: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/UINamingContainer_C32";
087: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/UINamingContainer_M16";
088: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/UINamingContainer_M32";
089:
090: }
091:
092: private BeanDescriptor beanDescriptor;
093:
094: /**
095: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
096: */
097: public BeanDescriptor getBeanDescriptor() {
098:
099: if (beanDescriptor != null) {
100: return beanDescriptor;
101: }
102:
103: beanDescriptor = new BeanDescriptorBase(beanClass);
104: beanDescriptor.setDisplayName(resources
105: .getString("UINamingContainer_DisplayName"));
106: beanDescriptor.setShortDescription(resources
107: .getString("UINamingContainer_Description"));
108: beanDescriptor.setExpert(false);
109: beanDescriptor.setHidden(false);
110: beanDescriptor.setPreferred(false);
111: beanDescriptor.setValue(
112: Constants.BeanDescriptor.FACET_DESCRIPTORS,
113: getFacetDescriptors());
114: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
115: "namingContainer");
116: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
117: Boolean.TRUE);
118: beanDescriptor.setValue(
119: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
120: getCategoryDescriptors());
121: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
122: "namingContainer");
123:
124: return beanDescriptor;
125:
126: }
127:
128: /**
129: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
130: */
131: private CategoryDescriptor[] getCategoryDescriptors() {
132:
133: return com.sun.rave.designtime.base.CategoryDescriptors
134: .getDefaultCategoryDescriptors();
135:
136: }
137:
138: /**
139: * <p>The cached facet descriptors.</p>
140: */
141: protected FacetDescriptor[] facetDescriptors;
142:
143: /**
144: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
145: */
146: public FacetDescriptor[] getFacetDescriptors() {
147:
148: if (facetDescriptors != null) {
149: return facetDescriptors;
150: }
151: facetDescriptors = new FacetDescriptor[] {};
152: return facetDescriptors;
153:
154: }
155:
156: /**
157: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
158: */
159:
160: private PropertyDescriptor[] propertyDescriptors;
161:
162: /**
163: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
164: */
165: public PropertyDescriptor[] getPropertyDescriptors() {
166:
167: if (propertyDescriptors != null) {
168: return propertyDescriptors;
169: }
170: AttributeDescriptor attrib = null;
171:
172: try {
173:
174: PropertyDescriptor prop_attributes = new PropertyDescriptorBase(
175: "attributes", beanClass, "getAttributes", null);
176: prop_attributes
177: .setDisplayName(resources
178: .getString("UINamingContainer_attributes_DisplayName"));
179: prop_attributes
180: .setShortDescription(resources
181: .getString("UINamingContainer_attributes_Description"));
182: prop_attributes.setExpert(false);
183: prop_attributes.setHidden(true);
184: prop_attributes.setPreferred(false);
185: prop_attributes
186: .setValue(
187: Constants.PropertyDescriptor.CATEGORY,
188: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
189:
190: PropertyDescriptor prop_childCount = new PropertyDescriptorBase(
191: "childCount", beanClass, "getChildCount", null);
192: prop_childCount
193: .setDisplayName(resources
194: .getString("UINamingContainer_childCount_DisplayName"));
195: prop_childCount
196: .setShortDescription(resources
197: .getString("UINamingContainer_childCount_Description"));
198: prop_childCount.setExpert(false);
199: prop_childCount.setHidden(true);
200: prop_childCount.setPreferred(false);
201: prop_childCount
202: .setValue(
203: Constants.PropertyDescriptor.CATEGORY,
204: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
205:
206: PropertyDescriptor prop_children = new PropertyDescriptorBase(
207: "children", beanClass, "getChildren", null);
208: prop_children
209: .setDisplayName(resources
210: .getString("UINamingContainer_children_DisplayName"));
211: prop_children
212: .setShortDescription(resources
213: .getString("UINamingContainer_children_Description"));
214: prop_children.setExpert(false);
215: prop_children.setHidden(true);
216: prop_children.setPreferred(false);
217: prop_children
218: .setValue(
219: Constants.PropertyDescriptor.CATEGORY,
220: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
221:
222: PropertyDescriptor prop_facets = new PropertyDescriptorBase(
223: "facets", beanClass, "getFacets", null);
224: prop_facets.setDisplayName(resources
225: .getString("UINamingContainer_facets_DisplayName"));
226: prop_facets.setShortDescription(resources
227: .getString("UINamingContainer_facets_Description"));
228: prop_facets.setExpert(false);
229: prop_facets.setHidden(true);
230: prop_facets.setPreferred(false);
231: prop_facets
232: .setValue(
233: Constants.PropertyDescriptor.CATEGORY,
234: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
235:
236: PropertyDescriptor prop_family = new PropertyDescriptorBase(
237: "family", beanClass, "getFamily", null);
238: prop_family.setDisplayName(resources
239: .getString("UINamingContainer_family_DisplayName"));
240: prop_family.setShortDescription(resources
241: .getString("UINamingContainer_family_Description"));
242: prop_family.setExpert(false);
243: prop_family.setHidden(true);
244: prop_family.setPreferred(false);
245: prop_family
246: .setValue(
247: Constants.PropertyDescriptor.CATEGORY,
248: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
249:
250: PropertyDescriptor prop_id = new PropertyDescriptorBase(
251: "id", beanClass, "getId", "setId");
252: prop_id.setDisplayName(resources
253: .getString("UINamingContainer_id_DisplayName"));
254: prop_id.setShortDescription(resources
255: .getString("UINamingContainer_id_Description"));
256: prop_id.setExpert(false);
257: prop_id.setHidden(true);
258: prop_id.setPreferred(false);
259: attrib = new AttributeDescriptor("id", false, null, true);
260: prop_id.setValue(
261: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
262: attrib);
263: prop_id
264: .setValue(
265: Constants.PropertyDescriptor.CATEGORY,
266: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
267:
268: PropertyDescriptor prop_parent = new PropertyDescriptorBase(
269: "parent", beanClass, "getParent", null);
270: prop_parent.setDisplayName(resources
271: .getString("UINamingContainer_parent_DisplayName"));
272: prop_parent.setShortDescription(resources
273: .getString("UINamingContainer_parent_Description"));
274: prop_parent.setExpert(false);
275: prop_parent.setHidden(true);
276: prop_parent.setPreferred(false);
277: prop_parent
278: .setValue(
279: Constants.PropertyDescriptor.CATEGORY,
280: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
281:
282: PropertyDescriptor prop_rendered = new PropertyDescriptorBase(
283: "rendered", beanClass, "isRendered", "setRendered");
284: prop_rendered
285: .setDisplayName(resources
286: .getString("UINamingContainer_rendered_DisplayName"));
287: prop_rendered
288: .setShortDescription(resources
289: .getString("UINamingContainer_rendered_Description"));
290: prop_rendered.setExpert(false);
291: prop_rendered.setHidden(false);
292: prop_rendered.setPreferred(false);
293: attrib = new AttributeDescriptor("rendered", false, null,
294: true);
295: prop_rendered.setValue(
296: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
297: attrib);
298: prop_rendered
299: .setValue(
300: Constants.PropertyDescriptor.CATEGORY,
301: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
302:
303: PropertyDescriptor prop_rendererType = new PropertyDescriptorBase(
304: "rendererType", beanClass, "getRendererType",
305: "setRendererType");
306: prop_rendererType
307: .setDisplayName(resources
308: .getString("UINamingContainer_rendererType_DisplayName"));
309: prop_rendererType
310: .setShortDescription(resources
311: .getString("UINamingContainer_rendererType_Description"));
312: prop_rendererType.setExpert(false);
313: prop_rendererType.setHidden(true);
314: prop_rendererType.setPreferred(false);
315: prop_rendererType
316: .setValue(
317: Constants.PropertyDescriptor.CATEGORY,
318: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
319:
320: PropertyDescriptor prop_rendersChildren = new PropertyDescriptorBase(
321: "rendersChildren", beanClass, "getRendersChildren",
322: null);
323: prop_rendersChildren
324: .setDisplayName(resources
325: .getString("UINamingContainer_rendersChildren_DisplayName"));
326: prop_rendersChildren
327: .setShortDescription(resources
328: .getString("UINamingContainer_rendersChildren_Description"));
329: prop_rendersChildren.setExpert(false);
330: prop_rendersChildren.setHidden(true);
331: prop_rendersChildren.setPreferred(false);
332: prop_rendersChildren
333: .setValue(
334: Constants.PropertyDescriptor.CATEGORY,
335: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
336:
337: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
338: propertyDescriptorList.add(prop_attributes);
339: propertyDescriptorList.add(prop_childCount);
340: propertyDescriptorList.add(prop_children);
341: propertyDescriptorList.add(prop_facets);
342: propertyDescriptorList.add(prop_family);
343: propertyDescriptorList.add(prop_id);
344: propertyDescriptorList.add(prop_parent);
345: propertyDescriptorList.add(prop_rendered);
346: propertyDescriptorList.add(prop_rendererType);
347: propertyDescriptorList.add(prop_rendersChildren);
348:
349: propertyDescriptorList.addAll(Arrays.asList(super
350: .getPropertyDescriptors()));
351: propertyDescriptors = propertyDescriptorList
352: .toArray(new PropertyDescriptor[propertyDescriptorList
353: .size()]);
354: return propertyDescriptors;
355:
356: } catch (IntrospectionException e) {
357: e.printStackTrace();
358: return null;
359: }
360:
361: }
362:
363: }
|