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: import com.sun.rave.designtime.Constants;
053: import com.sun.rave.designtime.markup.AttributeDescriptor;
054: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
055: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
056: import org.netbeans.modules.visualweb.faces.dt_1_2.component.UIInputBeanInfoBase;
057:
058: /**
059: * The HtmlInputTextBeanInfo class provides design-time meta data for
060: * the HtmlInputText component for use in a visual design tool.
061: */
062: public class HtmlInputTextBeanInfo extends 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(), HtmlInputTextBeanInfo.class
068: .getClassLoader());
069:
070: public HtmlInputTextBeanInfo() {
071: beanClass = javax.faces.component.html.HtmlInputText.class;
072: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputText_C16";
073: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputText_C32";
074: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputText_M16";
075: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputText_M32";
076: }
077:
078: private BeanDescriptor beanDescriptor;
079:
080: public BeanDescriptor getBeanDescriptor() {
081: if (beanDescriptor != null) {
082: return beanDescriptor;
083: }
084: beanDescriptor = new BeanDescriptorBase(beanClass);
085: beanDescriptor.setDisplayName(resources
086: .getString("HtmlInputText_DisplayName"));
087: beanDescriptor.setShortDescription(resources
088: .getString("HtmlInputText_Description"));
089: beanDescriptor.setExpert(false);
090: beanDescriptor.setHidden(false);
091: beanDescriptor.setPreferred(false);
092: beanDescriptor.setValue(
093: Constants.BeanDescriptor.FACET_DESCRIPTORS,
094: getFacetDescriptors());
095: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
096: "projrave_ui_elements_palette_jsfstd_text_field");
097: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
098: "textField");
099: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
100: Boolean.FALSE);
101: beanDescriptor
102: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
103: "projrave_ui_elements_propsheets_jsfstd_text_field_props");
104: beanDescriptor.setValue(
105: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
106: getCategoryDescriptors());
107: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
108: "inputText");
109: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
110: "h");
111: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
112: "http://java.sun.com/jsf/html");
113: beanDescriptor.setValue(
114: Constants.BeanDescriptor.INLINE_EDITABLE_PROPERTIES,
115: new String[] { "value://input" }); // NOI18N
116: return beanDescriptor;
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.setDisplayName(resources
134: .getString("HtmlInputText_accesskey_DisplayName"));
135: prop_accesskey.setShortDescription(resources
136: .getString("HtmlInputText_accesskey_Description"));
137: prop_accesskey.setExpert(false);
138: prop_accesskey.setHidden(false);
139: prop_accesskey.setPreferred(false);
140: attrib = new AttributeDescriptor("accesskey", false, null,
141: true);
142: prop_accesskey.setValue(
143: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
144: attrib);
145: prop_accesskey
146: .setValue(
147: Constants.PropertyDescriptor.CATEGORY,
148: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
149:
150: PropertyDescriptor prop_alt = new PropertyDescriptorBase(
151: "alt", beanClass, "getAlt", "setAlt");
152: prop_alt.setDisplayName(resources
153: .getString("HtmlInputText_alt_DisplayName"));
154: prop_alt.setShortDescription(resources
155: .getString("HtmlInputText_alt_Description"));
156: prop_alt.setExpert(false);
157: prop_alt.setHidden(false);
158: prop_alt.setPreferred(false);
159: attrib = new AttributeDescriptor("alt", false, null, true);
160: prop_alt.setValue(
161: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
162: attrib);
163: prop_alt
164: .setValue(
165: Constants.PropertyDescriptor.CATEGORY,
166: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
167:
168: PropertyDescriptor prop_autocomplete = new PropertyDescriptorBase(
169: "autocomplete", beanClass, "getAutocomplete",
170: "setAutocomplete");
171: prop_autocomplete
172: .setDisplayName(resources
173: .getString("HtmlInputText_autocomplete_DisplayName"));
174: prop_autocomplete
175: .setShortDescription(resources
176: .getString("HtmlInputText_autocomplete_Description"));
177: prop_autocomplete
178: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
179: prop_autocomplete.setExpert(false);
180: prop_autocomplete.setHidden(false);
181: prop_autocomplete.setPreferred(false);
182: attrib = new AttributeDescriptor("autocomplete", false,
183: null, true);
184: prop_autocomplete.setValue(
185: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
186: attrib);
187: prop_autocomplete
188: .setValue(
189: Constants.PropertyDescriptor.CATEGORY,
190: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
191:
192: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
193: "disabled", beanClass, "isDisabled", "setDisabled");
194: prop_disabled.setDisplayName(resources
195: .getString("HtmlInputText_disabled_DisplayName"));
196: prop_disabled.setShortDescription(resources
197: .getString("HtmlInputText_disabled_Description"));
198: prop_disabled.setExpert(false);
199: prop_disabled.setHidden(false);
200: prop_disabled.setPreferred(false);
201: attrib = new AttributeDescriptor("disabled", false, null,
202: true);
203: prop_disabled.setValue(
204: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
205: attrib);
206: prop_disabled
207: .setValue(
208: Constants.PropertyDescriptor.CATEGORY,
209: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
210:
211: PropertyDescriptor prop_maxlength = new PropertyDescriptorBase(
212: "maxlength", beanClass, "getMaxlength",
213: "setMaxlength");
214: prop_maxlength.setDisplayName(resources
215: .getString("HtmlInputText_maxlength_DisplayName"));
216: prop_maxlength.setShortDescription(resources
217: .getString("HtmlInputText_maxlength_Description"));
218: prop_maxlength
219: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
220: prop_maxlength.setExpert(false);
221: prop_maxlength.setHidden(false);
222: prop_maxlength.setPreferred(false);
223: attrib = new AttributeDescriptor("maxlength", false, null,
224: true);
225: prop_maxlength.setValue(
226: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
227: attrib);
228: prop_maxlength
229: .setValue(
230: Constants.PropertyDescriptor.CATEGORY,
231: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
232: prop_maxlength.setValue("minValue", new Integer(0));
233: prop_maxlength.setValue("unsetValue", new Integer(
234: Integer.MIN_VALUE));
235:
236: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
237: "readonly", beanClass, "isReadonly", "setReadonly");
238: prop_readonly.setDisplayName(resources
239: .getString("HtmlInputText_readonly_DisplayName"));
240: prop_readonly.setShortDescription(resources
241: .getString("HtmlInputText_readonly_Description"));
242: prop_readonly.setExpert(false);
243: prop_readonly.setHidden(false);
244: prop_readonly.setPreferred(false);
245: attrib = new AttributeDescriptor("readonly", false, null,
246: true);
247: prop_readonly.setValue(
248: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
249: attrib);
250: prop_readonly
251: .setValue(
252: Constants.PropertyDescriptor.CATEGORY,
253: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
254:
255: PropertyDescriptor prop_size = new PropertyDescriptorBase(
256: "size", beanClass, "getSize", "setSize");
257: prop_size.setDisplayName(resources
258: .getString("HtmlInputText_size_DisplayName"));
259: prop_size.setShortDescription(resources
260: .getString("HtmlInputText_size_Description"));
261: prop_size
262: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
263: prop_size.setExpert(false);
264: prop_size.setHidden(false);
265: prop_size.setPreferred(false);
266: attrib = new AttributeDescriptor("size", false, null, true);
267: prop_size.setValue(
268: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
269: attrib);
270: prop_size
271: .setValue(
272: Constants.PropertyDescriptor.CATEGORY,
273: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
274: prop_size.setValue("minValue", new Integer(0));
275: prop_size.setValue("unsetValue", new Integer(
276: Integer.MIN_VALUE));
277:
278: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
279: "tabindex", beanClass, "getTabindex", "setTabindex");
280: prop_tabindex.setDisplayName(resources
281: .getString("HtmlInputText_tabindex_DisplayName"));
282: prop_tabindex.setShortDescription(resources
283: .getString("HtmlInputText_tabindex_Description"));
284: prop_tabindex
285: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
286: prop_tabindex.setExpert(false);
287: prop_tabindex.setHidden(false);
288: prop_tabindex.setPreferred(false);
289: attrib = new AttributeDescriptor("tabindex", false, null,
290: true);
291: prop_tabindex.setValue(
292: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
293: attrib);
294: prop_tabindex
295: .setValue(
296: Constants.PropertyDescriptor.CATEGORY,
297: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
298: prop_tabindex.setValue("maxValue", new Integer(
299: Short.MAX_VALUE));
300: prop_tabindex.setValue("minValue", new Integer(0));
301:
302: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
303: propertyDescriptorList.add(prop_accesskey);
304: propertyDescriptorList.add(prop_alt);
305: propertyDescriptorList.add(prop_autocomplete);
306: propertyDescriptorList.add(prop_disabled);
307: propertyDescriptorList.add(prop_maxlength);
308: propertyDescriptorList.add(prop_readonly);
309: propertyDescriptorList.add(prop_size);
310: propertyDescriptorList.add(prop_tabindex);
311:
312: propertyDescriptorList.addAll(Properties
313: .getVisualPropertyList(beanClass));
314: propertyDescriptorList.addAll(Properties
315: .getKeyEventPropertyList(beanClass));
316: propertyDescriptorList.addAll(Properties
317: .getMouseEventPropertyList(beanClass));
318: propertyDescriptorList.addAll(Properties
319: .getClickEventPropertyList(beanClass));
320: propertyDescriptorList.addAll(Properties
321: .getFocusEventPropertyList(beanClass));
322: propertyDescriptorList.addAll(Properties
323: .getSelectEventPropertyList(beanClass));
324: propertyDescriptorList.addAll(Properties
325: .getChangeEventPropertyList(beanClass));
326: propertyDescriptorList.addAll(Properties
327: .getInputPropertyList(beanClass));
328: propertyDescriptorList.addAll(Arrays.asList(super
329: .getPropertyDescriptors()));
330: propertyDescriptors = propertyDescriptorList
331: .toArray(new PropertyDescriptor[propertyDescriptorList
332: .size()]);
333: return propertyDescriptors;
334:
335: } catch (IntrospectionException e) {
336: e.printStackTrace();
337: return null;
338: }
339:
340: }
341:
342: }
|