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 HtmlSelectManyMenuBeanInfo 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: 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_2/component/html/HtmlSelectManyMenu_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectManyMenu_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlSelectManyMenu_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/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_disabled = new PropertyDescriptorBase(
154: "disabled", beanClass, "isDisabled", "setDisabled");
155: prop_disabled
156: .setDisplayName(resources
157: .getString("HtmlSelectManyMenu_disabled_DisplayName"));
158: prop_disabled
159: .setShortDescription(resources
160: .getString("HtmlSelectManyMenu_disabled_Description"));
161: prop_disabled.setExpert(false);
162: prop_disabled.setHidden(false);
163: prop_disabled.setPreferred(false);
164: attrib = new AttributeDescriptor("disabled", false, null,
165: true);
166: prop_disabled.setValue(
167: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
168: attrib);
169: prop_disabled
170: .setValue(
171: Constants.PropertyDescriptor.CATEGORY,
172: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
173:
174: PropertyDescriptor prop_disabledClass = new PropertyDescriptorBase(
175: "disabledClass", beanClass, "getDisabledClass",
176: "setDisabledClass");
177: prop_disabledClass
178: .setDisplayName(resources
179: .getString("HtmlSelectManyMenu_disabledClass_DisplayName"));
180: prop_disabledClass
181: .setShortDescription(resources
182: .getString("HtmlSelectManyMenu_disabledClass_Description"));
183: prop_disabledClass.setExpert(false);
184: prop_disabledClass.setHidden(false);
185: prop_disabledClass.setPreferred(false);
186: attrib = new AttributeDescriptor("disabledClass", false,
187: null, true);
188: prop_disabledClass.setValue(
189: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
190: attrib);
191: prop_disabledClass
192: .setValue(
193: Constants.PropertyDescriptor.CATEGORY,
194: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
195:
196: PropertyDescriptor prop_enabledClass = new PropertyDescriptorBase(
197: "enabledClass", beanClass, "getEnabledClass",
198: "setEnabledClass");
199: prop_enabledClass
200: .setDisplayName(resources
201: .getString("HtmlSelectManyMenu_enabledClass_DisplayName"));
202: prop_enabledClass
203: .setShortDescription(resources
204: .getString("HtmlSelectManyMenu_enabledClass_Description"));
205: prop_enabledClass.setExpert(false);
206: prop_enabledClass.setHidden(false);
207: prop_enabledClass.setPreferred(false);
208: attrib = new AttributeDescriptor("enabledClass", false,
209: null, true);
210: prop_enabledClass.setValue(
211: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
212: attrib);
213: prop_enabledClass
214: .setValue(
215: Constants.PropertyDescriptor.CATEGORY,
216: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
217:
218: PropertyDescriptor prop_readonly = new PropertyDescriptorBase(
219: "readonly", beanClass, "isReadonly", "setReadonly");
220: prop_readonly
221: .setDisplayName(resources
222: .getString("HtmlSelectManyMenu_readonly_DisplayName"));
223: prop_readonly
224: .setShortDescription(resources
225: .getString("HtmlSelectManyMenu_readonly_Description"));
226: prop_readonly.setExpert(false);
227: prop_readonly.setHidden(false);
228: prop_readonly.setPreferred(false);
229: attrib = new AttributeDescriptor("readonly", false, null,
230: true);
231: prop_readonly.setValue(
232: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
233: attrib);
234: prop_readonly
235: .setValue(
236: Constants.PropertyDescriptor.CATEGORY,
237: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
238:
239: PropertyDescriptor prop_selectedValues = new PropertyDescriptorBase(
240: "selectedValues", beanClass, "getSelectedValues",
241: "setSelectedValues");
242: prop_selectedValues
243: .setDisplayName(resources
244: .getString("HtmlSelectManyMenu_selectedValues_DisplayName"));
245: prop_selectedValues
246: .setShortDescription(resources
247: .getString("HtmlSelectManyMenu_selectedValues_Description"));
248: prop_selectedValues.setExpert(false);
249: prop_selectedValues.setHidden(false);
250: prop_selectedValues.setPreferred(false);
251: prop_selectedValues
252: .setValue(
253: Constants.PropertyDescriptor.CATEGORY,
254: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
255:
256: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
257: "tabindex", beanClass, "getTabindex", "setTabindex");
258: prop_tabindex
259: .setDisplayName(resources
260: .getString("HtmlSelectManyMenu_tabindex_DisplayName"));
261: prop_tabindex
262: .setShortDescription(resources
263: .getString("HtmlSelectManyMenu_tabindex_Description"));
264: prop_tabindex
265: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
266: prop_tabindex.setExpert(false);
267: prop_tabindex.setHidden(false);
268: prop_tabindex.setPreferred(false);
269: attrib = new AttributeDescriptor("tabindex", false, null,
270: true);
271: prop_tabindex.setValue(
272: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
273: attrib);
274: prop_tabindex
275: .setValue(
276: Constants.PropertyDescriptor.CATEGORY,
277: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
278: prop_tabindex.setValue("maxValue", new Integer(
279: Short.MAX_VALUE));
280: prop_tabindex.setValue("minValue", new Integer(0));
281:
282: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
283: propertyDescriptorList.add(prop_accesskey);
284: propertyDescriptorList.add(prop_disabled);
285: propertyDescriptorList.add(prop_disabledClass);
286: propertyDescriptorList.add(prop_enabledClass);
287: propertyDescriptorList.add(prop_readonly);
288: propertyDescriptorList.add(prop_selectedValues);
289: propertyDescriptorList.add(prop_tabindex);
290:
291: propertyDescriptorList.addAll(Properties
292: .getVisualPropertyList(beanClass));
293: propertyDescriptorList.addAll(Properties
294: .getKeyEventPropertyList(beanClass));
295: propertyDescriptorList.addAll(Properties
296: .getMouseEventPropertyList(beanClass));
297: propertyDescriptorList.addAll(Properties
298: .getClickEventPropertyList(beanClass));
299: propertyDescriptorList.addAll(Properties
300: .getFocusEventPropertyList(beanClass));
301: propertyDescriptorList.addAll(Properties
302: .getSelectEventPropertyList(beanClass));
303: propertyDescriptorList.addAll(Properties
304: .getChangeEventPropertyList(beanClass));
305: propertyDescriptorList.addAll(Properties
306: .getInputPropertyList(beanClass));
307: propertyDescriptorList.addAll(Arrays.asList(super
308: .getPropertyDescriptors()));
309: propertyDescriptors = propertyDescriptorList
310: .toArray(new PropertyDescriptor[propertyDescriptorList
311: .size()]);
312: return propertyDescriptors;
313:
314: } catch (IntrospectionException e) {
315: e.printStackTrace();
316: return null;
317: }
318:
319: }
320:
321: }
|