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 HtmlInputTextareaBeanInfo extends UIInputBeanInfoBase {
062:
063: protected static ResourceBundle resources = ResourceBundle
064: .getBundle(
065: "org.netbeans.modules.visualweb.faces.dt_1_2.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_2/component/html/HtmlInputTextarea_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputTextarea_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputTextarea_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/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_disabled = new PropertyDescriptorBase(
178: "disabled", beanClass, "isDisabled", "setDisabled");
179: prop_disabled
180: .setDisplayName(resources
181: .getString("HtmlInputTextarea_disabled_DisplayName"));
182: prop_disabled
183: .setShortDescription(resources
184: .getString("HtmlInputTextarea_disabled_Description"));
185: prop_disabled.setExpert(false);
186: prop_disabled.setHidden(false);
187: prop_disabled.setPreferred(false);
188: attrib = new AttributeDescriptor("disabled", false, null,
189: true);
190: prop_disabled.setValue(
191: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
192: attrib);
193: prop_disabled
194: .setValue(
195: Constants.PropertyDescriptor.CATEGORY,
196: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
197:
198: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
199: "readonly", beanClass, "isReadonly", "setReadonly");
200: prop_readonly
201: .setDisplayName(resources
202: .getString("HtmlInputTextarea_readonly_DisplayName"));
203: prop_readonly
204: .setShortDescription(resources
205: .getString("HtmlInputTextarea_readonly_Description"));
206: prop_readonly.setExpert(false);
207: prop_readonly.setHidden(false);
208: prop_readonly.setPreferred(false);
209: attrib = new AttributeDescriptor("readonly", false, null,
210: true);
211: prop_readonly.setValue(
212: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
213: attrib);
214: prop_readonly
215: .setValue(
216: Constants.PropertyDescriptor.CATEGORY,
217: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
218:
219: PropertyDescriptor prop_rows = new PropertyDescriptorBase(
220: "rows", beanClass, "getRows", "setRows");
221: prop_rows.setDisplayName(resources
222: .getString("HtmlInputTextarea_rows_DisplayName"));
223: prop_rows.setShortDescription(resources
224: .getString("HtmlInputTextarea_rows_Description"));
225: prop_rows
226: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
227: prop_rows.setExpert(false);
228: prop_rows.setHidden(false);
229: prop_rows.setPreferred(false);
230: attrib = new AttributeDescriptor("rows", false, null, true);
231: prop_rows.setValue(
232: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
233: attrib);
234: prop_rows
235: .setValue(
236: Constants.PropertyDescriptor.CATEGORY,
237: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
238: prop_rows.setValue("minValue", new Integer(0));
239: prop_rows.setValue("unsetValue", new Integer(
240: Integer.MIN_VALUE));
241:
242: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
243: "tabindex", beanClass, "getTabindex", "setTabindex");
244: prop_tabindex
245: .setDisplayName(resources
246: .getString("HtmlInputTextarea_tabindex_DisplayName"));
247: prop_tabindex
248: .setShortDescription(resources
249: .getString("HtmlInputTextarea_tabindex_Description"));
250: prop_tabindex
251: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
252: prop_tabindex.setExpert(false);
253: prop_tabindex.setHidden(false);
254: prop_tabindex.setPreferred(false);
255: attrib = new AttributeDescriptor("tabindex", false, null,
256: true);
257: prop_tabindex.setValue(
258: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
259: attrib);
260: prop_tabindex
261: .setValue(
262: Constants.PropertyDescriptor.CATEGORY,
263: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
264: prop_tabindex.setValue("maxValue", new Integer(
265: Short.MAX_VALUE));
266: prop_tabindex.setValue("minValue", new Integer(0));
267:
268: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
269: propertyDescriptorList.add(prop_accesskey);
270: propertyDescriptorList.add(prop_cols);
271: propertyDescriptorList.add(prop_disabled);
272: propertyDescriptorList.add(prop_readonly);
273: propertyDescriptorList.add(prop_rows);
274: propertyDescriptorList.add(prop_tabindex);
275:
276: propertyDescriptorList.addAll(Properties
277: .getVisualPropertyList(beanClass));
278: propertyDescriptorList.addAll(Properties
279: .getKeyEventPropertyList(beanClass));
280: propertyDescriptorList.addAll(Properties
281: .getMouseEventPropertyList(beanClass));
282: propertyDescriptorList.addAll(Properties
283: .getClickEventPropertyList(beanClass));
284: propertyDescriptorList.addAll(Properties
285: .getFocusEventPropertyList(beanClass));
286: propertyDescriptorList.addAll(Properties
287: .getSelectEventPropertyList(beanClass));
288: propertyDescriptorList.addAll(Properties
289: .getChangeEventPropertyList(beanClass));
290: propertyDescriptorList.addAll(Properties
291: .getInputPropertyList(beanClass));
292: propertyDescriptorList.addAll(Arrays.asList(super
293: .getPropertyDescriptors()));
294: propertyDescriptors = propertyDescriptorList
295: .toArray(new PropertyDescriptor[propertyDescriptorList
296: .size()]);
297: return propertyDescriptors;
298:
299: } catch (IntrospectionException e) {
300: e.printStackTrace();
301: return null;
302: }
303:
304: }
305:
306: }
|