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 HtmlSelectBooleanCheckboxBeanInfo extends
062: UIInputBeanInfoBase {
063:
064: protected static ResourceBundle resources = ResourceBundle
065: .getBundle(
066: "org.netbeans.modules.visualweb.faces.dt_1_2.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_2/component/html/HtmlSelectBooleanCheckbox_C16";
074: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectBooleanCheckbox_C32";
075: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectBooleanCheckbox_M16";
076: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/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_disabled = new PropertyDescriptorBase(
155: "disabled", beanClass, "isDisabled", "setDisabled");
156: prop_disabled
157: .setDisplayName(resources
158: .getString("HtmlSelectBooleanCheckbox_disabled_DisplayName"));
159: prop_disabled
160: .setShortDescription(resources
161: .getString("HtmlSelectBooleanCheckbox_disabled_Description"));
162: prop_disabled.setExpert(false);
163: prop_disabled.setHidden(false);
164: prop_disabled.setPreferred(false);
165: attrib = new AttributeDescriptor("disabled", false, null,
166: true);
167: prop_disabled.setValue(
168: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
169: attrib);
170: prop_disabled
171: .setValue(
172: Constants.PropertyDescriptor.CATEGORY,
173: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
174:
175: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
176: "readonly", beanClass, "isReadonly", "setReadonly");
177: prop_readonly
178: .setDisplayName(resources
179: .getString("HtmlSelectBooleanCheckbox_readonly_DisplayName"));
180: prop_readonly
181: .setShortDescription(resources
182: .getString("HtmlSelectBooleanCheckbox_readonly_Description"));
183: prop_readonly.setExpert(false);
184: prop_readonly.setHidden(false);
185: prop_readonly.setPreferred(false);
186: attrib = new AttributeDescriptor("readonly", false, null,
187: true);
188: prop_readonly.setValue(
189: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
190: attrib);
191: prop_readonly
192: .setValue(
193: Constants.PropertyDescriptor.CATEGORY,
194: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
195:
196: PropertyDescriptor prop_selected = new PropertyDescriptorBase(
197: "selected", beanClass, "isSelected", null);
198: prop_selected
199: .setDisplayName(resources
200: .getString("HtmlSelectBooleanCheckbox_selected_DisplayName"));
201: prop_selected
202: .setShortDescription(resources
203: .getString("HtmlSelectBooleanCheckbox_selected_Description"));
204: prop_selected.setExpert(false);
205: prop_selected.setHidden(false);
206: prop_selected.setPreferred(false);
207: prop_selected
208: .setValue(
209: Constants.PropertyDescriptor.CATEGORY,
210: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
211:
212: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
213: "tabindex", beanClass, "getTabindex", "setTabindex");
214: prop_tabindex
215: .setDisplayName(resources
216: .getString("HtmlSelectBooleanCheckbox_tabindex_DisplayName"));
217: prop_tabindex
218: .setShortDescription(resources
219: .getString("HtmlSelectBooleanCheckbox_tabindex_Description"));
220: prop_tabindex
221: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
222: prop_tabindex.setExpert(false);
223: prop_tabindex.setHidden(false);
224: prop_tabindex.setPreferred(false);
225: attrib = new AttributeDescriptor("tabindex", false, null,
226: true);
227: prop_tabindex.setValue(
228: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
229: attrib);
230: prop_tabindex
231: .setValue(
232: Constants.PropertyDescriptor.CATEGORY,
233: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
234: prop_tabindex.setValue("maxValue", new Integer(
235: Short.MAX_VALUE));
236: prop_tabindex.setValue("minValue", new Integer(0));
237:
238: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
239: propertyDescriptorList.add(prop_accesskey);
240: propertyDescriptorList.add(prop_disabled);
241: propertyDescriptorList.add(prop_readonly);
242: propertyDescriptorList.add(prop_selected);
243: propertyDescriptorList.add(prop_tabindex);
244:
245: propertyDescriptorList.addAll(Properties
246: .getVisualPropertyList(beanClass));
247: propertyDescriptorList.addAll(Properties
248: .getKeyEventPropertyList(beanClass));
249: propertyDescriptorList.addAll(Properties
250: .getMouseEventPropertyList(beanClass));
251: propertyDescriptorList.addAll(Properties
252: .getClickEventPropertyList(beanClass));
253: propertyDescriptorList.addAll(Properties
254: .getFocusEventPropertyList(beanClass));
255: propertyDescriptorList.addAll(Properties
256: .getSelectEventPropertyList(beanClass));
257: propertyDescriptorList.addAll(Properties
258: .getChangeEventPropertyList(beanClass));
259: propertyDescriptorList.addAll(Properties
260: .getInputPropertyList(beanClass));
261: propertyDescriptorList.addAll(Arrays.asList(super
262: .getPropertyDescriptors()));
263: propertyDescriptors = propertyDescriptorList
264: .toArray(new PropertyDescriptor[propertyDescriptorList
265: .size()]);
266: return propertyDescriptors;
267:
268: } catch (IntrospectionException e) {
269: e.printStackTrace();
270: return null;
271: }
272:
273: }
274:
275: }
|