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 HtmlInputTextareaBeanInfo extends UIInputBeanInfoBase {
062:
063: protected static ResourceBundle resources = ResourceBundle
064: .getBundle(
065: "org.netbeans.modules.visualweb.faces.dt_1_1.component.html.Bundle-JSF",
066: Locale.getDefault(),
067: HtmlInputTextareaBeanInfo.class.getClassLoader());
068:
069: public HtmlInputTextareaBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlInputTextarea.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputTextarea_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputTextarea_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputTextarea_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputTextarea_M32";
075: }
076:
077: private BeanDescriptor beanDescriptor;
078:
079: public BeanDescriptor getBeanDescriptor() {
080:
081: if (beanDescriptor != null) {
082: return beanDescriptor;
083: }
084: beanDescriptor = new BeanDescriptorBase(beanClass);
085: beanDescriptor.setDisplayName(resources
086: .getString("HtmlInputTextarea_DisplayName"));
087: beanDescriptor.setShortDescription(resources
088: .getString("HtmlInputTextarea_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
096: .setValue(Constants.BeanDescriptor.HELP_KEY,
097: "projrave_ui_elements_palette_jsfstd_multiline_textarea");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "textArea");
100: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
101: Boolean.FALSE);
102: beanDescriptor
103: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
104: "projrave_ui_elements_propsheets_jsfstd_multiline_textarea_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "inputTextarea");
110: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
111: "h");
112: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
113: "http://java.sun.com/jsf/html");
114: beanDescriptor.setValue(
115: Constants.BeanDescriptor.INLINE_EDITABLE_PROPERTIES,
116: new String[] { "value://textarea" }); // NOI18N
117:
118: return beanDescriptor;
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("HtmlInputTextarea_accesskey_DisplayName"));
138: prop_accesskey
139: .setShortDescription(resources
140: .getString("HtmlInputTextarea_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_cols = new PropertyDescriptorBase(
155: "cols", beanClass, "getCols", "setCols");
156: prop_cols.setDisplayName(resources
157: .getString("HtmlInputTextarea_cols_DisplayName"));
158: prop_cols.setShortDescription(resources
159: .getString("HtmlInputTextarea_cols_Description"));
160: prop_cols
161: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
162: prop_cols.setExpert(false);
163: prop_cols.setHidden(false);
164: prop_cols.setPreferred(false);
165: attrib = new AttributeDescriptor("cols", false, null, true);
166: prop_cols.setValue(
167: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
168: attrib);
169: prop_cols
170: .setValue(
171: Constants.PropertyDescriptor.CATEGORY,
172: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
173: prop_cols.setValue("minValue", new Integer(0));
174: prop_cols.setValue("unsetValue", new Integer(
175: Integer.MIN_VALUE));
176:
177: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
178: "dir", beanClass, "getDir", "setDir");
179: prop_dir.setDisplayName(resources
180: .getString("HtmlInputTextarea_dir_DisplayName"));
181: prop_dir.setShortDescription(resources
182: .getString("HtmlInputTextarea_dir_Description"));
183: prop_dir
184: .setPropertyEditorClass(SelectOneDomainEditor.class);
185: prop_dir.setExpert(false);
186: prop_dir.setHidden(false);
187: prop_dir.setPreferred(false);
188: attrib = new AttributeDescriptor("dir", false, null, true);
189: prop_dir.setValue(
190: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
191: attrib);
192: prop_dir
193: .setValue(
194: Constants.PropertyDescriptor.CATEGORY,
195: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
196: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
197: TextDirectionDomain.class);
198:
199: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
200: "disabled", beanClass, "isDisabled", "setDisabled");
201: prop_disabled
202: .setDisplayName(resources
203: .getString("HtmlInputTextarea_disabled_DisplayName"));
204: prop_disabled
205: .setShortDescription(resources
206: .getString("HtmlInputTextarea_disabled_Description"));
207: prop_disabled.setExpert(false);
208: prop_disabled.setHidden(false);
209: prop_disabled.setPreferred(false);
210: attrib = new AttributeDescriptor("disabled", false, null,
211: true);
212: prop_disabled.setValue(
213: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
214: attrib);
215: prop_disabled
216: .setValue(
217: Constants.PropertyDescriptor.CATEGORY,
218: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
219:
220: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
221: "lang", beanClass, "getLang", "setLang");
222: prop_lang.setDisplayName(resources
223: .getString("HtmlInputTextarea_lang_DisplayName"));
224: prop_lang.setShortDescription(resources
225: .getString("HtmlInputTextarea_lang_Description"));
226: prop_lang
227: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
228: prop_lang.setExpert(false);
229: prop_lang.setHidden(false);
230: prop_lang.setPreferred(false);
231: attrib = new AttributeDescriptor("lang", false, null, true);
232: prop_lang.setValue(
233: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
234: attrib);
235: prop_lang
236: .setValue(
237: Constants.PropertyDescriptor.CATEGORY,
238: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
239: prop_lang
240: .setValue(
241: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
242: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
243:
244: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
245: "readonly", beanClass, "isReadonly", "setReadonly");
246: prop_readonly
247: .setDisplayName(resources
248: .getString("HtmlInputTextarea_readonly_DisplayName"));
249: prop_readonly
250: .setShortDescription(resources
251: .getString("HtmlInputTextarea_readonly_Description"));
252: prop_readonly.setExpert(false);
253: prop_readonly.setHidden(false);
254: prop_readonly.setPreferred(false);
255: attrib = new AttributeDescriptor("readonly", false, null,
256: true);
257: prop_readonly.setValue(
258: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
259: attrib);
260: prop_readonly
261: .setValue(
262: Constants.PropertyDescriptor.CATEGORY,
263: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
264:
265: PropertyDescriptor prop_rows = new PropertyDescriptorBase(
266: "rows", beanClass, "getRows", "setRows");
267: prop_rows.setDisplayName(resources
268: .getString("HtmlInputTextarea_rows_DisplayName"));
269: prop_rows.setShortDescription(resources
270: .getString("HtmlInputTextarea_rows_Description"));
271: prop_rows
272: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
273: prop_rows.setExpert(false);
274: prop_rows.setHidden(false);
275: prop_rows.setPreferred(false);
276: attrib = new AttributeDescriptor("rows", false, null, true);
277: prop_rows.setValue(
278: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
279: attrib);
280: prop_rows
281: .setValue(
282: Constants.PropertyDescriptor.CATEGORY,
283: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
284: prop_rows.setValue("minValue", new Integer(0));
285: prop_rows.setValue("unsetValue", new Integer(
286: Integer.MIN_VALUE));
287:
288: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
289: "tabindex", beanClass, "getTabindex", "setTabindex");
290: prop_tabindex
291: .setDisplayName(resources
292: .getString("HtmlInputTextarea_tabindex_DisplayName"));
293: prop_tabindex
294: .setShortDescription(resources
295: .getString("HtmlInputTextarea_tabindex_Description"));
296: prop_tabindex
297: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
298: prop_tabindex.setExpert(false);
299: prop_tabindex.setHidden(false);
300: prop_tabindex.setPreferred(false);
301: attrib = new AttributeDescriptor("tabindex", false, null,
302: true);
303: prop_tabindex.setValue(
304: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
305: attrib);
306: prop_tabindex
307: .setValue(
308: Constants.PropertyDescriptor.CATEGORY,
309: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
310: prop_tabindex.setValue("maxValue", new Integer(
311: Short.MAX_VALUE));
312: prop_tabindex.setValue("minValue", new Integer(0));
313:
314: PropertyDescriptor prop_title = new PropertyDescriptorBase(
315: "title", beanClass, "getTitle", "setTitle");
316: prop_title.setDisplayName(resources
317: .getString("HtmlInputTextarea_title_DisplayName"));
318: prop_title.setShortDescription(resources
319: .getString("HtmlInputTextarea_title_Description"));
320: prop_title.setExpert(false);
321: prop_title.setHidden(false);
322: prop_title.setPreferred(false);
323: attrib = new AttributeDescriptor("title", false, null, true);
324: prop_title.setValue(
325: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
326: attrib);
327: prop_title
328: .setValue(
329: Constants.PropertyDescriptor.CATEGORY,
330: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
331:
332: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
333: propertyDescriptorList.add(prop_accesskey);
334: propertyDescriptorList.add(prop_cols);
335: propertyDescriptorList.add(prop_dir);
336: propertyDescriptorList.add(prop_disabled);
337: propertyDescriptorList.add(prop_lang);
338: propertyDescriptorList.add(prop_readonly);
339: propertyDescriptorList.add(prop_rows);
340: propertyDescriptorList.add(prop_tabindex);
341: propertyDescriptorList.add(prop_title);
342:
343: propertyDescriptorList.addAll(Properties
344: .getVisualPropertyList(beanClass));
345: propertyDescriptorList.addAll(Properties
346: .getKeyEventPropertyList(beanClass));
347: propertyDescriptorList.addAll(Properties
348: .getMouseEventPropertyList(beanClass));
349: propertyDescriptorList.addAll(Properties
350: .getClickEventPropertyList(beanClass));
351: propertyDescriptorList.addAll(Properties
352: .getFocusEventPropertyList(beanClass));
353: propertyDescriptorList.addAll(Properties
354: .getSelectEventPropertyList(beanClass));
355: propertyDescriptorList.addAll(Properties
356: .getChangeEventPropertyList(beanClass));
357: propertyDescriptorList.addAll(Arrays.asList(super
358: .getPropertyDescriptors()));
359: propertyDescriptors = propertyDescriptorList
360: .toArray(new PropertyDescriptor[propertyDescriptorList
361: .size()]);
362: return propertyDescriptors;
363:
364: } catch (IntrospectionException e) {
365: e.printStackTrace();
366: return null;
367: }
368:
369: }
370:
371: }
|