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_1.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: import com.sun.rave.designtime.Constants;
053: import com.sun.rave.designtime.markup.AttributeDescriptor;
054: import com.sun.rave.propertyeditors.DomainPropertyEditor;
055: import com.sun.rave.propertyeditors.SelectOneDomainEditor;
056: import com.sun.rave.propertyeditors.domains.TextDirectionDomain;
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_1.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_1.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_1/component/html/HtmlDataTable_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlDataTable_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlDataTable_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/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(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.setValue(DomainPropertyEditor.DOMAIN_CLASS,
264: TextDirectionDomain.class);
265:
266: PropertyDescriptor prop_footerClass = new PropertyDescriptorBase(
267: "footerClass", beanClass, "getFooterClass",
268: "setFooterClass");
269: prop_footerClass
270: .setDisplayName(resources
271: .getString("HtmlDataTable_footerClass_DisplayName"));
272: prop_footerClass
273: .setShortDescription(resources
274: .getString("HtmlDataTable_footerClass_Description"));
275: prop_footerClass
276: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
277: prop_footerClass.setExpert(false);
278: prop_footerClass.setHidden(false);
279: prop_footerClass.setPreferred(false);
280: attrib = new AttributeDescriptor("footerClass", false,
281: null, true);
282: prop_footerClass.setValue(
283: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
284: attrib);
285: prop_footerClass
286: .setValue(
287: Constants.PropertyDescriptor.CATEGORY,
288: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
289:
290: PropertyDescriptor prop_frame = new PropertyDescriptorBase(
291: "frame", beanClass, "getFrame", "setFrame");
292: prop_frame.setDisplayName(resources
293: .getString("HtmlDataTable_frame_DisplayName"));
294: prop_frame.setShortDescription(resources
295: .getString("HtmlDataTable_frame_Description"));
296: prop_frame
297: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
298: prop_frame.setExpert(false);
299: prop_frame.setHidden(false);
300: prop_frame.setPreferred(false);
301: attrib = new AttributeDescriptor("frame", false, null, true);
302: prop_frame.setValue(
303: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
304: attrib);
305: prop_frame
306: .setValue(
307: Constants.PropertyDescriptor.CATEGORY,
308: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
309: prop_frame
310: .setValue(
311: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
312: com.sun.rave.propertyeditors.domains.HtmlTableBordersDomain.class);
313:
314: PropertyDescriptor prop_headerClass = new PropertyDescriptorBase(
315: "headerClass", beanClass, "getHeaderClass",
316: "setHeaderClass");
317: prop_headerClass
318: .setDisplayName(resources
319: .getString("HtmlDataTable_headerClass_DisplayName"));
320: prop_headerClass
321: .setShortDescription(resources
322: .getString("HtmlDataTable_headerClass_Description"));
323: prop_headerClass
324: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
325: prop_headerClass.setExpert(false);
326: prop_headerClass.setHidden(false);
327: prop_headerClass.setPreferred(false);
328: attrib = new AttributeDescriptor("headerClass", false,
329: null, true);
330: prop_headerClass.setValue(
331: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
332: attrib);
333: prop_headerClass
334: .setValue(
335: Constants.PropertyDescriptor.CATEGORY,
336: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
337:
338: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
339: "lang", beanClass, "getLang", "setLang");
340: prop_lang.setDisplayName(resources
341: .getString("HtmlDataTable_lang_DisplayName"));
342: prop_lang.setShortDescription(resources
343: .getString("HtmlDataTable_lang_Description"));
344: prop_lang
345: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
346: prop_lang.setExpert(false);
347: prop_lang.setHidden(false);
348: prop_lang.setPreferred(false);
349: attrib = new AttributeDescriptor("lang", false, null, true);
350: prop_lang.setValue(
351: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
352: attrib);
353: prop_lang
354: .setValue(
355: Constants.PropertyDescriptor.CATEGORY,
356: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
357: prop_lang
358: .setValue(
359: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
360: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
361:
362: PropertyDescriptor prop_rowClasses = new PropertyDescriptorBase(
363: "rowClasses", beanClass, "getRowClasses",
364: "setRowClasses");
365: prop_rowClasses.setDisplayName(resources
366: .getString("HtmlDataTable_rowClasses_DisplayName"));
367: prop_rowClasses.setShortDescription(resources
368: .getString("HtmlDataTable_rowClasses_Description"));
369: prop_rowClasses
370: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
371: prop_rowClasses.setExpert(false);
372: prop_rowClasses.setHidden(false);
373: prop_rowClasses.setPreferred(false);
374: attrib = new AttributeDescriptor("rowClasses", false, null,
375: true);
376: prop_rowClasses.setValue(
377: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
378: attrib);
379: prop_rowClasses
380: .setValue(
381: Constants.PropertyDescriptor.CATEGORY,
382: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
383:
384: PropertyDescriptor prop_rules = new PropertyDescriptorBase(
385: "rules", beanClass, "getRules", "setRules");
386: prop_rules.setDisplayName(resources
387: .getString("HtmlDataTable_rules_DisplayName"));
388: prop_rules.setShortDescription(resources
389: .getString("HtmlDataTable_rules_Description"));
390: prop_rules
391: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
392: prop_rules.setExpert(false);
393: prop_rules.setHidden(false);
394: prop_rules.setPreferred(false);
395: attrib = new AttributeDescriptor("rules", false, null, true);
396: prop_rules.setValue(
397: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
398: attrib);
399: prop_rules
400: .setValue(
401: Constants.PropertyDescriptor.CATEGORY,
402: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
403: prop_rules
404: .setValue(
405: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
406: com.sun.rave.propertyeditors.domains.HtmlTableRulesDomain.class);
407:
408: PropertyDescriptor prop_summary = new PropertyDescriptorBase(
409: "summary", beanClass, "getSummary", "setSummary");
410: prop_summary.setDisplayName(resources
411: .getString("HtmlDataTable_summary_DisplayName"));
412: prop_summary.setShortDescription(resources
413: .getString("HtmlDataTable_summary_Description"));
414: prop_summary.setExpert(false);
415: prop_summary.setHidden(false);
416: prop_summary.setPreferred(false);
417: attrib = new AttributeDescriptor("summary", false, null,
418: true);
419: prop_summary.setValue(
420: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
421: attrib);
422: prop_summary
423: .setValue(
424: Constants.PropertyDescriptor.CATEGORY,
425: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
426:
427: PropertyDescriptor prop_title = new PropertyDescriptorBase(
428: "title", beanClass, "getTitle", "setTitle");
429: prop_title.setDisplayName(resources
430: .getString("HtmlDataTable_title_DisplayName"));
431: prop_title.setShortDescription(resources
432: .getString("HtmlDataTable_title_Description"));
433: prop_title.setExpert(false);
434: prop_title.setHidden(false);
435: prop_title.setPreferred(false);
436: attrib = new AttributeDescriptor("title", false, null, true);
437: prop_title.setValue(
438: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
439: attrib);
440: prop_title
441: .setValue(
442: Constants.PropertyDescriptor.CATEGORY,
443: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
444:
445: PropertyDescriptor prop_width = new PropertyDescriptorBase(
446: "width", beanClass, "getWidth", "setWidth");
447: prop_width.setDisplayName(resources
448: .getString("HtmlDataTable_width_DisplayName"));
449: prop_width.setShortDescription(resources
450: .getString("HtmlDataTable_width_Description"));
451: prop_width
452: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
453: prop_width.setExpert(false);
454: prop_width.setHidden(false);
455: prop_width.setPreferred(false);
456: attrib = new AttributeDescriptor("width", false, null, true);
457: prop_width.setValue(
458: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
459: attrib);
460: prop_width
461: .setValue(
462: Constants.PropertyDescriptor.CATEGORY,
463: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
464:
465: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
466: propertyDescriptorList.add(prop_bgcolor);
467: propertyDescriptorList.add(prop_border);
468: propertyDescriptorList.add(prop_cellpadding);
469: propertyDescriptorList.add(prop_cellspacing);
470: propertyDescriptorList.add(prop_columnClasses);
471: propertyDescriptorList.add(prop_dir);
472: propertyDescriptorList.add(prop_footerClass);
473: propertyDescriptorList.add(prop_frame);
474: propertyDescriptorList.add(prop_headerClass);
475: propertyDescriptorList.add(prop_lang);
476: propertyDescriptorList.add(prop_rowClasses);
477: propertyDescriptorList.add(prop_rules);
478: propertyDescriptorList.add(prop_summary);
479: propertyDescriptorList.add(prop_title);
480: propertyDescriptorList.add(prop_width);
481:
482: propertyDescriptorList.addAll(Properties
483: .getVisualPropertyList(beanClass));
484: propertyDescriptorList.addAll(Properties
485: .getKeyEventPropertyList(beanClass));
486: propertyDescriptorList.addAll(Properties
487: .getMouseEventPropertyList(beanClass));
488: propertyDescriptorList.addAll(Properties
489: .getClickEventPropertyList(beanClass));
490: propertyDescriptorList.addAll(Arrays.asList(super
491: .getPropertyDescriptors()));
492: propertyDescriptors = propertyDescriptorList
493: .toArray(new PropertyDescriptor[propertyDescriptorList
494: .size()]);
495: return propertyDescriptors;
496:
497: } catch (IntrospectionException e) {
498: e.printStackTrace();
499: return null;
500: }
501:
502: }
503:
504: }
|