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 HtmlInputSecretBeanInfo 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(), HtmlInputSecretBeanInfo.class
067: .getClassLoader());
068:
069: public HtmlInputSecretBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlInputSecret.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputSecret_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputSecret_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputSecret_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlInputSecret_M32";
075: }
076:
077: private BeanDescriptor beanDescriptor;
078:
079: public BeanDescriptor getBeanDescriptor() {
080:
081: if (beanDescriptor != null) {
082: return beanDescriptor;
083: }
084:
085: beanDescriptor = new BeanDescriptorBase(beanClass);
086: beanDescriptor.setDisplayName(resources
087: .getString("HtmlInputSecret_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlInputSecret_Description"));
090: beanDescriptor.setExpert(false);
091: beanDescriptor.setHidden(false);
092: beanDescriptor.setPreferred(false);
093: beanDescriptor.setValue(
094: Constants.BeanDescriptor.FACET_DESCRIPTORS,
095: getFacetDescriptors());
096: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
097: "projrave_ui_elements_palette_jsfstd_secret_field");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "secretField");
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_secret_field_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "inputSecret");
110: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
111: "h");
112: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
113: "http://java.sun.com/jsf/html");
114:
115: return beanDescriptor;
116:
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
134: .setDisplayName(resources
135: .getString("HtmlInputSecret_accesskey_DisplayName"));
136: prop_accesskey
137: .setShortDescription(resources
138: .getString("HtmlInputSecret_accesskey_Description"));
139: prop_accesskey.setExpert(false);
140: prop_accesskey.setHidden(false);
141: prop_accesskey.setPreferred(false);
142: attrib = new AttributeDescriptor("accesskey", false, null,
143: true);
144: prop_accesskey.setValue(
145: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
146: attrib);
147: prop_accesskey
148: .setValue(
149: Constants.PropertyDescriptor.CATEGORY,
150: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
151:
152: PropertyDescriptor prop_alt = new PropertyDescriptorBase(
153: "alt", beanClass, "getAlt", "setAlt");
154: prop_alt.setDisplayName(resources
155: .getString("HtmlInputSecret_alt_DisplayName"));
156: prop_alt.setShortDescription(resources
157: .getString("HtmlInputSecret_alt_Description"));
158: prop_alt.setExpert(false);
159: prop_alt.setHidden(false);
160: prop_alt.setPreferred(false);
161: attrib = new AttributeDescriptor("alt", false, null, true);
162: prop_alt.setValue(
163: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
164: attrib);
165: prop_alt
166: .setValue(
167: Constants.PropertyDescriptor.CATEGORY,
168: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
169:
170: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
171: "disabled", beanClass, "isDisabled", "setDisabled");
172: prop_disabled.setDisplayName(resources
173: .getString("HtmlInputSecret_disabled_DisplayName"));
174: prop_disabled.setShortDescription(resources
175: .getString("HtmlInputSecret_disabled_Description"));
176: prop_disabled.setExpert(false);
177: prop_disabled.setHidden(false);
178: prop_disabled.setPreferred(false);
179: attrib = new AttributeDescriptor("disabled", false, null,
180: true);
181: prop_disabled.setValue(
182: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
183: attrib);
184: prop_disabled
185: .setValue(
186: Constants.PropertyDescriptor.CATEGORY,
187: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
188:
189: PropertyDescriptor prop_maxlength = new PropertyDescriptorBase(
190: "maxlength", beanClass, "getMaxlength",
191: "setMaxlength");
192: prop_maxlength
193: .setDisplayName(resources
194: .getString("HtmlInputSecret_maxlength_DisplayName"));
195: prop_maxlength
196: .setShortDescription(resources
197: .getString("HtmlInputSecret_maxlength_Description"));
198: prop_maxlength
199: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
200: prop_maxlength.setExpert(false);
201: prop_maxlength.setHidden(false);
202: prop_maxlength.setPreferred(false);
203: attrib = new AttributeDescriptor("maxlength", false, null,
204: true);
205: prop_maxlength.setValue(
206: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
207: attrib);
208: prop_maxlength
209: .setValue(
210: Constants.PropertyDescriptor.CATEGORY,
211: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
212: prop_maxlength.setValue("minValue", new Integer(0));
213: prop_maxlength.setValue("unsetValue", new Integer(
214: Integer.MIN_VALUE));
215:
216: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
217: "readonly", beanClass, "isReadonly", "setReadonly");
218: prop_readonly.setDisplayName(resources
219: .getString("HtmlInputSecret_readonly_DisplayName"));
220: prop_readonly.setShortDescription(resources
221: .getString("HtmlInputSecret_readonly_Description"));
222: prop_readonly.setExpert(false);
223: prop_readonly.setHidden(false);
224: prop_readonly.setPreferred(false);
225: attrib = new AttributeDescriptor("readonly", false, null,
226: true);
227: prop_readonly.setValue(
228: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
229: attrib);
230: prop_readonly
231: .setValue(
232: Constants.PropertyDescriptor.CATEGORY,
233: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
234:
235: PropertyDescriptor prop_redisplay = new PropertyDescriptorBase(
236: "redisplay", beanClass, "isRedisplay",
237: "setRedisplay");
238: prop_redisplay
239: .setDisplayName(resources
240: .getString("HtmlInputSecret_redisplay_DisplayName"));
241: prop_redisplay
242: .setShortDescription(resources
243: .getString("HtmlInputSecret_redisplay_Description"));
244: prop_redisplay.setExpert(false);
245: prop_redisplay.setHidden(false);
246: prop_redisplay.setPreferred(false);
247: attrib = new AttributeDescriptor("redisplay", false, null,
248: true);
249: prop_redisplay.setValue(
250: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
251: attrib);
252: prop_redisplay
253: .setValue(
254: Constants.PropertyDescriptor.CATEGORY,
255: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
256:
257: PropertyDescriptor prop_size = new PropertyDescriptorBase(
258: "size", beanClass, "getSize", "setSize");
259: prop_size.setDisplayName(resources
260: .getString("HtmlInputSecret_size_DisplayName"));
261: prop_size.setShortDescription(resources
262: .getString("HtmlInputSecret_size_Description"));
263: prop_size
264: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
265: prop_size.setExpert(false);
266: prop_size.setHidden(false);
267: prop_size.setPreferred(false);
268: attrib = new AttributeDescriptor("size", false, null, true);
269: prop_size.setValue(
270: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
271: attrib);
272: prop_size
273: .setValue(
274: Constants.PropertyDescriptor.CATEGORY,
275: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
276: prop_size.setValue("minValue", new Integer(0));
277: prop_size.setValue("unsetValue", new Integer(
278: Integer.MIN_VALUE));
279:
280: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
281: "tabindex", beanClass, "getTabindex", "setTabindex");
282: prop_tabindex.setDisplayName(resources
283: .getString("HtmlInputSecret_tabindex_DisplayName"));
284: prop_tabindex.setShortDescription(resources
285: .getString("HtmlInputSecret_tabindex_Description"));
286: prop_tabindex
287: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
288: prop_tabindex.setExpert(false);
289: prop_tabindex.setHidden(false);
290: prop_tabindex.setPreferred(false);
291: attrib = new AttributeDescriptor("tabindex", false, null,
292: true);
293: prop_tabindex.setValue(
294: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
295: attrib);
296: prop_tabindex
297: .setValue(
298: Constants.PropertyDescriptor.CATEGORY,
299: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
300: prop_tabindex.setValue("maxValue", new Integer(
301: Short.MAX_VALUE));
302: prop_tabindex.setValue("minValue", new Integer(0));
303:
304: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
305: propertyDescriptorList.add(prop_accesskey);
306: propertyDescriptorList.add(prop_alt);
307: propertyDescriptorList.add(prop_disabled);
308: propertyDescriptorList.add(prop_maxlength);
309: propertyDescriptorList.add(prop_readonly);
310: propertyDescriptorList.add(prop_redisplay);
311: propertyDescriptorList.add(prop_size);
312: propertyDescriptorList.add(prop_tabindex);
313:
314: propertyDescriptorList.addAll(Properties
315: .getVisualPropertyList(beanClass));
316: propertyDescriptorList.addAll(Properties
317: .getKeyEventPropertyList(beanClass));
318: propertyDescriptorList.addAll(Properties
319: .getMouseEventPropertyList(beanClass));
320: propertyDescriptorList.addAll(Properties
321: .getClickEventPropertyList(beanClass));
322: propertyDescriptorList.addAll(Properties
323: .getFocusEventPropertyList(beanClass));
324: propertyDescriptorList.addAll(Properties
325: .getSelectEventPropertyList(beanClass));
326: propertyDescriptorList.addAll(Properties
327: .getChangeEventPropertyList(beanClass));
328: propertyDescriptorList.addAll(Properties
329: .getInputPropertyList(beanClass));
330: propertyDescriptorList.addAll(Arrays.asList(super
331: .getPropertyDescriptors()));
332: propertyDescriptors = propertyDescriptorList
333: .toArray(new PropertyDescriptor[propertyDescriptorList
334: .size()]);
335: return propertyDescriptors;
336:
337: } catch (IntrospectionException e) {
338: e.printStackTrace();
339: return null;
340: }
341:
342: }
343:
344: }
|