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: import com.sun.rave.designtime.Constants;
053: import com.sun.rave.designtime.markup.AttributeDescriptor;
054: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
055: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
056: import org.netbeans.modules.visualweb.faces.dt_1_2.component.UIOutputBeanInfoBase;
057:
058: public class HtmlOutputLabelBeanInfo extends UIOutputBeanInfoBase {
059:
060: protected static ResourceBundle resources = ResourceBundle
061: .getBundle(
062: "org.netbeans.modules.visualweb.faces.dt_1_2.component.html.Bundle-JSF",
063: Locale.getDefault(), HtmlOutputLabelBeanInfo.class
064: .getClassLoader());
065:
066: public HtmlOutputLabelBeanInfo() {
067: beanClass = javax.faces.component.html.HtmlOutputLabel.class;
068: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlOutputLabel_C16";
069: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlOutputLabel_C32";
070: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlOutputLabel_M16";
071: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlOutputLabel_M32";
072: }
073:
074: private BeanDescriptor beanDescriptor;
075:
076: public BeanDescriptor getBeanDescriptor() {
077:
078: if (beanDescriptor != null) {
079: return beanDescriptor;
080: }
081:
082: beanDescriptor = new BeanDescriptorBase(beanClass);
083: beanDescriptor.setDisplayName(resources
084: .getString("HtmlOutputLabel_DisplayName"));
085: beanDescriptor.setShortDescription(resources
086: .getString("HtmlOutputLabel_Description"));
087: beanDescriptor.setExpert(false);
088: beanDescriptor.setHidden(false);
089: beanDescriptor.setPreferred(false);
090: beanDescriptor.setValue(
091: Constants.BeanDescriptor.FACET_DESCRIPTORS,
092: getFacetDescriptors());
093: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
094: "projrave_ui_elements_palette_jsfstd_component_label");
095: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
096: "componentLabel");
097: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
098: Boolean.TRUE);
099: beanDescriptor
100: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
101: "projrave_ui_elements_propsheets_jsfstd_component_label_props");
102: beanDescriptor.setValue(
103: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
104: getCategoryDescriptors());
105: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
106: "outputLabel");
107: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
108: "h");
109: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
110: "http://java.sun.com/jsf/html");
111:
112: return beanDescriptor;
113:
114: }
115:
116: private PropertyDescriptor[] propertyDescriptors;
117:
118: public PropertyDescriptor[] getPropertyDescriptors() {
119:
120: if (propertyDescriptors != null) {
121: return propertyDescriptors;
122: }
123: AttributeDescriptor attrib = null;
124:
125: try {
126:
127: PropertyDescriptor prop_accesskey = new PropertyDescriptorBase(
128: "accesskey", beanClass, "getAccesskey",
129: "setAccesskey");
130: prop_accesskey
131: .setDisplayName(resources
132: .getString("HtmlOutputLabel_accesskey_DisplayName"));
133: prop_accesskey
134: .setShortDescription(resources
135: .getString("HtmlOutputLabel_accesskey_Description"));
136: prop_accesskey.setExpert(false);
137: prop_accesskey.setHidden(false);
138: prop_accesskey.setPreferred(false);
139: attrib = new AttributeDescriptor("accesskey", false, null,
140: true);
141: prop_accesskey.setValue(
142: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
143: attrib);
144: prop_accesskey
145: .setValue(
146: Constants.PropertyDescriptor.CATEGORY,
147: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
148:
149: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
150: "dir", beanClass, "getDir", "setDir");
151: prop_dir.setDisplayName(resources
152: .getString("HtmlOutputLabel_dir_DisplayName"));
153: prop_dir.setShortDescription(resources
154: .getString("HtmlOutputLabel_dir_Description"));
155: prop_dir
156: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
157: prop_dir.setExpert(false);
158: prop_dir.setHidden(false);
159: prop_dir.setPreferred(false);
160: attrib = new AttributeDescriptor("dir", false, null, true);
161: prop_dir.setValue(
162: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
163: attrib);
164: prop_dir
165: .setValue(
166: Constants.PropertyDescriptor.CATEGORY,
167: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
168: prop_dir
169: .setValue(
170: com.sun.rave.propertyeditors.DomainPropertyEditor.DOMAIN_CLASS,
171: com.sun.rave.propertyeditors.domains.TextDirectionDomain.class);
172:
173: PropertyDescriptor prop_for = new PropertyDescriptorBase(
174: "for", beanClass, "getFor", "setFor");
175: prop_for.setDisplayName(resources
176: .getString("HtmlOutputLabel_for_DisplayName"));
177: prop_for.setShortDescription(resources
178: .getString("HtmlOutputLabel_for_Description"));
179: prop_for
180: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
181: prop_for.setExpert(false);
182: prop_for.setHidden(false);
183: prop_for.setPreferred(false);
184: attrib = new AttributeDescriptor("for", false, null, true);
185: prop_for.setValue(
186: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
187: attrib);
188: prop_for
189: .setValue(
190: Constants.PropertyDescriptor.CATEGORY,
191: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
192: prop_for
193: .setValue(
194: com.sun.rave.propertyeditors.DomainPropertyEditor.DOMAIN_CLASS,
195: com.sun.rave.propertyeditors.domains.InputComponentIdsDomain.class);
196:
197: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
198: "lang", beanClass, "getLang", "setLang");
199: prop_lang.setDisplayName(resources
200: .getString("HtmlOutputLabel_lang_DisplayName"));
201: prop_lang.setShortDescription(resources
202: .getString("HtmlOutputLabel_lang_Description"));
203: prop_lang
204: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
205: prop_lang.setExpert(false);
206: prop_lang.setHidden(false);
207: prop_lang.setPreferred(false);
208: attrib = new AttributeDescriptor("lang", false, null, true);
209: prop_lang.setValue(
210: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
211: attrib);
212: prop_lang
213: .setValue(
214: Constants.PropertyDescriptor.CATEGORY,
215: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
216: prop_lang
217: .setValue(
218: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
219: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
220:
221: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
222: "tabindex", beanClass, "getTabindex", "setTabindex");
223: prop_tabindex.setDisplayName(resources
224: .getString("HtmlOutputLabel_tabindex_DisplayName"));
225: prop_tabindex.setShortDescription(resources
226: .getString("HtmlOutputLabel_tabindex_Description"));
227: prop_tabindex
228: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
229: prop_tabindex.setExpert(false);
230: prop_tabindex.setHidden(false);
231: prop_tabindex.setPreferred(false);
232: attrib = new AttributeDescriptor("tabindex", false, null,
233: true);
234: prop_tabindex.setValue(
235: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
236: attrib);
237: prop_tabindex
238: .setValue(
239: Constants.PropertyDescriptor.CATEGORY,
240: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
241: prop_tabindex.setValue("maxValue", new Integer(
242: Short.MAX_VALUE));
243: prop_tabindex.setValue("minValue", new Integer(0));
244:
245: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
246: propertyDescriptorList.add(prop_accesskey);
247: propertyDescriptorList.add(prop_dir);
248: propertyDescriptorList.add(prop_for);
249: propertyDescriptorList.add(prop_lang);
250: propertyDescriptorList.add(prop_tabindex);
251:
252: propertyDescriptorList.addAll(Properties
253: .getVisualPropertyList(beanClass));
254: propertyDescriptorList.addAll(Properties
255: .getKeyEventPropertyList(beanClass));
256: propertyDescriptorList.addAll(Properties
257: .getMouseEventPropertyList(beanClass));
258: propertyDescriptorList.addAll(Properties
259: .getClickEventPropertyList(beanClass));
260: propertyDescriptorList.addAll(Properties
261: .getFocusEventPropertyList(beanClass));
262: propertyDescriptorList.addAll(Arrays.asList(super
263: .getPropertyDescriptors()));
264: propertyDescriptors = propertyDescriptorList
265: .toArray(new PropertyDescriptor[propertyDescriptorList
266: .size()]);
267: return propertyDescriptors;
268:
269: } catch (IntrospectionException e) {
270: e.printStackTrace();
271: return null;
272: }
273:
274: }
275:
276: }
|