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.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_2.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_2/component/html/HtmlSelectOneRadio_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectOneRadio_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectOneRadio_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/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_disabled = new PropertyDescriptorBase(
178: "disabled", beanClass, "isDisabled", "setDisabled");
179: prop_disabled
180: .setDisplayName(resources
181: .getString("HtmlSelectOneRadio_disabled_DisplayName"));
182: prop_disabled
183: .setShortDescription(resources
184: .getString("HtmlSelectOneRadio_disabled_Description"));
185: prop_disabled.setExpert(false);
186: prop_disabled.setHidden(false);
187: prop_disabled.setPreferred(false);
188: attrib = new AttributeDescriptor("disabled", false, null,
189: true);
190: prop_disabled.setValue(
191: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
192: attrib);
193: prop_disabled
194: .setValue(
195: Constants.PropertyDescriptor.CATEGORY,
196: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
197:
198: PropertyDescriptor prop_disabledClass = new PropertyDescriptorBase(
199: "disabledClass", beanClass, "getDisabledClass",
200: "setDisabledClass");
201: prop_disabledClass
202: .setDisplayName(resources
203: .getString("HtmlSelectOneRadio_disabledClass_DisplayName"));
204: prop_disabledClass
205: .setShortDescription(resources
206: .getString("HtmlSelectOneRadio_disabledClass_Description"));
207: prop_disabledClass
208: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
209: prop_disabledClass.setExpert(false);
210: prop_disabledClass.setHidden(false);
211: prop_disabledClass.setPreferred(false);
212: attrib = new AttributeDescriptor("disabledClass", false,
213: null, true);
214: prop_disabledClass.setValue(
215: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
216: attrib);
217: prop_disabledClass
218: .setValue(
219: Constants.PropertyDescriptor.CATEGORY,
220: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
221:
222: PropertyDescriptor prop_enabledClass = new PropertyDescriptorBase(
223: "enabledClass", beanClass, "getEnabledClass",
224: "setEnabledClass");
225: prop_enabledClass
226: .setDisplayName(resources
227: .getString("HtmlSelectOneRadio_enabledClass_DisplayName"));
228: prop_enabledClass
229: .setShortDescription(resources
230: .getString("HtmlSelectOneRadio_enabledClass_Description"));
231: prop_enabledClass
232: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
233: prop_enabledClass.setExpert(false);
234: prop_enabledClass.setHidden(false);
235: prop_enabledClass.setPreferred(false);
236: attrib = new AttributeDescriptor("enabledClass", false,
237: null, true);
238: prop_enabledClass.setValue(
239: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
240: attrib);
241: prop_enabledClass
242: .setValue(
243: Constants.PropertyDescriptor.CATEGORY,
244: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
245:
246: PropertyDescriptor prop_layout = new PropertyDescriptorBase(
247: "layout", beanClass, "getLayout", "setLayout");
248: prop_layout
249: .setDisplayName(resources
250: .getString("HtmlSelectOneRadio_layout_DisplayName"));
251: prop_layout
252: .setShortDescription(resources
253: .getString("HtmlSelectOneRadio_layout_Description"));
254: prop_layout
255: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
256: prop_layout.setExpert(false);
257: prop_layout.setHidden(false);
258: prop_layout.setPreferred(false);
259: attrib = new AttributeDescriptor("layout", false, null,
260: true);
261: prop_layout.setValue(
262: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
263: attrib);
264: prop_layout
265: .setValue(
266: Constants.PropertyDescriptor.CATEGORY,
267: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
268: prop_layout
269: .setValue(
270: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
271: org.netbeans.modules.visualweb.faces.dt_1_2.component.html.HtmlCheckboxLayoutStylesDomain.class);
272:
273: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
274: "readonly", beanClass, "isReadonly", "setReadonly");
275: prop_readonly
276: .setDisplayName(resources
277: .getString("HtmlSelectOneRadio_readonly_DisplayName"));
278: prop_readonly
279: .setShortDescription(resources
280: .getString("HtmlSelectOneRadio_readonly_Description"));
281: prop_readonly.setExpert(false);
282: prop_readonly.setHidden(false);
283: prop_readonly.setPreferred(false);
284: attrib = new AttributeDescriptor("readonly", false, null,
285: true);
286: prop_readonly.setValue(
287: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
288: attrib);
289: prop_readonly
290: .setValue(
291: Constants.PropertyDescriptor.CATEGORY,
292: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
293:
294: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
295: "tabindex", beanClass, "getTabindex", "setTabindex");
296: prop_tabindex
297: .setDisplayName(resources
298: .getString("HtmlSelectOneRadio_tabindex_DisplayName"));
299: prop_tabindex
300: .setShortDescription(resources
301: .getString("HtmlSelectOneRadio_tabindex_Description"));
302: prop_tabindex
303: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
304: prop_tabindex.setExpert(false);
305: prop_tabindex.setHidden(false);
306: prop_tabindex.setPreferred(false);
307: attrib = new AttributeDescriptor("tabindex", false, null,
308: true);
309: prop_tabindex.setValue(
310: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
311: attrib);
312: prop_tabindex
313: .setValue(
314: Constants.PropertyDescriptor.CATEGORY,
315: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
316: prop_tabindex.setValue("maxValue", new Integer(
317: Short.MAX_VALUE));
318: prop_tabindex.setValue("minValue", new Integer(0));
319:
320: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
321: propertyDescriptorList.add(prop_accesskey);
322: propertyDescriptorList.add(prop_border);
323: propertyDescriptorList.add(prop_disabled);
324: propertyDescriptorList.add(prop_disabledClass);
325: propertyDescriptorList.add(prop_enabledClass);
326: propertyDescriptorList.add(prop_layout);
327: propertyDescriptorList.add(prop_readonly);
328: propertyDescriptorList.add(prop_tabindex);
329:
330: propertyDescriptorList.addAll(Properties
331: .getVisualPropertyList(beanClass));
332: propertyDescriptorList.addAll(Properties
333: .getKeyEventPropertyList(beanClass));
334: propertyDescriptorList.addAll(Properties
335: .getMouseEventPropertyList(beanClass));
336: propertyDescriptorList.addAll(Properties
337: .getClickEventPropertyList(beanClass));
338: propertyDescriptorList.addAll(Properties
339: .getFocusEventPropertyList(beanClass));
340: propertyDescriptorList.addAll(Properties
341: .getSelectEventPropertyList(beanClass));
342: propertyDescriptorList.addAll(Properties
343: .getChangeEventPropertyList(beanClass));
344: propertyDescriptorList.addAll(Properties
345: .getInputPropertyList(beanClass));
346: propertyDescriptorList.addAll(Arrays.asList(super
347: .getPropertyDescriptors()));
348: propertyDescriptors = propertyDescriptorList
349: .toArray(new PropertyDescriptor[propertyDescriptorList
350: .size()]);
351: return propertyDescriptors;
352:
353: } catch (IntrospectionException e) {
354: e.printStackTrace();
355: return null;
356: }
357:
358: }
359:
360: }
|