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.html;
043:
044: import java.beans.BeanDescriptor;
045: import java.beans.IntrospectionException;
046: import java.beans.PropertyDescriptor;
047: import java.util.Locale;
048: import java.util.List;
049: import java.util.ArrayList;
050: import java.util.Arrays;
051: import java.util.ResourceBundle;
052:
053: import com.sun.rave.designtime.CategoryDescriptor;
054: import com.sun.rave.designtime.Constants;
055: import com.sun.rave.designtime.faces.FacetDescriptor;
056: import com.sun.rave.designtime.markup.AttributeDescriptor;
057: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
058: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
059: import org.netbeans.modules.visualweb.faces.dt_1_2.component.UIDataBeanInfoBase;
060:
061: public class HtmlDataTableBeanInfo extends UIDataBeanInfoBase {
062:
063: protected static ResourceBundle resources = ResourceBundle
064: .getBundle(
065: "org.netbeans.modules.visualweb.faces.dt_1_2.component.html.Bundle-JSF",
066: Locale.getDefault(), HtmlDataTableBeanInfo.class
067: .getClassLoader());
068:
069: public HtmlDataTableBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlDataTable.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlDataTable_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlDataTable_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlDataTable_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlDataTable_M32";
075: }
076:
077: private BeanDescriptor beanDescriptor;
078:
079: public BeanDescriptor getBeanDescriptor() {
080:
081: if (beanDescriptor != null) {
082: return beanDescriptor;
083: }
084:
085: beanDescriptor = new BeanDescriptorBase(beanClass);
086: beanDescriptor.setDisplayName(resources
087: .getString("HtmlDataTable_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlDataTable_Description"));
090: beanDescriptor.setExpert(false);
091: beanDescriptor.setHidden(false);
092: beanDescriptor.setPreferred(false);
093: beanDescriptor.setValue(
094: Constants.BeanDescriptor.FACET_DESCRIPTORS,
095: getFacetDescriptors());
096: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
097: "projrave_ui_elements_palette_jsfstd_data_table");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "dataTable");
100: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
101: Boolean.TRUE);
102: beanDescriptor
103: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
104: "projrave_ui_elements_propsheets_jsfstd_data_table_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "dataTable");
110: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
111: "h");
112: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
113: "http://java.sun.com/jsf/html");
114:
115: return beanDescriptor;
116:
117: }
118:
119: private PropertyDescriptor[] propertyDescriptors;
120:
121: public PropertyDescriptor[] getPropertyDescriptors() {
122:
123: if (propertyDescriptors != null) {
124: return propertyDescriptors;
125: }
126: AttributeDescriptor attrib = null;
127:
128: try {
129:
130: PropertyDescriptor prop_bgcolor = new PropertyDescriptorBase(
131: "bgcolor", beanClass, "getBgcolor", "setBgcolor");
132: prop_bgcolor.setDisplayName(resources
133: .getString("HtmlDataTable_bgcolor_DisplayName"));
134: prop_bgcolor.setShortDescription(resources
135: .getString("HtmlDataTable_bgcolor_Description"));
136: prop_bgcolor.setExpert(false);
137: prop_bgcolor.setHidden(false);
138: prop_bgcolor.setPreferred(false);
139: attrib = new AttributeDescriptor("bgcolor", false, null,
140: true);
141: prop_bgcolor.setValue(
142: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
143: attrib);
144: prop_bgcolor
145: .setValue(
146: Constants.PropertyDescriptor.CATEGORY,
147: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
148:
149: PropertyDescriptor prop_border = new PropertyDescriptorBase(
150: "border", beanClass, "getBorder", "setBorder");
151: prop_border.setDisplayName(resources
152: .getString("HtmlDataTable_border_DisplayName"));
153: prop_border.setShortDescription(resources
154: .getString("HtmlDataTable_border_Description"));
155: prop_border
156: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
157: prop_border.setExpert(false);
158: prop_border.setHidden(false);
159: prop_border.setPreferred(false);
160: attrib = new AttributeDescriptor("border", false, null,
161: true);
162: prop_border.setValue(
163: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
164: attrib);
165: prop_border
166: .setValue(
167: Constants.PropertyDescriptor.CATEGORY,
168: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
169: prop_border.setValue(
170: "com.sun.rave.propertyeditors.MIN_VALUE", "0");
171:
172: PropertyDescriptor prop_cellpadding = new PropertyDescriptorBase(
173: "cellpadding", beanClass, "getCellpadding",
174: "setCellpadding");
175: prop_cellpadding
176: .setDisplayName(resources
177: .getString("HtmlDataTable_cellpadding_DisplayName"));
178: prop_cellpadding
179: .setShortDescription(resources
180: .getString("HtmlDataTable_cellpadding_Description"));
181: prop_cellpadding
182: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
183: prop_cellpadding.setExpert(false);
184: prop_cellpadding.setHidden(false);
185: prop_cellpadding.setPreferred(false);
186: attrib = new AttributeDescriptor("cellpadding", false,
187: null, true);
188: prop_cellpadding.setValue(
189: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
190: attrib);
191: prop_cellpadding
192: .setValue(
193: Constants.PropertyDescriptor.CATEGORY,
194: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
195:
196: PropertyDescriptor prop_cellspacing = new PropertyDescriptorBase(
197: "cellspacing", beanClass, "getCellspacing",
198: "setCellspacing");
199: prop_cellspacing
200: .setDisplayName(resources
201: .getString("HtmlDataTable_cellspacing_DisplayName"));
202: prop_cellspacing
203: .setShortDescription(resources
204: .getString("HtmlDataTable_cellspacing_Description"));
205: prop_cellspacing
206: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
207: prop_cellspacing.setExpert(false);
208: prop_cellspacing.setHidden(false);
209: prop_cellspacing.setPreferred(false);
210: attrib = new AttributeDescriptor("cellspacing", false,
211: null, true);
212: prop_cellspacing.setValue(
213: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
214: attrib);
215: prop_cellspacing
216: .setValue(
217: Constants.PropertyDescriptor.CATEGORY,
218: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
219:
220: PropertyDescriptor prop_columnClasses = new PropertyDescriptorBase(
221: "columnClasses", beanClass, "getColumnClasses",
222: "setColumnClasses");
223: prop_columnClasses
224: .setDisplayName(resources
225: .getString("HtmlDataTable_columnClasses_DisplayName"));
226: prop_columnClasses
227: .setShortDescription(resources
228: .getString("HtmlDataTable_columnClasses_Description"));
229: prop_columnClasses
230: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
231: prop_columnClasses.setExpert(false);
232: prop_columnClasses.setHidden(false);
233: prop_columnClasses.setPreferred(false);
234: attrib = new AttributeDescriptor("columnClasses", false,
235: null, true);
236: prop_columnClasses.setValue(
237: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
238: attrib);
239: prop_columnClasses
240: .setValue(
241: Constants.PropertyDescriptor.CATEGORY,
242: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
243:
244: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
245: "dir", beanClass, "getDir", "setDir");
246: prop_dir.setDisplayName(resources
247: .getString("HtmlDataTable_dir_DisplayName"));
248: prop_dir.setShortDescription(resources
249: .getString("HtmlDataTable_dir_Description"));
250: prop_dir
251: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
252: prop_dir.setExpert(false);
253: prop_dir.setHidden(false);
254: prop_dir.setPreferred(false);
255: attrib = new AttributeDescriptor("dir", false, null, true);
256: prop_dir.setValue(
257: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
258: attrib);
259: prop_dir
260: .setValue(
261: Constants.PropertyDescriptor.CATEGORY,
262: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
263: prop_dir
264: .setValue(
265: com.sun.rave.propertyeditors.DomainPropertyEditor.DOMAIN_CLASS,
266: com.sun.rave.propertyeditors.domains.TextDirectionDomain.class);
267:
268: PropertyDescriptor prop_footerClass = new PropertyDescriptorBase(
269: "footerClass", beanClass, "getFooterClass",
270: "setFooterClass");
271: prop_footerClass
272: .setDisplayName(resources
273: .getString("HtmlDataTable_footerClass_DisplayName"));
274: prop_footerClass
275: .setShortDescription(resources
276: .getString("HtmlDataTable_footerClass_Description"));
277: prop_footerClass
278: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
279: prop_footerClass.setExpert(false);
280: prop_footerClass.setHidden(false);
281: prop_footerClass.setPreferred(false);
282: attrib = new AttributeDescriptor("footerClass", false,
283: null, true);
284: prop_footerClass.setValue(
285: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
286: attrib);
287: prop_footerClass
288: .setValue(
289: Constants.PropertyDescriptor.CATEGORY,
290: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
291:
292: PropertyDescriptor prop_frame = new PropertyDescriptorBase(
293: "frame", beanClass, "getFrame", "setFrame");
294: prop_frame.setDisplayName(resources
295: .getString("HtmlDataTable_frame_DisplayName"));
296: prop_frame.setShortDescription(resources
297: .getString("HtmlDataTable_frame_Description"));
298: prop_frame
299: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
300: prop_frame.setExpert(false);
301: prop_frame.setHidden(false);
302: prop_frame.setPreferred(false);
303: attrib = new AttributeDescriptor("frame", false, null, true);
304: prop_frame.setValue(
305: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
306: attrib);
307: prop_frame
308: .setValue(
309: Constants.PropertyDescriptor.CATEGORY,
310: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
311: prop_frame
312: .setValue(
313: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
314: com.sun.rave.propertyeditors.domains.HtmlTableBordersDomain.class);
315:
316: PropertyDescriptor prop_headerClass = new PropertyDescriptorBase(
317: "headerClass", beanClass, "getHeaderClass",
318: "setHeaderClass");
319: prop_headerClass
320: .setDisplayName(resources
321: .getString("HtmlDataTable_headerClass_DisplayName"));
322: prop_headerClass
323: .setShortDescription(resources
324: .getString("HtmlDataTable_headerClass_Description"));
325: prop_headerClass
326: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
327: prop_headerClass.setExpert(false);
328: prop_headerClass.setHidden(false);
329: prop_headerClass.setPreferred(false);
330: attrib = new AttributeDescriptor("headerClass", false,
331: null, true);
332: prop_headerClass.setValue(
333: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
334: attrib);
335: prop_headerClass
336: .setValue(
337: Constants.PropertyDescriptor.CATEGORY,
338: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
339:
340: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
341: "lang", beanClass, "getLang", "setLang");
342: prop_lang.setDisplayName(resources
343: .getString("HtmlDataTable_lang_DisplayName"));
344: prop_lang.setShortDescription(resources
345: .getString("HtmlDataTable_lang_Description"));
346: prop_lang
347: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
348: prop_lang.setExpert(false);
349: prop_lang.setHidden(false);
350: prop_lang.setPreferred(false);
351: attrib = new AttributeDescriptor("lang", false, null, true);
352: prop_lang.setValue(
353: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
354: attrib);
355: prop_lang
356: .setValue(
357: Constants.PropertyDescriptor.CATEGORY,
358: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
359: prop_lang
360: .setValue(
361: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
362: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
363:
364: PropertyDescriptor prop_rowClasses = new PropertyDescriptorBase(
365: "rowClasses", beanClass, "getRowClasses",
366: "setRowClasses");
367: prop_rowClasses.setDisplayName(resources
368: .getString("HtmlDataTable_rowClasses_DisplayName"));
369: prop_rowClasses.setShortDescription(resources
370: .getString("HtmlDataTable_rowClasses_Description"));
371: prop_rowClasses
372: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
373: prop_rowClasses.setExpert(false);
374: prop_rowClasses.setHidden(false);
375: prop_rowClasses.setPreferred(false);
376: attrib = new AttributeDescriptor("rowClasses", false, null,
377: true);
378: prop_rowClasses.setValue(
379: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
380: attrib);
381: prop_rowClasses
382: .setValue(
383: Constants.PropertyDescriptor.CATEGORY,
384: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
385:
386: PropertyDescriptor prop_rules = new PropertyDescriptorBase(
387: "rules", beanClass, "getRules", "setRules");
388: prop_rules.setDisplayName(resources
389: .getString("HtmlDataTable_rules_DisplayName"));
390: prop_rules.setShortDescription(resources
391: .getString("HtmlDataTable_rules_Description"));
392: prop_rules
393: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
394: prop_rules.setExpert(false);
395: prop_rules.setHidden(false);
396: prop_rules.setPreferred(false);
397: attrib = new AttributeDescriptor("rules", false, null, true);
398: prop_rules.setValue(
399: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
400: attrib);
401: prop_rules
402: .setValue(
403: Constants.PropertyDescriptor.CATEGORY,
404: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
405: prop_rules
406: .setValue(
407: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
408: com.sun.rave.propertyeditors.domains.HtmlTableRulesDomain.class);
409:
410: PropertyDescriptor prop_summary = new PropertyDescriptorBase(
411: "summary", beanClass, "getSummary", "setSummary");
412: prop_summary.setDisplayName(resources
413: .getString("HtmlDataTable_summary_DisplayName"));
414: prop_summary.setShortDescription(resources
415: .getString("HtmlDataTable_summary_Description"));
416: prop_summary.setExpert(false);
417: prop_summary.setHidden(false);
418: prop_summary.setPreferred(false);
419: attrib = new AttributeDescriptor("summary", false, null,
420: true);
421: prop_summary.setValue(
422: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
423: attrib);
424: prop_summary
425: .setValue(
426: Constants.PropertyDescriptor.CATEGORY,
427: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
428:
429: PropertyDescriptor prop_width = new PropertyDescriptorBase(
430: "width", beanClass, "getWidth", "setWidth");
431: prop_width.setDisplayName(resources
432: .getString("HtmlDataTable_width_DisplayName"));
433: prop_width.setShortDescription(resources
434: .getString("HtmlDataTable_width_Description"));
435: prop_width
436: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
437: prop_width.setExpert(false);
438: prop_width.setHidden(false);
439: prop_width.setPreferred(false);
440: attrib = new AttributeDescriptor("width", false, null, true);
441: prop_width.setValue(
442: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
443: attrib);
444: prop_width
445: .setValue(
446: Constants.PropertyDescriptor.CATEGORY,
447: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
448:
449: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
450: propertyDescriptorList.add(prop_bgcolor);
451: propertyDescriptorList.add(prop_border);
452: propertyDescriptorList.add(prop_cellpadding);
453: propertyDescriptorList.add(prop_cellspacing);
454: propertyDescriptorList.add(prop_columnClasses);
455: propertyDescriptorList.add(prop_dir);
456: propertyDescriptorList.add(prop_footerClass);
457: propertyDescriptorList.add(prop_frame);
458: propertyDescriptorList.add(prop_headerClass);
459: propertyDescriptorList.add(prop_lang);
460: propertyDescriptorList.add(prop_rowClasses);
461: propertyDescriptorList.add(prop_rules);
462: propertyDescriptorList.add(prop_summary);
463: propertyDescriptorList.add(prop_width);
464:
465: propertyDescriptorList.addAll(Properties
466: .getVisualPropertyList(beanClass));
467: propertyDescriptorList.addAll(Properties
468: .getKeyEventPropertyList(beanClass));
469: propertyDescriptorList.addAll(Properties
470: .getMouseEventPropertyList(beanClass));
471: propertyDescriptorList.addAll(Properties
472: .getClickEventPropertyList(beanClass));
473: propertyDescriptorList.addAll(Arrays.asList(super
474: .getPropertyDescriptors()));
475: propertyDescriptors = propertyDescriptorList
476: .toArray(new PropertyDescriptor[propertyDescriptorList
477: .size()]);
478: return propertyDescriptors;
479:
480: } catch (IntrospectionException e) {
481: e.printStackTrace();
482: return null;
483: }
484:
485: }
486:
487: }
|