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 HtmlSelectBooleanCheckboxBeanInfo extends
062: UIInputBeanInfoBase {
063:
064: protected static ResourceBundle resources = ResourceBundle
065: .getBundle(
066: "org.netbeans.modules.visualweb.faces.dt_1_1.component.html.Bundle-JSF",
067: Locale.getDefault(),
068: HtmlSelectBooleanCheckboxBeanInfo.class
069: .getClassLoader());
070:
071: public HtmlSelectBooleanCheckboxBeanInfo() {
072: beanClass = javax.faces.component.html.HtmlSelectBooleanCheckbox.class;
073: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectBooleanCheckbox_C16";
074: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectBooleanCheckbox_C32";
075: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectBooleanCheckbox_M16";
076: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectBooleanCheckbox_M32";
077: }
078:
079: private BeanDescriptor beanDescriptor;
080:
081: public BeanDescriptor getBeanDescriptor() {
082:
083: if (beanDescriptor != null) {
084: return beanDescriptor;
085: }
086:
087: beanDescriptor = new BeanDescriptorBase(beanClass);
088: beanDescriptor.setDisplayName(resources
089: .getString("HtmlSelectBooleanCheckbox_DisplayName"));
090: beanDescriptor.setShortDescription(resources
091: .getString("HtmlSelectBooleanCheckbox_Description"));
092: beanDescriptor.setExpert(false);
093: beanDescriptor.setHidden(false);
094: beanDescriptor.setPreferred(false);
095: beanDescriptor.setValue(
096: Constants.BeanDescriptor.FACET_DESCRIPTORS,
097: getFacetDescriptors());
098: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
099: "projrave_ui_elements_palette_jsfstd_checkbox");
100: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
101: "checkbox");
102: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
103: Boolean.FALSE);
104: beanDescriptor
105: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
106: "projrave_ui_elements_propsheets_jsfstd_checkbox_props");
107: beanDescriptor.setValue(
108: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
109: getCategoryDescriptors());
110: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
111: "selectBooleanCheckbox");
112: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
113: "h");
114: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
115: "http://java.sun.com/jsf/html");
116:
117: return beanDescriptor;
118:
119: }
120:
121: private PropertyDescriptor[] propertyDescriptors;
122:
123: public PropertyDescriptor[] getPropertyDescriptors() {
124:
125: if (propertyDescriptors != null) {
126: return propertyDescriptors;
127: }
128: AttributeDescriptor attrib = null;
129:
130: try {
131:
132: PropertyDescriptor prop_accesskey = new PropertyDescriptorBase(
133: "accesskey", beanClass, "getAccesskey",
134: "setAccesskey");
135: prop_accesskey
136: .setDisplayName(resources
137: .getString("HtmlSelectBooleanCheckbox_accesskey_DisplayName"));
138: prop_accesskey
139: .setShortDescription(resources
140: .getString("HtmlSelectBooleanCheckbox_accesskey_Description"));
141: prop_accesskey.setExpert(false);
142: prop_accesskey.setHidden(false);
143: prop_accesskey.setPreferred(false);
144: attrib = new AttributeDescriptor("accesskey", false, null,
145: true);
146: prop_accesskey.setValue(
147: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
148: attrib);
149: prop_accesskey
150: .setValue(
151: Constants.PropertyDescriptor.CATEGORY,
152: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
153:
154: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
155: "dir", beanClass, "getDir", "setDir");
156: prop_dir
157: .setDisplayName(resources
158: .getString("HtmlSelectBooleanCheckbox_dir_DisplayName"));
159: prop_dir
160: .setShortDescription(resources
161: .getString("HtmlSelectBooleanCheckbox_dir_Description"));
162: prop_dir
163: .setPropertyEditorClass(SelectOneDomainEditor.class);
164: prop_dir.setExpert(false);
165: prop_dir.setHidden(false);
166: prop_dir.setPreferred(false);
167: attrib = new AttributeDescriptor("dir", false, null, true);
168: prop_dir.setValue(
169: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
170: attrib);
171: prop_dir
172: .setValue(
173: Constants.PropertyDescriptor.CATEGORY,
174: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
175: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
176: TextDirectionDomain.class);
177:
178: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
179: "disabled", beanClass, "isDisabled", "setDisabled");
180: prop_disabled
181: .setDisplayName(resources
182: .getString("HtmlSelectBooleanCheckbox_disabled_DisplayName"));
183: prop_disabled
184: .setShortDescription(resources
185: .getString("HtmlSelectBooleanCheckbox_disabled_Description"));
186: prop_disabled.setExpert(false);
187: prop_disabled.setHidden(false);
188: prop_disabled.setPreferred(false);
189: attrib = new AttributeDescriptor("disabled", false, null,
190: true);
191: prop_disabled.setValue(
192: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
193: attrib);
194: prop_disabled
195: .setValue(
196: Constants.PropertyDescriptor.CATEGORY,
197: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
198:
199: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
200: "lang", beanClass, "getLang", "setLang");
201: prop_lang
202: .setDisplayName(resources
203: .getString("HtmlSelectBooleanCheckbox_lang_DisplayName"));
204: prop_lang
205: .setShortDescription(resources
206: .getString("HtmlSelectBooleanCheckbox_lang_Description"));
207: prop_lang
208: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
209: prop_lang.setExpert(false);
210: prop_lang.setHidden(false);
211: prop_lang.setPreferred(false);
212: attrib = new AttributeDescriptor("lang", false, null, true);
213: prop_lang.setValue(
214: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
215: attrib);
216: prop_lang
217: .setValue(
218: Constants.PropertyDescriptor.CATEGORY,
219: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
220: prop_lang
221: .setValue(
222: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
223: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
224:
225: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
226: "readonly", beanClass, "isReadonly", "setReadonly");
227: prop_readonly
228: .setDisplayName(resources
229: .getString("HtmlSelectBooleanCheckbox_readonly_DisplayName"));
230: prop_readonly
231: .setShortDescription(resources
232: .getString("HtmlSelectBooleanCheckbox_readonly_Description"));
233: prop_readonly.setExpert(false);
234: prop_readonly.setHidden(false);
235: prop_readonly.setPreferred(false);
236: attrib = new AttributeDescriptor("readonly", false, null,
237: true);
238: prop_readonly.setValue(
239: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
240: attrib);
241: prop_readonly
242: .setValue(
243: Constants.PropertyDescriptor.CATEGORY,
244: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
245:
246: PropertyDescriptor prop_selected = new PropertyDescriptorBase(
247: "selected", beanClass, "isSelected", null);
248: prop_selected
249: .setDisplayName(resources
250: .getString("HtmlSelectBooleanCheckbox_selected_DisplayName"));
251: prop_selected
252: .setShortDescription(resources
253: .getString("HtmlSelectBooleanCheckbox_selected_Description"));
254: prop_selected.setExpert(false);
255: prop_selected.setHidden(false);
256: prop_selected.setPreferred(false);
257: prop_selected
258: .setValue(
259: Constants.PropertyDescriptor.CATEGORY,
260: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
261:
262: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
263: "tabindex", beanClass, "getTabindex", "setTabindex");
264: prop_tabindex
265: .setDisplayName(resources
266: .getString("HtmlSelectBooleanCheckbox_tabindex_DisplayName"));
267: prop_tabindex
268: .setShortDescription(resources
269: .getString("HtmlSelectBooleanCheckbox_tabindex_Description"));
270: prop_tabindex
271: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
272: prop_tabindex.setExpert(false);
273: prop_tabindex.setHidden(false);
274: prop_tabindex.setPreferred(false);
275: attrib = new AttributeDescriptor("tabindex", false, null,
276: true);
277: prop_tabindex.setValue(
278: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
279: attrib);
280: prop_tabindex
281: .setValue(
282: Constants.PropertyDescriptor.CATEGORY,
283: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
284: prop_tabindex.setValue("maxValue", new Integer(
285: Short.MAX_VALUE));
286: prop_tabindex.setValue("minValue", new Integer(0));
287:
288: PropertyDescriptor prop_title = new PropertyDescriptorBase(
289: "title", beanClass, "getTitle", "setTitle");
290: prop_title
291: .setDisplayName(resources
292: .getString("HtmlSelectBooleanCheckbox_title_DisplayName"));
293: prop_title
294: .setShortDescription(resources
295: .getString("HtmlSelectBooleanCheckbox_title_Description"));
296: prop_title.setExpert(false);
297: prop_title.setHidden(false);
298: prop_title.setPreferred(false);
299: attrib = new AttributeDescriptor("title", false, null, true);
300: prop_title.setValue(
301: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
302: attrib);
303: prop_title
304: .setValue(
305: Constants.PropertyDescriptor.CATEGORY,
306: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
307:
308: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
309: propertyDescriptorList.add(prop_accesskey);
310: propertyDescriptorList.add(prop_dir);
311: propertyDescriptorList.add(prop_disabled);
312: propertyDescriptorList.add(prop_lang);
313: propertyDescriptorList.add(prop_readonly);
314: propertyDescriptorList.add(prop_selected);
315: propertyDescriptorList.add(prop_tabindex);
316: propertyDescriptorList.add(prop_title);
317:
318: propertyDescriptorList.addAll(Properties
319: .getVisualPropertyList(beanClass));
320: propertyDescriptorList.addAll(Properties
321: .getKeyEventPropertyList(beanClass));
322: propertyDescriptorList.addAll(Properties
323: .getMouseEventPropertyList(beanClass));
324: propertyDescriptorList.addAll(Properties
325: .getClickEventPropertyList(beanClass));
326: propertyDescriptorList.addAll(Properties
327: .getFocusEventPropertyList(beanClass));
328: propertyDescriptorList.addAll(Properties
329: .getSelectEventPropertyList(beanClass));
330: propertyDescriptorList.addAll(Properties
331: .getChangeEventPropertyList(beanClass));
332: propertyDescriptorList.addAll(Arrays.asList(super
333: .getPropertyDescriptors()));
334: propertyDescriptors = propertyDescriptorList
335: .toArray(new PropertyDescriptor[propertyDescriptorList
336: .size()]);
337: return propertyDescriptors;
338:
339: } catch (IntrospectionException e) {
340: e.printStackTrace();
341: return null;
342: }
343:
344: }
345:
346: }
|