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 HtmlInputSecretBeanInfo 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(), 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_1/component/html/HtmlInputSecret_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputSecret_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlInputSecret_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/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_dir = new PropertyDescriptorBase(
171: "dir", beanClass, "getDir", "setDir");
172: prop_dir.setDisplayName(resources
173: .getString("HtmlInputSecret_dir_DisplayName"));
174: prop_dir.setShortDescription(resources
175: .getString("HtmlInputSecret_dir_Description"));
176: prop_dir
177: .setPropertyEditorClass(SelectOneDomainEditor.class);
178: prop_dir.setExpert(false);
179: prop_dir.setHidden(false);
180: prop_dir.setPreferred(false);
181: attrib = new AttributeDescriptor("dir", false, null, true);
182: prop_dir.setValue(
183: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
184: attrib);
185: prop_dir
186: .setValue(
187: Constants.PropertyDescriptor.CATEGORY,
188: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
189: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
190: TextDirectionDomain.class);
191:
192: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
193: "disabled", beanClass, "isDisabled", "setDisabled");
194: prop_disabled.setDisplayName(resources
195: .getString("HtmlInputSecret_disabled_DisplayName"));
196: prop_disabled.setShortDescription(resources
197: .getString("HtmlInputSecret_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_lang = new PropertyDescriptorBase(
212: "lang", beanClass, "getLang", "setLang");
213: prop_lang.setDisplayName(resources
214: .getString("HtmlInputSecret_lang_DisplayName"));
215: prop_lang.setShortDescription(resources
216: .getString("HtmlInputSecret_lang_Description"));
217: prop_lang
218: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
219: prop_lang.setExpert(false);
220: prop_lang.setHidden(false);
221: prop_lang.setPreferred(false);
222: attrib = new AttributeDescriptor("lang", false, null, true);
223: prop_lang.setValue(
224: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
225: attrib);
226: prop_lang
227: .setValue(
228: Constants.PropertyDescriptor.CATEGORY,
229: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
230: prop_lang
231: .setValue(
232: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
233: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
234:
235: PropertyDescriptor prop_maxlength = new PropertyDescriptorBase(
236: "maxlength", beanClass, "getMaxlength",
237: "setMaxlength");
238: prop_maxlength
239: .setDisplayName(resources
240: .getString("HtmlInputSecret_maxlength_DisplayName"));
241: prop_maxlength
242: .setShortDescription(resources
243: .getString("HtmlInputSecret_maxlength_Description"));
244: prop_maxlength
245: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
246: prop_maxlength.setExpert(false);
247: prop_maxlength.setHidden(false);
248: prop_maxlength.setPreferred(false);
249: attrib = new AttributeDescriptor("maxlength", false, null,
250: true);
251: prop_maxlength.setValue(
252: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
253: attrib);
254: prop_maxlength
255: .setValue(
256: Constants.PropertyDescriptor.CATEGORY,
257: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
258: prop_maxlength.setValue("minValue", new Integer(0));
259: prop_maxlength.setValue("unsetValue", new Integer(
260: Integer.MIN_VALUE));
261:
262: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
263: "readonly", beanClass, "isReadonly", "setReadonly");
264: prop_readonly.setDisplayName(resources
265: .getString("HtmlInputSecret_readonly_DisplayName"));
266: prop_readonly.setShortDescription(resources
267: .getString("HtmlInputSecret_readonly_Description"));
268: prop_readonly.setExpert(false);
269: prop_readonly.setHidden(false);
270: prop_readonly.setPreferred(false);
271: attrib = new AttributeDescriptor("readonly", false, null,
272: true);
273: prop_readonly.setValue(
274: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
275: attrib);
276: prop_readonly
277: .setValue(
278: Constants.PropertyDescriptor.CATEGORY,
279: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
280:
281: PropertyDescriptor prop_redisplay = new PropertyDescriptorBase(
282: "redisplay", beanClass, "isRedisplay",
283: "setRedisplay");
284: prop_redisplay
285: .setDisplayName(resources
286: .getString("HtmlInputSecret_redisplay_DisplayName"));
287: prop_redisplay
288: .setShortDescription(resources
289: .getString("HtmlInputSecret_redisplay_Description"));
290: prop_redisplay.setExpert(false);
291: prop_redisplay.setHidden(false);
292: prop_redisplay.setPreferred(false);
293: attrib = new AttributeDescriptor("redisplay", false, null,
294: true);
295: prop_redisplay.setValue(
296: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
297: attrib);
298: prop_redisplay
299: .setValue(
300: Constants.PropertyDescriptor.CATEGORY,
301: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
302:
303: PropertyDescriptor prop_size = new PropertyDescriptorBase(
304: "size", beanClass, "getSize", "setSize");
305: prop_size.setDisplayName(resources
306: .getString("HtmlInputSecret_size_DisplayName"));
307: prop_size.setShortDescription(resources
308: .getString("HtmlInputSecret_size_Description"));
309: prop_size
310: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
311: prop_size.setExpert(false);
312: prop_size.setHidden(false);
313: prop_size.setPreferred(false);
314: attrib = new AttributeDescriptor("size", false, null, true);
315: prop_size.setValue(
316: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
317: attrib);
318: prop_size
319: .setValue(
320: Constants.PropertyDescriptor.CATEGORY,
321: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
322: prop_size.setValue("minValue", new Integer(0));
323: prop_size.setValue("unsetValue", new Integer(
324: Integer.MIN_VALUE));
325:
326: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
327: "tabindex", beanClass, "getTabindex", "setTabindex");
328: prop_tabindex.setDisplayName(resources
329: .getString("HtmlInputSecret_tabindex_DisplayName"));
330: prop_tabindex.setShortDescription(resources
331: .getString("HtmlInputSecret_tabindex_Description"));
332: prop_tabindex
333: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
334: prop_tabindex.setExpert(false);
335: prop_tabindex.setHidden(false);
336: prop_tabindex.setPreferred(false);
337: attrib = new AttributeDescriptor("tabindex", false, null,
338: true);
339: prop_tabindex.setValue(
340: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
341: attrib);
342: prop_tabindex
343: .setValue(
344: Constants.PropertyDescriptor.CATEGORY,
345: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
346: prop_tabindex.setValue("maxValue", new Integer(
347: Short.MAX_VALUE));
348: prop_tabindex.setValue("minValue", new Integer(0));
349:
350: PropertyDescriptor prop_title = new PropertyDescriptorBase(
351: "title", beanClass, "getTitle", "setTitle");
352: prop_title.setDisplayName(resources
353: .getString("HtmlInputSecret_title_DisplayName"));
354: prop_title.setShortDescription(resources
355: .getString("HtmlInputSecret_title_Description"));
356: prop_title.setExpert(false);
357: prop_title.setHidden(false);
358: prop_title.setPreferred(false);
359: attrib = new AttributeDescriptor("title", false, null, true);
360: prop_title.setValue(
361: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
362: attrib);
363: prop_title
364: .setValue(
365: Constants.PropertyDescriptor.CATEGORY,
366: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
367:
368: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
369: propertyDescriptorList.add(prop_accesskey);
370: propertyDescriptorList.add(prop_alt);
371: propertyDescriptorList.add(prop_dir);
372: propertyDescriptorList.add(prop_disabled);
373: propertyDescriptorList.add(prop_lang);
374: propertyDescriptorList.add(prop_maxlength);
375: propertyDescriptorList.add(prop_readonly);
376: propertyDescriptorList.add(prop_redisplay);
377: propertyDescriptorList.add(prop_size);
378: propertyDescriptorList.add(prop_tabindex);
379: propertyDescriptorList.add(prop_title);
380:
381: propertyDescriptorList.addAll(Properties
382: .getVisualPropertyList(beanClass));
383: propertyDescriptorList.addAll(Properties
384: .getKeyEventPropertyList(beanClass));
385: propertyDescriptorList.addAll(Properties
386: .getMouseEventPropertyList(beanClass));
387: propertyDescriptorList.addAll(Properties
388: .getClickEventPropertyList(beanClass));
389: propertyDescriptorList.addAll(Properties
390: .getFocusEventPropertyList(beanClass));
391: propertyDescriptorList.addAll(Properties
392: .getSelectEventPropertyList(beanClass));
393: propertyDescriptorList.addAll(Properties
394: .getChangeEventPropertyList(beanClass));
395: propertyDescriptorList.addAll(Arrays.asList(super
396: .getPropertyDescriptors()));
397: propertyDescriptors = propertyDescriptorList
398: .toArray(new PropertyDescriptor[propertyDescriptorList
399: .size()]);
400: return propertyDescriptors;
401:
402: } catch (IntrospectionException e) {
403: e.printStackTrace();
404: return null;
405: }
406:
407: }
408:
409: }
|