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: /**
062: * The HtmlInputTextBeanInfo class provides design-time meta data for
063: * the HtmlInputText component for use in a visual design tool.
064: */
065: public class HtmlInputTextBeanInfo extends UIInputBeanInfoBase {
066:
067: protected static ResourceBundle resources = ResourceBundle
068: .getBundle(
069: "org.netbeans.modules.visualweb.faces.dt_1_1.component.html.Bundle-JSF",
070: Locale.getDefault(), HtmlInputTextBeanInfo.class
071: .getClassLoader());
072:
073: public HtmlInputTextBeanInfo() {
074: beanClass = javax.faces.component.html.HtmlInputText.class;
075: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputText_C16";
076: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputText_C32";
077: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputText_M16";
078: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputText_M32";
079: }
080:
081: private BeanDescriptor beanDescriptor;
082:
083: public BeanDescriptor getBeanDescriptor() {
084: if (beanDescriptor != null) {
085: return beanDescriptor;
086: }
087: beanDescriptor = new BeanDescriptorBase(beanClass);
088: beanDescriptor.setDisplayName(resources
089: .getString("HtmlInputText_DisplayName"));
090: beanDescriptor.setShortDescription(resources
091: .getString("HtmlInputText_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_text_field");
100: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
101: "textField");
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_text_field_props");
107: beanDescriptor.setValue(
108: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
109: getCategoryDescriptors());
110: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
111: "inputText");
112: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
113: "h");
114: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
115: "http://java.sun.com/jsf/html");
116: beanDescriptor.setValue(
117: Constants.BeanDescriptor.INLINE_EDITABLE_PROPERTIES,
118: new String[] { "value://input" }); // NOI18N
119: return beanDescriptor;
120: }
121:
122: private PropertyDescriptor[] propertyDescriptors;
123:
124: public PropertyDescriptor[] getPropertyDescriptors() {
125:
126: if (propertyDescriptors != null) {
127: return propertyDescriptors;
128: }
129: AttributeDescriptor attrib = null;
130:
131: try {
132:
133: PropertyDescriptor prop_accesskey = new PropertyDescriptorBase(
134: "accesskey", beanClass, "getAccesskey",
135: "setAccesskey");
136: prop_accesskey.setDisplayName(resources
137: .getString("HtmlInputText_accesskey_DisplayName"));
138: prop_accesskey.setShortDescription(resources
139: .getString("HtmlInputText_accesskey_Description"));
140: prop_accesskey.setExpert(false);
141: prop_accesskey.setHidden(false);
142: prop_accesskey.setPreferred(false);
143: attrib = new AttributeDescriptor("accesskey", false, null,
144: true);
145: prop_accesskey.setValue(
146: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
147: attrib);
148: prop_accesskey
149: .setValue(
150: Constants.PropertyDescriptor.CATEGORY,
151: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
152:
153: PropertyDescriptor prop_alt = new PropertyDescriptorBase(
154: "alt", beanClass, "getAlt", "setAlt");
155: prop_alt.setDisplayName(resources
156: .getString("HtmlInputText_alt_DisplayName"));
157: prop_alt.setShortDescription(resources
158: .getString("HtmlInputText_alt_Description"));
159: prop_alt.setExpert(false);
160: prop_alt.setHidden(false);
161: prop_alt.setPreferred(false);
162: attrib = new AttributeDescriptor("alt", false, null, true);
163: prop_alt.setValue(
164: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
165: attrib);
166: prop_alt
167: .setValue(
168: Constants.PropertyDescriptor.CATEGORY,
169: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
170:
171: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
172: "dir", beanClass, "getDir", "setDir");
173: prop_dir.setDisplayName(resources
174: .getString("HtmlInputText_dir_DisplayName"));
175: prop_dir.setShortDescription(resources
176: .getString("HtmlInputText_dir_Description"));
177: prop_dir
178: .setPropertyEditorClass(SelectOneDomainEditor.class);
179: prop_dir.setExpert(false);
180: prop_dir.setHidden(false);
181: prop_dir.setPreferred(false);
182: attrib = new AttributeDescriptor("dir", false, null, true);
183: prop_dir.setValue(
184: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
185: attrib);
186: prop_dir
187: .setValue(
188: Constants.PropertyDescriptor.CATEGORY,
189: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
190: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
191: TextDirectionDomain.class);
192:
193: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
194: "disabled", beanClass, "isDisabled", "setDisabled");
195: prop_disabled.setDisplayName(resources
196: .getString("HtmlInputText_disabled_DisplayName"));
197: prop_disabled.setShortDescription(resources
198: .getString("HtmlInputText_disabled_Description"));
199: prop_disabled.setExpert(false);
200: prop_disabled.setHidden(false);
201: prop_disabled.setPreferred(false);
202: attrib = new AttributeDescriptor("disabled", false, null,
203: true);
204: prop_disabled.setValue(
205: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
206: attrib);
207: prop_disabled
208: .setValue(
209: Constants.PropertyDescriptor.CATEGORY,
210: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
211:
212: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
213: "lang", beanClass, "getLang", "setLang");
214: prop_lang.setDisplayName(resources
215: .getString("HtmlInputText_lang_DisplayName"));
216: prop_lang.setShortDescription(resources
217: .getString("HtmlInputText_lang_Description"));
218: prop_lang
219: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
220: prop_lang.setExpert(false);
221: prop_lang.setHidden(false);
222: prop_lang.setPreferred(false);
223: attrib = new AttributeDescriptor("lang", false, null, true);
224: prop_lang.setValue(
225: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
226: attrib);
227: prop_lang
228: .setValue(
229: Constants.PropertyDescriptor.CATEGORY,
230: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
231: prop_lang
232: .setValue(
233: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
234: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
235:
236: PropertyDescriptor prop_maxlength = new PropertyDescriptorBase(
237: "maxlength", beanClass, "getMaxlength",
238: "setMaxlength");
239: prop_maxlength.setDisplayName(resources
240: .getString("HtmlInputText_maxlength_DisplayName"));
241: prop_maxlength.setShortDescription(resources
242: .getString("HtmlInputText_maxlength_Description"));
243: prop_maxlength
244: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
245: prop_maxlength.setExpert(false);
246: prop_maxlength.setHidden(false);
247: prop_maxlength.setPreferred(false);
248: attrib = new AttributeDescriptor("maxlength", false, null,
249: true);
250: prop_maxlength.setValue(
251: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
252: attrib);
253: prop_maxlength
254: .setValue(
255: Constants.PropertyDescriptor.CATEGORY,
256: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
257: prop_maxlength.setValue("minValue", new Integer(0));
258: prop_maxlength.setValue("unsetValue", new Integer(
259: Integer.MIN_VALUE));
260:
261: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
262: "readonly", beanClass, "isReadonly", "setReadonly");
263: prop_readonly.setDisplayName(resources
264: .getString("HtmlInputText_readonly_DisplayName"));
265: prop_readonly.setShortDescription(resources
266: .getString("HtmlInputText_readonly_Description"));
267: prop_readonly.setExpert(false);
268: prop_readonly.setHidden(false);
269: prop_readonly.setPreferred(false);
270: attrib = new AttributeDescriptor("readonly", false, null,
271: true);
272: prop_readonly.setValue(
273: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
274: attrib);
275: prop_readonly
276: .setValue(
277: Constants.PropertyDescriptor.CATEGORY,
278: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
279:
280: PropertyDescriptor prop_size = new PropertyDescriptorBase(
281: "size", beanClass, "getSize", "setSize");
282: prop_size.setDisplayName(resources
283: .getString("HtmlInputText_size_DisplayName"));
284: prop_size.setShortDescription(resources
285: .getString("HtmlInputText_size_Description"));
286: prop_size
287: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
288: prop_size.setExpert(false);
289: prop_size.setHidden(false);
290: prop_size.setPreferred(false);
291: attrib = new AttributeDescriptor("size", false, null, true);
292: prop_size.setValue(
293: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
294: attrib);
295: prop_size
296: .setValue(
297: Constants.PropertyDescriptor.CATEGORY,
298: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
299: prop_size.setValue("minValue", new Integer(0));
300: prop_size.setValue("unsetValue", new Integer(
301: Integer.MIN_VALUE));
302:
303: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
304: "tabindex", beanClass, "getTabindex", "setTabindex");
305: prop_tabindex.setDisplayName(resources
306: .getString("HtmlInputText_tabindex_DisplayName"));
307: prop_tabindex.setShortDescription(resources
308: .getString("HtmlInputText_tabindex_Description"));
309: prop_tabindex
310: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
311: prop_tabindex.setExpert(false);
312: prop_tabindex.setHidden(false);
313: prop_tabindex.setPreferred(false);
314: attrib = new AttributeDescriptor("tabindex", false, null,
315: true);
316: prop_tabindex.setValue(
317: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
318: attrib);
319: prop_tabindex
320: .setValue(
321: Constants.PropertyDescriptor.CATEGORY,
322: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
323: prop_tabindex.setValue("maxValue", new Integer(
324: Short.MAX_VALUE));
325: prop_tabindex.setValue("minValue", new Integer(0));
326:
327: PropertyDescriptor prop_title = new PropertyDescriptorBase(
328: "title", beanClass, "getTitle", "setTitle");
329: prop_title.setDisplayName(resources
330: .getString("HtmlInputText_title_DisplayName"));
331: prop_title.setShortDescription(resources
332: .getString("HtmlInputText_title_Description"));
333: prop_title.setExpert(false);
334: prop_title.setHidden(false);
335: prop_title.setPreferred(false);
336: attrib = new AttributeDescriptor("title", false, null, true);
337: prop_title.setValue(
338: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
339: attrib);
340: prop_title
341: .setValue(
342: Constants.PropertyDescriptor.CATEGORY,
343: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
344:
345: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
346: propertyDescriptorList.add(prop_accesskey);
347: propertyDescriptorList.add(prop_alt);
348: propertyDescriptorList.add(prop_dir);
349: propertyDescriptorList.add(prop_disabled);
350: propertyDescriptorList.add(prop_lang);
351: propertyDescriptorList.add(prop_maxlength);
352: propertyDescriptorList.add(prop_readonly);
353: propertyDescriptorList.add(prop_size);
354: propertyDescriptorList.add(prop_tabindex);
355: propertyDescriptorList.add(prop_title);
356:
357: propertyDescriptorList.addAll(Properties
358: .getVisualPropertyList(beanClass));
359: propertyDescriptorList.addAll(Properties
360: .getKeyEventPropertyList(beanClass));
361: propertyDescriptorList.addAll(Properties
362: .getMouseEventPropertyList(beanClass));
363: propertyDescriptorList.addAll(Properties
364: .getClickEventPropertyList(beanClass));
365: propertyDescriptorList.addAll(Properties
366: .getFocusEventPropertyList(beanClass));
367: propertyDescriptorList.addAll(Properties
368: .getSelectEventPropertyList(beanClass));
369: propertyDescriptorList.addAll(Properties
370: .getChangeEventPropertyList(beanClass));
371: propertyDescriptorList.addAll(Arrays.asList(super
372: .getPropertyDescriptors()));
373: propertyDescriptors = propertyDescriptorList
374: .toArray(new PropertyDescriptor[propertyDescriptorList
375: .size()]);
376: return propertyDescriptors;
377:
378: } catch (IntrospectionException e) {
379: e.printStackTrace();
380: return null;
381: }
382:
383: }
384:
385: }
|