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.UIInputBeanInfoBase;
060:
061: public class HtmlSelectOneRadioBeanInfo extends UIInputBeanInfoBase {
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(),
067: HtmlSelectOneRadioBeanInfo.class.getClassLoader());
068:
069: public HtmlSelectOneRadioBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlSelectOneRadio.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneRadio_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneRadio_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneRadio_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneRadio_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("HtmlSelectOneRadio_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlSelectOneRadio_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_radiobutton_list");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "radioButtonList");
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_radiobutton_list_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "selectOneRadio");
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_accesskey = new PropertyDescriptorBase(
131: "accesskey", beanClass, "getAccesskey",
132: "setAccesskey");
133: prop_accesskey
134: .setDisplayName(resources
135: .getString("HtmlSelectOneRadio_accesskey_DisplayName"));
136: prop_accesskey
137: .setShortDescription(resources
138: .getString("HtmlSelectOneRadio_accesskey_Description"));
139: prop_accesskey.setExpert(false);
140: prop_accesskey.setHidden(false);
141: prop_accesskey.setPreferred(false);
142: attrib = new AttributeDescriptor("accesskey", false, null,
143: true);
144: prop_accesskey.setValue(
145: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
146: attrib);
147: prop_accesskey
148: .setValue(
149: Constants.PropertyDescriptor.CATEGORY,
150: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
151:
152: PropertyDescriptor prop_border = new PropertyDescriptorBase(
153: "border", beanClass, "getBorder", "setBorder");
154: prop_border
155: .setDisplayName(resources
156: .getString("HtmlSelectOneRadio_border_DisplayName"));
157: prop_border
158: .setShortDescription(resources
159: .getString("HtmlSelectOneRadio_border_Description"));
160: prop_border
161: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
162: prop_border.setExpert(false);
163: prop_border.setHidden(false);
164: prop_border.setPreferred(false);
165: attrib = new AttributeDescriptor("border", false, null,
166: true);
167: prop_border.setValue(
168: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
169: attrib);
170: prop_border
171: .setValue(
172: Constants.PropertyDescriptor.CATEGORY,
173: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
174: prop_border.setValue(
175: "com.sun.rave.propertyeditors.MIN_VALUE", "0");
176:
177: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
178: "dir", beanClass, "getDir", "setDir");
179: prop_dir.setDisplayName(resources
180: .getString("HtmlSelectOneRadio_dir_DisplayName"));
181: prop_dir.setShortDescription(resources
182: .getString("HtmlSelectOneRadio_dir_Description"));
183: prop_dir
184: .setPropertyEditorClass(SelectOneDomainEditor.class);
185: prop_dir.setExpert(false);
186: prop_dir.setHidden(false);
187: prop_dir.setPreferred(false);
188: attrib = new AttributeDescriptor("dir", false, null, true);
189: prop_dir.setValue(
190: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
191: attrib);
192: prop_dir
193: .setValue(
194: Constants.PropertyDescriptor.CATEGORY,
195: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
196: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
197: TextDirectionDomain.class);
198:
199: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
200: "disabled", beanClass, "isDisabled", "setDisabled");
201: prop_disabled
202: .setDisplayName(resources
203: .getString("HtmlSelectOneRadio_disabled_DisplayName"));
204: prop_disabled
205: .setShortDescription(resources
206: .getString("HtmlSelectOneRadio_disabled_Description"));
207: prop_disabled.setExpert(false);
208: prop_disabled.setHidden(false);
209: prop_disabled.setPreferred(false);
210: attrib = new AttributeDescriptor("disabled", false, null,
211: true);
212: prop_disabled.setValue(
213: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
214: attrib);
215: prop_disabled
216: .setValue(
217: Constants.PropertyDescriptor.CATEGORY,
218: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
219:
220: PropertyDescriptor prop_disabledClass = new PropertyDescriptorBase(
221: "disabledClass", beanClass, "getDisabledClass",
222: "setDisabledClass");
223: prop_disabledClass
224: .setDisplayName(resources
225: .getString("HtmlSelectOneRadio_disabledClass_DisplayName"));
226: prop_disabledClass
227: .setShortDescription(resources
228: .getString("HtmlSelectOneRadio_disabledClass_Description"));
229: prop_disabledClass
230: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
231: prop_disabledClass.setExpert(false);
232: prop_disabledClass.setHidden(false);
233: prop_disabledClass.setPreferred(false);
234: attrib = new AttributeDescriptor("disabledClass", false,
235: null, true);
236: prop_disabledClass.setValue(
237: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
238: attrib);
239: prop_disabledClass
240: .setValue(
241: Constants.PropertyDescriptor.CATEGORY,
242: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
243:
244: PropertyDescriptor prop_enabledClass = new PropertyDescriptorBase(
245: "enabledClass", beanClass, "getEnabledClass",
246: "setEnabledClass");
247: prop_enabledClass
248: .setDisplayName(resources
249: .getString("HtmlSelectOneRadio_enabledClass_DisplayName"));
250: prop_enabledClass
251: .setShortDescription(resources
252: .getString("HtmlSelectOneRadio_enabledClass_Description"));
253: prop_enabledClass
254: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
255: prop_enabledClass.setExpert(false);
256: prop_enabledClass.setHidden(false);
257: prop_enabledClass.setPreferred(false);
258: attrib = new AttributeDescriptor("enabledClass", false,
259: null, true);
260: prop_enabledClass.setValue(
261: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
262: attrib);
263: prop_enabledClass
264: .setValue(
265: Constants.PropertyDescriptor.CATEGORY,
266: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
267:
268: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
269: "lang", beanClass, "getLang", "setLang");
270: prop_lang.setDisplayName(resources
271: .getString("HtmlSelectOneRadio_lang_DisplayName"));
272: prop_lang.setShortDescription(resources
273: .getString("HtmlSelectOneRadio_lang_Description"));
274: prop_lang
275: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
276: prop_lang.setExpert(false);
277: prop_lang.setHidden(false);
278: prop_lang.setPreferred(false);
279: attrib = new AttributeDescriptor("lang", false, null, true);
280: prop_lang.setValue(
281: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
282: attrib);
283: prop_lang
284: .setValue(
285: Constants.PropertyDescriptor.CATEGORY,
286: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
287: prop_lang
288: .setValue(
289: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
290: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
291:
292: PropertyDescriptor prop_layout = new PropertyDescriptorBase(
293: "layout", beanClass, "getLayout", "setLayout");
294: prop_layout
295: .setDisplayName(resources
296: .getString("HtmlSelectOneRadio_layout_DisplayName"));
297: prop_layout
298: .setShortDescription(resources
299: .getString("HtmlSelectOneRadio_layout_Description"));
300: prop_layout
301: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
302: prop_layout.setExpert(false);
303: prop_layout.setHidden(false);
304: prop_layout.setPreferred(false);
305: attrib = new AttributeDescriptor("layout", false, null,
306: true);
307: prop_layout.setValue(
308: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
309: attrib);
310: prop_layout
311: .setValue(
312: Constants.PropertyDescriptor.CATEGORY,
313: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
314: prop_layout
315: .setValue(
316: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
317: org.netbeans.modules.visualweb.faces.dt_1_1.component.html.HtmlCheckboxLayoutStylesDomain.class);
318:
319: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
320: "readonly", beanClass, "isReadonly", "setReadonly");
321: prop_readonly
322: .setDisplayName(resources
323: .getString("HtmlSelectOneRadio_readonly_DisplayName"));
324: prop_readonly
325: .setShortDescription(resources
326: .getString("HtmlSelectOneRadio_readonly_Description"));
327: prop_readonly.setExpert(false);
328: prop_readonly.setHidden(false);
329: prop_readonly.setPreferred(false);
330: attrib = new AttributeDescriptor("readonly", false, null,
331: true);
332: prop_readonly.setValue(
333: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
334: attrib);
335: prop_readonly
336: .setValue(
337: Constants.PropertyDescriptor.CATEGORY,
338: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
339:
340: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
341: "tabindex", beanClass, "getTabindex", "setTabindex");
342: prop_tabindex
343: .setDisplayName(resources
344: .getString("HtmlSelectOneRadio_tabindex_DisplayName"));
345: prop_tabindex
346: .setShortDescription(resources
347: .getString("HtmlSelectOneRadio_tabindex_Description"));
348: prop_tabindex
349: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
350: prop_tabindex.setExpert(false);
351: prop_tabindex.setHidden(false);
352: prop_tabindex.setPreferred(false);
353: attrib = new AttributeDescriptor("tabindex", false, null,
354: true);
355: prop_tabindex.setValue(
356: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
357: attrib);
358: prop_tabindex
359: .setValue(
360: Constants.PropertyDescriptor.CATEGORY,
361: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
362: prop_tabindex.setValue("maxValue", new Integer(
363: Short.MAX_VALUE));
364: prop_tabindex.setValue("minValue", new Integer(0));
365:
366: PropertyDescriptor prop_title = new PropertyDescriptorBase(
367: "title", beanClass, "getTitle", "setTitle");
368: prop_title.setDisplayName(resources
369: .getString("HtmlSelectOneRadio_title_DisplayName"));
370: prop_title.setShortDescription(resources
371: .getString("HtmlSelectOneRadio_title_Description"));
372: prop_title.setExpert(false);
373: prop_title.setHidden(false);
374: prop_title.setPreferred(false);
375: attrib = new AttributeDescriptor("title", false, null, true);
376: prop_title.setValue(
377: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
378: attrib);
379: prop_title
380: .setValue(
381: Constants.PropertyDescriptor.CATEGORY,
382: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
383:
384: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
385: propertyDescriptorList.add(prop_accesskey);
386: propertyDescriptorList.add(prop_border);
387: propertyDescriptorList.add(prop_dir);
388: propertyDescriptorList.add(prop_disabled);
389: propertyDescriptorList.add(prop_disabledClass);
390: propertyDescriptorList.add(prop_enabledClass);
391: propertyDescriptorList.add(prop_lang);
392: propertyDescriptorList.add(prop_layout);
393: propertyDescriptorList.add(prop_readonly);
394: propertyDescriptorList.add(prop_tabindex);
395: propertyDescriptorList.add(prop_title);
396:
397: propertyDescriptorList.addAll(Properties
398: .getVisualPropertyList(beanClass));
399: propertyDescriptorList.addAll(Properties
400: .getKeyEventPropertyList(beanClass));
401: propertyDescriptorList.addAll(Properties
402: .getMouseEventPropertyList(beanClass));
403: propertyDescriptorList.addAll(Properties
404: .getClickEventPropertyList(beanClass));
405: propertyDescriptorList.addAll(Properties
406: .getFocusEventPropertyList(beanClass));
407: propertyDescriptorList.addAll(Properties
408: .getSelectEventPropertyList(beanClass));
409: propertyDescriptorList.addAll(Properties
410: .getChangeEventPropertyList(beanClass));
411: propertyDescriptorList.addAll(Arrays.asList(super
412: .getPropertyDescriptors()));
413: propertyDescriptors = propertyDescriptorList
414: .toArray(new PropertyDescriptor[propertyDescriptorList
415: .size()]);
416: return propertyDescriptors;
417:
418: } catch (IntrospectionException e) {
419: e.printStackTrace();
420: return null;
421: }
422:
423: }
424:
425: }
|