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: package org.netbeans.modules.visualweb.faces.dt.component.html;
042:
043: import java.awt.Image;
044: import java.beans.BeanDescriptor;
045: import java.beans.BeanInfo;
046: import java.beans.IntrospectionException;
047: import java.beans.PropertyDescriptor;
048: import java.util.Locale;
049: import java.util.ResourceBundle;
050:
051: import com.sun.rave.designtime.CategoryDescriptor;
052: import com.sun.rave.designtime.Constants;
053: import com.sun.rave.designtime.faces.FacetDescriptor;
054: import com.sun.rave.designtime.markup.AttributeDescriptor;
055:
056: import org.netbeans.modules.visualweb.faces.dt.HtmlBeanInfoBase;
057: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
058: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
059:
060: abstract class HtmlPanelGroupBeanInfoBase extends HtmlBeanInfoBase {
061:
062: protected static ResourceBundle resources = ResourceBundle
063: .getBundle(
064: "org.netbeans.modules.visualweb.faces.dt.component.html.Bundle-JSF-base",
065: Locale.getDefault(),
066: HtmlPanelGroupBeanInfoBase.class.getClassLoader());
067:
068: /**
069: * <p>Construct a new <code>HtmlPanelGroupBeanInfoBase</code>.</p>
070: */
071: public HtmlPanelGroupBeanInfoBase() {
072: beanClass = javax.faces.component.html.HtmlPanelGroup.class;
073: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt/component/html/HtmlPanelGroup_C16";
074: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt/component/html/HtmlPanelGroup_C32";
075: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt/component/html/HtmlPanelGroup_M16";
076: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt/component/html/HtmlPanelGroup_M32";
077:
078: }
079:
080: private BeanDescriptor beanDescriptor;
081:
082: /**
083: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
084: */
085: public BeanDescriptor getBeanDescriptor() {
086:
087: if (beanDescriptor != null) {
088: return beanDescriptor;
089: }
090:
091: beanDescriptor = new BeanDescriptorBase(beanClass);
092: beanDescriptor.setDisplayName(resources
093: .getString("HtmlPanelGroup_DisplayName"));
094: beanDescriptor.setShortDescription(resources
095: .getString("HtmlPanelGroup_Description"));
096: beanDescriptor.setExpert(false);
097: beanDescriptor.setHidden(false);
098: beanDescriptor.setPreferred(false);
099: beanDescriptor.setValue(
100: Constants.BeanDescriptor.FACET_DESCRIPTORS,
101: getFacetDescriptors());
102: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
103: "projrave_ui_elements_palette_jsfstd_group_panel");
104: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
105: "groupPanel");
106: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
107: Boolean.TRUE);
108: beanDescriptor
109: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
110: "projrave_ui_elements_propsheets_jsfstd_group_panel_props");
111: beanDescriptor.setValue(
112: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
113: getCategoryDescriptors());
114: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
115: "panelGroup");
116: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
117: "h");
118: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
119: "http://java.sun.com/jsf/html");
120: return beanDescriptor;
121:
122: }
123:
124: /**
125: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
126: */
127: private CategoryDescriptor[] getCategoryDescriptors() {
128:
129: return com.sun.rave.designtime.base.CategoryDescriptors
130: .getDefaultCategoryDescriptors();
131:
132: }
133:
134: /**
135: * <p>The cached facet descriptors.</p>
136: */
137: protected FacetDescriptor[] facetDescriptors;
138:
139: /**
140: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
141: */
142: public FacetDescriptor[] getFacetDescriptors() {
143:
144: if (facetDescriptors != null) {
145: return facetDescriptors;
146: }
147: facetDescriptors = new FacetDescriptor[] {};
148: return facetDescriptors;
149:
150: }
151:
152: private PropertyDescriptor[] propDescriptors;
153:
154: /**
155: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
156: */
157: public PropertyDescriptor[] getPropertyDescriptors() {
158:
159: if (propDescriptors != null) {
160: return propDescriptors;
161: }
162: AttributeDescriptor attrib = null;
163:
164: try {
165:
166: PropertyDescriptor prop_attributes = new PropertyDescriptorBase(
167: "attributes", beanClass, "getAttributes", null);
168: prop_attributes
169: .setDisplayName(resources
170: .getString("HtmlPanelGroup_attributes_DisplayName"));
171: prop_attributes
172: .setShortDescription(resources
173: .getString("HtmlPanelGroup_attributes_Description"));
174: prop_attributes.setExpert(false);
175: prop_attributes.setHidden(true);
176: prop_attributes.setPreferred(false);
177: prop_attributes
178: .setValue(
179: Constants.PropertyDescriptor.CATEGORY,
180: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
181:
182: PropertyDescriptor prop_childCount = new PropertyDescriptorBase(
183: "childCount", beanClass, "getChildCount", null);
184: prop_childCount
185: .setDisplayName(resources
186: .getString("HtmlPanelGroup_childCount_DisplayName"));
187: prop_childCount
188: .setShortDescription(resources
189: .getString("HtmlPanelGroup_childCount_Description"));
190: prop_childCount.setExpert(false);
191: prop_childCount.setHidden(true);
192: prop_childCount.setPreferred(false);
193: prop_childCount
194: .setValue(
195: Constants.PropertyDescriptor.CATEGORY,
196: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
197:
198: PropertyDescriptor prop_children = new PropertyDescriptorBase(
199: "children", beanClass, "getChildren", null);
200: prop_children.setDisplayName(resources
201: .getString("HtmlPanelGroup_children_DisplayName"));
202: prop_children.setShortDescription(resources
203: .getString("HtmlPanelGroup_children_Description"));
204: prop_children.setExpert(false);
205: prop_children.setHidden(true);
206: prop_children.setPreferred(false);
207: prop_children
208: .setValue(
209: Constants.PropertyDescriptor.CATEGORY,
210: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
211:
212: PropertyDescriptor prop_facets = new PropertyDescriptorBase(
213: "facets", beanClass, "getFacets", null);
214: prop_facets.setDisplayName(resources
215: .getString("HtmlPanelGroup_facets_DisplayName"));
216: prop_facets.setShortDescription(resources
217: .getString("HtmlPanelGroup_facets_Description"));
218: prop_facets.setExpert(false);
219: prop_facets.setHidden(true);
220: prop_facets.setPreferred(false);
221: prop_facets
222: .setValue(
223: Constants.PropertyDescriptor.CATEGORY,
224: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
225:
226: PropertyDescriptor prop_family = new PropertyDescriptorBase(
227: "family", beanClass, "getFamily", null);
228: prop_family.setDisplayName(resources
229: .getString("HtmlPanelGroup_family_DisplayName"));
230: prop_family.setShortDescription(resources
231: .getString("HtmlPanelGroup_family_Description"));
232: prop_family.setExpert(false);
233: prop_family.setHidden(true);
234: prop_family.setPreferred(false);
235: prop_family
236: .setValue(
237: Constants.PropertyDescriptor.CATEGORY,
238: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
239:
240: PropertyDescriptor prop_id = new PropertyDescriptorBase(
241: "id", beanClass, "getId", "setId");
242: prop_id.setDisplayName(resources
243: .getString("HtmlPanelGroup_id_DisplayName"));
244: prop_id.setShortDescription(resources
245: .getString("HtmlPanelGroup_id_Description"));
246: prop_id.setExpert(false);
247: prop_id.setHidden(true);
248: prop_id.setPreferred(false);
249: attrib = new AttributeDescriptor("id", false, null, true);
250: prop_id.setValue(
251: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
252: attrib);
253: prop_id
254: .setValue(
255: Constants.PropertyDescriptor.CATEGORY,
256: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
257:
258: PropertyDescriptor prop_parent = new PropertyDescriptorBase(
259: "parent", beanClass, "getParent", null);
260: prop_parent.setDisplayName(resources
261: .getString("HtmlPanelGroup_parent_DisplayName"));
262: prop_parent.setShortDescription(resources
263: .getString("HtmlPanelGroup_parent_Description"));
264: prop_parent.setExpert(false);
265: prop_parent.setHidden(true);
266: prop_parent.setPreferred(false);
267: prop_parent
268: .setValue(
269: Constants.PropertyDescriptor.CATEGORY,
270: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
271:
272: PropertyDescriptor prop_rendered = new PropertyDescriptorBase(
273: "rendered", beanClass, "isRendered", "setRendered");
274: prop_rendered.setDisplayName(resources
275: .getString("HtmlPanelGroup_rendered_DisplayName"));
276: prop_rendered.setShortDescription(resources
277: .getString("HtmlPanelGroup_rendered_Description"));
278: prop_rendered.setExpert(false);
279: prop_rendered.setHidden(false);
280: prop_rendered.setPreferred(false);
281: attrib = new AttributeDescriptor("rendered", false, null,
282: true);
283: prop_rendered.setValue(
284: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
285: attrib);
286: prop_rendered
287: .setValue(
288: Constants.PropertyDescriptor.CATEGORY,
289: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
290:
291: PropertyDescriptor prop_rendererType = new PropertyDescriptorBase(
292: "rendererType", beanClass, "getRendererType",
293: "setRendererType");
294: prop_rendererType
295: .setDisplayName(resources
296: .getString("HtmlPanelGroup_rendererType_DisplayName"));
297: prop_rendererType
298: .setShortDescription(resources
299: .getString("HtmlPanelGroup_rendererType_Description"));
300: prop_rendererType.setExpert(false);
301: prop_rendererType.setHidden(true);
302: prop_rendererType.setPreferred(false);
303: prop_rendererType
304: .setValue(
305: Constants.PropertyDescriptor.CATEGORY,
306: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
307:
308: PropertyDescriptor prop_rendersChildren = new PropertyDescriptorBase(
309: "rendersChildren", beanClass, "getRendersChildren",
310: null);
311: prop_rendersChildren
312: .setDisplayName(resources
313: .getString("HtmlPanelGroup_rendersChildren_DisplayName"));
314: prop_rendersChildren
315: .setShortDescription(resources
316: .getString("HtmlPanelGroup_rendersChildren_Description"));
317: prop_rendersChildren.setExpert(false);
318: prop_rendersChildren.setHidden(true);
319: prop_rendersChildren.setPreferred(false);
320: prop_rendersChildren
321: .setValue(
322: Constants.PropertyDescriptor.CATEGORY,
323: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
324:
325: PropertyDescriptor prop_style = new PropertyDescriptorBase(
326: "style", beanClass, "getStyle", "setStyle");
327: prop_style.setDisplayName(resources
328: .getString("HtmlPanelGroup_style_DisplayName"));
329: prop_style.setShortDescription(resources
330: .getString("HtmlPanelGroup_style_Description"));
331: prop_style
332: .setPropertyEditorClass(com.sun.rave.propertyeditors.css.CssStylePropertyEditor.class);
333: prop_style.setExpert(false);
334: prop_style.setHidden(false);
335: prop_style.setPreferred(false);
336: attrib = new AttributeDescriptor("style", false, null, true);
337: prop_style.setValue(
338: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
339: attrib);
340: prop_style
341: .setValue(
342: Constants.PropertyDescriptor.CATEGORY,
343: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
344:
345: PropertyDescriptor prop_styleClass = new PropertyDescriptorBase(
346: "styleClass", beanClass, "getStyleClass",
347: "setStyleClass");
348: prop_styleClass
349: .setDisplayName(resources
350: .getString("HtmlPanelGroup_styleClass_DisplayName"));
351: prop_styleClass
352: .setShortDescription(resources
353: .getString("HtmlPanelGroup_styleClass_Description"));
354: prop_styleClass
355: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
356: prop_styleClass.setExpert(false);
357: prop_styleClass.setHidden(false);
358: prop_styleClass.setPreferred(false);
359: attrib = new AttributeDescriptor("styleClass", false, null,
360: true);
361: prop_styleClass.setValue(
362: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
363: attrib);
364: prop_styleClass
365: .setValue(
366: Constants.PropertyDescriptor.CATEGORY,
367: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
368:
369: propDescriptors = new PropertyDescriptor[] {
370: prop_attributes, prop_childCount, prop_children,
371: prop_facets, prop_family, prop_id, prop_parent,
372: prop_rendered, prop_rendererType,
373: prop_rendersChildren, prop_style, prop_styleClass, };
374: return propDescriptors;
375:
376: } catch (IntrospectionException e) {
377: e.printStackTrace();
378: return null;
379: }
380:
381: }
382:
383: }
|