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 HtmlSelectOneMenuBeanInfo 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: HtmlSelectOneMenuBeanInfo.class.getClassLoader());
068:
069: public HtmlSelectOneMenuBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlSelectOneMenu.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneMenu_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneMenu_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneMenu_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectOneMenu_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("HtmlSelectOneMenu_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlSelectOneMenu_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_dropdown_list");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "dropdown");
100: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
101: Boolean.TRUE);
102: beanDescriptor
103: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
104: "projrave_ui_elements_propsheets_jsfstd_dropdown_list_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "selectOneMenu");
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("HtmlSelectOneMenu_accesskey_DisplayName"));
136: prop_accesskey
137: .setShortDescription(resources
138: .getString("HtmlSelectOneMenu_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_dir = new PropertyDescriptorBase(
153: "dir", beanClass, "getDir", "setDir");
154: prop_dir.setDisplayName(resources
155: .getString("HtmlSelectOneMenu_dir_DisplayName"));
156: prop_dir.setShortDescription(resources
157: .getString("HtmlSelectOneMenu_dir_Description"));
158: prop_dir
159: .setPropertyEditorClass(SelectOneDomainEditor.class);
160: prop_dir.setExpert(false);
161: prop_dir.setHidden(false);
162: prop_dir.setPreferred(false);
163: attrib = new AttributeDescriptor("dir", false, null, true);
164: prop_dir.setValue(
165: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
166: attrib);
167: prop_dir
168: .setValue(
169: Constants.PropertyDescriptor.CATEGORY,
170: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
171: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
172: TextDirectionDomain.class);
173:
174: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
175: "disabled", beanClass, "isDisabled", "setDisabled");
176: prop_disabled
177: .setDisplayName(resources
178: .getString("HtmlSelectOneMenu_disabled_DisplayName"));
179: prop_disabled
180: .setShortDescription(resources
181: .getString("HtmlSelectOneMenu_disabled_Description"));
182: prop_disabled.setExpert(false);
183: prop_disabled.setHidden(false);
184: prop_disabled.setPreferred(false);
185: attrib = new AttributeDescriptor("disabled", false, null,
186: true);
187: prop_disabled.setValue(
188: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
189: attrib);
190: prop_disabled
191: .setValue(
192: Constants.PropertyDescriptor.CATEGORY,
193: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
194:
195: PropertyDescriptor prop_disabledClass = new PropertyDescriptorBase(
196: "disabledClass", beanClass, "getDisabledClass",
197: "setDisabledClass");
198: prop_disabledClass
199: .setDisplayName(resources
200: .getString("HtmlSelectOneMenu_disabledClass_DisplayName"));
201: prop_disabledClass
202: .setShortDescription(resources
203: .getString("HtmlSelectOneMenu_disabledClass_Description"));
204: prop_disabledClass.setExpert(false);
205: prop_disabledClass.setHidden(false);
206: prop_disabledClass.setPreferred(false);
207: attrib = new AttributeDescriptor("disabledClass", false,
208: null, true);
209: prop_disabledClass.setValue(
210: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
211: attrib);
212: prop_disabledClass
213: .setValue(
214: Constants.PropertyDescriptor.CATEGORY,
215: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
216:
217: PropertyDescriptor prop_enabledClass = new PropertyDescriptorBase(
218: "enabledClass", beanClass, "getEnabledClass",
219: "setEnabledClass");
220: prop_enabledClass
221: .setDisplayName(resources
222: .getString("HtmlSelectOneMenu_enabledClass_DisplayName"));
223: prop_enabledClass
224: .setShortDescription(resources
225: .getString("HtmlSelectOneMenu_enabledClass_Description"));
226: prop_enabledClass.setExpert(false);
227: prop_enabledClass.setHidden(false);
228: prop_enabledClass.setPreferred(false);
229: attrib = new AttributeDescriptor("enabledClass", false,
230: null, true);
231: prop_enabledClass.setValue(
232: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
233: attrib);
234: prop_enabledClass
235: .setValue(
236: Constants.PropertyDescriptor.CATEGORY,
237: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
238:
239: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
240: "lang", beanClass, "getLang", "setLang");
241: prop_lang.setDisplayName(resources
242: .getString("HtmlSelectOneMenu_lang_DisplayName"));
243: prop_lang.setShortDescription(resources
244: .getString("HtmlSelectOneMenu_lang_Description"));
245: prop_lang
246: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
247: prop_lang.setExpert(false);
248: prop_lang.setHidden(false);
249: prop_lang.setPreferred(false);
250: attrib = new AttributeDescriptor("lang", false, null, true);
251: prop_lang.setValue(
252: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
253: attrib);
254: prop_lang
255: .setValue(
256: Constants.PropertyDescriptor.CATEGORY,
257: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
258: prop_lang
259: .setValue(
260: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
261: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
262:
263: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
264: "readonly", beanClass, "isReadonly", "setReadonly");
265: prop_readonly
266: .setDisplayName(resources
267: .getString("HtmlSelectOneMenu_readonly_DisplayName"));
268: prop_readonly
269: .setShortDescription(resources
270: .getString("HtmlSelectOneMenu_readonly_Description"));
271: prop_readonly.setExpert(false);
272: prop_readonly.setHidden(false);
273: prop_readonly.setPreferred(false);
274: attrib = new AttributeDescriptor("readonly", false, null,
275: true);
276: prop_readonly.setValue(
277: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
278: attrib);
279: prop_readonly
280: .setValue(
281: Constants.PropertyDescriptor.CATEGORY,
282: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
283:
284: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
285: "tabindex", beanClass, "getTabindex", "setTabindex");
286: prop_tabindex
287: .setDisplayName(resources
288: .getString("HtmlSelectOneMenu_tabindex_DisplayName"));
289: prop_tabindex
290: .setShortDescription(resources
291: .getString("HtmlSelectOneMenu_tabindex_Description"));
292: prop_tabindex
293: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
294: prop_tabindex.setExpert(false);
295: prop_tabindex.setHidden(false);
296: prop_tabindex.setPreferred(false);
297: attrib = new AttributeDescriptor("tabindex", false, null,
298: true);
299: prop_tabindex.setValue(
300: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
301: attrib);
302: prop_tabindex
303: .setValue(
304: Constants.PropertyDescriptor.CATEGORY,
305: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
306: prop_tabindex.setValue("maxValue", new Integer(
307: Short.MAX_VALUE));
308: prop_tabindex.setValue("minValue", new Integer(0));
309:
310: PropertyDescriptor prop_title = new PropertyDescriptorBase(
311: "title", beanClass, "getTitle", "setTitle");
312: prop_title.setDisplayName(resources
313: .getString("HtmlSelectOneMenu_title_DisplayName"));
314: prop_title.setShortDescription(resources
315: .getString("HtmlSelectOneMenu_title_Description"));
316: prop_title.setExpert(false);
317: prop_title.setHidden(false);
318: prop_title.setPreferred(false);
319: attrib = new AttributeDescriptor("title", false, null, true);
320: prop_title.setValue(
321: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
322: attrib);
323: prop_title
324: .setValue(
325: Constants.PropertyDescriptor.CATEGORY,
326: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
327:
328: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
329: propertyDescriptorList.add(prop_accesskey);
330: propertyDescriptorList.add(prop_dir);
331: propertyDescriptorList.add(prop_disabled);
332: propertyDescriptorList.add(prop_disabledClass);
333: propertyDescriptorList.add(prop_enabledClass);
334: propertyDescriptorList.add(prop_lang);
335: propertyDescriptorList.add(prop_readonly);
336: propertyDescriptorList.add(prop_tabindex);
337: propertyDescriptorList.add(prop_title);
338:
339: propertyDescriptorList.addAll(Properties
340: .getVisualPropertyList(beanClass));
341: propertyDescriptorList.addAll(Properties
342: .getKeyEventPropertyList(beanClass));
343: propertyDescriptorList.addAll(Properties
344: .getMouseEventPropertyList(beanClass));
345: propertyDescriptorList.addAll(Properties
346: .getClickEventPropertyList(beanClass));
347: propertyDescriptorList.addAll(Properties
348: .getFocusEventPropertyList(beanClass));
349: propertyDescriptorList.addAll(Properties
350: .getSelectEventPropertyList(beanClass));
351: propertyDescriptorList.addAll(Properties
352: .getChangeEventPropertyList(beanClass));
353: propertyDescriptorList.addAll(Arrays.asList(super
354: .getPropertyDescriptors()));
355: propertyDescriptors = propertyDescriptorList
356: .toArray(new PropertyDescriptor[propertyDescriptorList
357: .size()]);
358: return propertyDescriptors;
359:
360: } catch (IntrospectionException e) {
361: e.printStackTrace();
362: return null;
363: }
364:
365: }
366:
367: }
|