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 HtmlSelectManyMenuBeanInfo 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: HtmlSelectManyMenuBeanInfo.class.getClassLoader());
068:
069: public HtmlSelectManyMenuBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlSelectManyMenu.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectManyMenu_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectManyMenu_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectManyMenu_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlSelectManyMenu_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("HtmlSelectManyMenu_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlSelectManyMenu_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
097: .setValue(Constants.BeanDescriptor.HELP_KEY,
098: "projrave_ui_elements_palette_jsfstd_multi-select_menu");
099: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
100: "menu");
101: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
102: Boolean.TRUE);
103: beanDescriptor
104: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
105: "projrave_ui_elements_propsheets_jsfstd_multi-select_menu_props");
106: beanDescriptor.setValue(
107: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
108: getCategoryDescriptors());
109: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
110: "selectManyMenu");
111: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
112: "h");
113: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
114: "http://java.sun.com/jsf/html");
115:
116: return beanDescriptor;
117:
118: }
119:
120: private PropertyDescriptor[] propertyDescriptors;
121:
122: public PropertyDescriptor[] getPropertyDescriptors() {
123:
124: if (propertyDescriptors != null) {
125: return propertyDescriptors;
126: }
127: AttributeDescriptor attrib = null;
128:
129: try {
130:
131: PropertyDescriptor prop_accesskey = new PropertyDescriptorBase(
132: "accesskey", beanClass, "getAccesskey",
133: "setAccesskey");
134: prop_accesskey
135: .setDisplayName(resources
136: .getString("HtmlSelectManyMenu_accesskey_DisplayName"));
137: prop_accesskey
138: .setShortDescription(resources
139: .getString("HtmlSelectManyMenu_accesskey_Description"));
140: prop_accesskey.setExpert(false);
141: prop_accesskey.setHidden(false);
142: prop_accesskey.setPreferred(false);
143: attrib = new AttributeDescriptor("accesskey", false, null,
144: true);
145: prop_accesskey.setValue(
146: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
147: attrib);
148: prop_accesskey
149: .setValue(
150: Constants.PropertyDescriptor.CATEGORY,
151: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
152:
153: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
154: "dir", beanClass, "getDir", "setDir");
155: prop_dir.setDisplayName(resources
156: .getString("HtmlSelectManyMenu_dir_DisplayName"));
157: prop_dir.setShortDescription(resources
158: .getString("HtmlSelectManyMenu_dir_Description"));
159: prop_dir
160: .setPropertyEditorClass(SelectOneDomainEditor.class);
161: prop_dir.setExpert(false);
162: prop_dir.setHidden(false);
163: prop_dir.setPreferred(false);
164: attrib = new AttributeDescriptor("dir", false, null, true);
165: prop_dir.setValue(
166: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
167: attrib);
168: prop_dir
169: .setValue(
170: Constants.PropertyDescriptor.CATEGORY,
171: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
172: prop_dir.setValue(DomainPropertyEditor.DOMAIN_CLASS,
173: TextDirectionDomain.class);
174:
175: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
176: "disabled", beanClass, "isDisabled", "setDisabled");
177: prop_disabled
178: .setDisplayName(resources
179: .getString("HtmlSelectManyMenu_disabled_DisplayName"));
180: prop_disabled
181: .setShortDescription(resources
182: .getString("HtmlSelectManyMenu_disabled_Description"));
183: prop_disabled.setExpert(false);
184: prop_disabled.setHidden(false);
185: prop_disabled.setPreferred(false);
186: attrib = new AttributeDescriptor("disabled", false, null,
187: true);
188: prop_disabled.setValue(
189: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
190: attrib);
191: prop_disabled
192: .setValue(
193: Constants.PropertyDescriptor.CATEGORY,
194: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
195:
196: PropertyDescriptor prop_disabledClass = new PropertyDescriptorBase(
197: "disabledClass", beanClass, "getDisabledClass",
198: "setDisabledClass");
199: prop_disabledClass
200: .setDisplayName(resources
201: .getString("HtmlSelectManyMenu_disabledClass_DisplayName"));
202: prop_disabledClass
203: .setShortDescription(resources
204: .getString("HtmlSelectManyMenu_disabledClass_Description"));
205: prop_disabledClass.setExpert(false);
206: prop_disabledClass.setHidden(false);
207: prop_disabledClass.setPreferred(false);
208: attrib = new AttributeDescriptor("disabledClass", false,
209: null, true);
210: prop_disabledClass.setValue(
211: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
212: attrib);
213: prop_disabledClass
214: .setValue(
215: Constants.PropertyDescriptor.CATEGORY,
216: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
217:
218: PropertyDescriptor prop_enabledClass = new PropertyDescriptorBase(
219: "enabledClass", beanClass, "getEnabledClass",
220: "setEnabledClass");
221: prop_enabledClass
222: .setDisplayName(resources
223: .getString("HtmlSelectManyMenu_enabledClass_DisplayName"));
224: prop_enabledClass
225: .setShortDescription(resources
226: .getString("HtmlSelectManyMenu_enabledClass_Description"));
227: prop_enabledClass.setExpert(false);
228: prop_enabledClass.setHidden(false);
229: prop_enabledClass.setPreferred(false);
230: attrib = new AttributeDescriptor("enabledClass", false,
231: null, true);
232: prop_enabledClass.setValue(
233: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
234: attrib);
235: prop_enabledClass
236: .setValue(
237: Constants.PropertyDescriptor.CATEGORY,
238: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
239:
240: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
241: "lang", beanClass, "getLang", "setLang");
242: prop_lang.setDisplayName(resources
243: .getString("HtmlSelectManyMenu_lang_DisplayName"));
244: prop_lang.setShortDescription(resources
245: .getString("HtmlSelectManyMenu_lang_Description"));
246: prop_lang
247: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
248: prop_lang.setExpert(false);
249: prop_lang.setHidden(false);
250: prop_lang.setPreferred(false);
251: attrib = new AttributeDescriptor("lang", false, null, true);
252: prop_lang.setValue(
253: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
254: attrib);
255: prop_lang
256: .setValue(
257: Constants.PropertyDescriptor.CATEGORY,
258: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
259: prop_lang
260: .setValue(
261: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
262: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
263:
264: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
265: "readonly", beanClass, "isReadonly", "setReadonly");
266: prop_readonly
267: .setDisplayName(resources
268: .getString("HtmlSelectManyMenu_readonly_DisplayName"));
269: prop_readonly
270: .setShortDescription(resources
271: .getString("HtmlSelectManyMenu_readonly_Description"));
272: prop_readonly.setExpert(false);
273: prop_readonly.setHidden(false);
274: prop_readonly.setPreferred(false);
275: attrib = new AttributeDescriptor("readonly", false, null,
276: true);
277: prop_readonly.setValue(
278: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
279: attrib);
280: prop_readonly
281: .setValue(
282: Constants.PropertyDescriptor.CATEGORY,
283: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
284:
285: PropertyDescriptor prop_selectedValues = new PropertyDescriptorBase(
286: "selectedValues", beanClass, "getSelectedValues",
287: "setSelectedValues");
288: prop_selectedValues
289: .setDisplayName(resources
290: .getString("HtmlSelectManyMenu_selectedValues_DisplayName"));
291: prop_selectedValues
292: .setShortDescription(resources
293: .getString("HtmlSelectManyMenu_selectedValues_Description"));
294: prop_selectedValues.setExpert(false);
295: prop_selectedValues.setHidden(false);
296: prop_selectedValues.setPreferred(false);
297: prop_selectedValues
298: .setValue(
299: Constants.PropertyDescriptor.CATEGORY,
300: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
301:
302: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
303: "tabindex", beanClass, "getTabindex", "setTabindex");
304: prop_tabindex
305: .setDisplayName(resources
306: .getString("HtmlSelectManyMenu_tabindex_DisplayName"));
307: prop_tabindex
308: .setShortDescription(resources
309: .getString("HtmlSelectManyMenu_tabindex_Description"));
310: prop_tabindex
311: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
312: prop_tabindex.setExpert(false);
313: prop_tabindex.setHidden(false);
314: prop_tabindex.setPreferred(false);
315: attrib = new AttributeDescriptor("tabindex", false, null,
316: true);
317: prop_tabindex.setValue(
318: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
319: attrib);
320: prop_tabindex
321: .setValue(
322: Constants.PropertyDescriptor.CATEGORY,
323: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
324: prop_tabindex.setValue("maxValue", new Integer(
325: Short.MAX_VALUE));
326: prop_tabindex.setValue("minValue", new Integer(0));
327:
328: PropertyDescriptor prop_title = new PropertyDescriptorBase(
329: "title", beanClass, "getTitle", "setTitle");
330: prop_title.setDisplayName(resources
331: .getString("HtmlSelectManyMenu_title_DisplayName"));
332: prop_title.setShortDescription(resources
333: .getString("HtmlSelectManyMenu_title_Description"));
334: prop_title.setExpert(false);
335: prop_title.setHidden(false);
336: prop_title.setPreferred(false);
337: attrib = new AttributeDescriptor("title", false, null, true);
338: prop_title.setValue(
339: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
340: attrib);
341: prop_title
342: .setValue(
343: Constants.PropertyDescriptor.CATEGORY,
344: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
345:
346: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
347: propertyDescriptorList.add(prop_accesskey);
348: propertyDescriptorList.add(prop_dir);
349: propertyDescriptorList.add(prop_disabled);
350: propertyDescriptorList.add(prop_disabledClass);
351: propertyDescriptorList.add(prop_enabledClass);
352: propertyDescriptorList.add(prop_lang);
353: propertyDescriptorList.add(prop_readonly);
354: propertyDescriptorList.add(prop_selectedValues);
355: propertyDescriptorList.add(prop_tabindex);
356: propertyDescriptorList.add(prop_title);
357:
358: propertyDescriptorList.addAll(Properties
359: .getVisualPropertyList(beanClass));
360: propertyDescriptorList.addAll(Properties
361: .getKeyEventPropertyList(beanClass));
362: propertyDescriptorList.addAll(Properties
363: .getMouseEventPropertyList(beanClass));
364: propertyDescriptorList.addAll(Properties
365: .getClickEventPropertyList(beanClass));
366: propertyDescriptorList.addAll(Properties
367: .getFocusEventPropertyList(beanClass));
368: propertyDescriptorList.addAll(Properties
369: .getSelectEventPropertyList(beanClass));
370: propertyDescriptorList.addAll(Properties
371: .getChangeEventPropertyList(beanClass));
372: propertyDescriptorList.addAll(Arrays.asList(super
373: .getPropertyDescriptors()));
374: propertyDescriptors = propertyDescriptorList
375: .toArray(new PropertyDescriptor[propertyDescriptorList
376: .size()]);
377: return propertyDescriptors;
378:
379: } catch (IntrospectionException e) {
380: e.printStackTrace();
381: return null;
382: }
383:
384: }
385:
386: }
|