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 com.sun.rave.propertyeditors.domains.InputComponentIdsDomain;
045: import java.beans.BeanDescriptor;
046: import java.beans.IntrospectionException;
047: import java.beans.PropertyDescriptor;
048: import java.util.Locale;
049: import java.util.List;
050: import java.util.ArrayList;
051: import java.util.Arrays;
052: import java.util.ResourceBundle;
053: import com.sun.rave.designtime.Constants;
054: import com.sun.rave.designtime.markup.AttributeDescriptor;
055: import com.sun.rave.propertyeditors.DomainPropertyEditor;
056: import com.sun.rave.propertyeditors.SelectOneDomainEditor;
057: import com.sun.rave.propertyeditors.domains.TextDirectionDomain;
058: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
059: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
060: import org.netbeans.modules.visualweb.faces.dt_1_1.component.UIOutputBeanInfoBase;
061:
062: public class HtmlOutputLabelBeanInfo extends UIOutputBeanInfoBase {
063:
064: protected static ResourceBundle resources = ResourceBundle
065: .getBundle(
066: "org.netbeans.modules.visualweb.faces.dt_1_1.component.html.Bundle-JSF",
067: Locale.getDefault(), HtmlOutputLabelBeanInfo.class
068: .getClassLoader());
069:
070: public HtmlOutputLabelBeanInfo() {
071: beanClass = javax.faces.component.html.HtmlOutputLabel.class;
072: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputLabel_C16";
073: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputLabel_C32";
074: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputLabel_M16";
075: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputLabel_M32";
076: }
077:
078: private BeanDescriptor beanDescriptor;
079:
080: public BeanDescriptor getBeanDescriptor() {
081:
082: if (beanDescriptor != null) {
083: return beanDescriptor;
084: }
085:
086: beanDescriptor = new BeanDescriptorBase(beanClass);
087: beanDescriptor.setDisplayName(resources
088: .getString("HtmlOutputLabel_DisplayName"));
089: beanDescriptor.setShortDescription(resources
090: .getString("HtmlOutputLabel_Description"));
091: beanDescriptor.setExpert(false);
092: beanDescriptor.setHidden(false);
093: beanDescriptor.setPreferred(false);
094: beanDescriptor.setValue(
095: Constants.BeanDescriptor.FACET_DESCRIPTORS,
096: getFacetDescriptors());
097: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
098: "projrave_ui_elements_palette_jsfstd_component_label");
099: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
100: "componentLabel");
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_component_label_props");
106: beanDescriptor.setValue(
107: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
108: getCategoryDescriptors());
109: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
110: "outputLabel");
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("HtmlOutputLabel_accesskey_DisplayName"));
137: prop_accesskey
138: .setShortDescription(resources
139: .getString("HtmlOutputLabel_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("HtmlOutputLabel_dir_DisplayName"));
157: prop_dir.setShortDescription(resources
158: .getString("HtmlOutputLabel_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_for = new PropertyDescriptorBase(
176: "for", beanClass, "getFor", "setFor");
177: prop_for.setDisplayName(resources
178: .getString("HtmlOutputLabel_for_DisplayName"));
179: prop_for.setShortDescription(resources
180: .getString("HtmlOutputLabel_for_Description"));
181: prop_for
182: .setPropertyEditorClass(SelectOneDomainEditor.class);
183: prop_for.setExpert(false);
184: prop_for.setHidden(false);
185: prop_for.setPreferred(false);
186: attrib = new AttributeDescriptor("for", false, null, true);
187: prop_for.setValue(
188: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
189: attrib);
190: prop_for
191: .setValue(
192: Constants.PropertyDescriptor.CATEGORY,
193: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
194: prop_for.setValue(DomainPropertyEditor.DOMAIN_CLASS,
195: InputComponentIdsDomain.class);
196: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
197: "lang", beanClass, "getLang", "setLang");
198: prop_lang.setDisplayName(resources
199: .getString("HtmlOutputLabel_lang_DisplayName"));
200: prop_lang.setShortDescription(resources
201: .getString("HtmlOutputLabel_lang_Description"));
202: prop_lang
203: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
204: prop_lang.setExpert(false);
205: prop_lang.setHidden(false);
206: prop_lang.setPreferred(false);
207: attrib = new AttributeDescriptor("lang", false, null, true);
208: prop_lang.setValue(
209: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
210: attrib);
211: prop_lang
212: .setValue(
213: Constants.PropertyDescriptor.CATEGORY,
214: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
215: prop_lang
216: .setValue(
217: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
218: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
219:
220: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
221: "tabindex", beanClass, "getTabindex", "setTabindex");
222: prop_tabindex.setDisplayName(resources
223: .getString("HtmlOutputLabel_tabindex_DisplayName"));
224: prop_tabindex.setShortDescription(resources
225: .getString("HtmlOutputLabel_tabindex_Description"));
226: prop_tabindex
227: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
228: prop_tabindex.setExpert(false);
229: prop_tabindex.setHidden(false);
230: prop_tabindex.setPreferred(false);
231: attrib = new AttributeDescriptor("tabindex", false, null,
232: true);
233: prop_tabindex.setValue(
234: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
235: attrib);
236: prop_tabindex
237: .setValue(
238: Constants.PropertyDescriptor.CATEGORY,
239: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
240: prop_tabindex.setValue("maxValue", new Integer(
241: Short.MAX_VALUE));
242: prop_tabindex.setValue("minValue", new Integer(0));
243:
244: PropertyDescriptor prop_title = new PropertyDescriptorBase(
245: "title", beanClass, "getTitle", "setTitle");
246: prop_title.setDisplayName(resources
247: .getString("HtmlOutputLabel_title_DisplayName"));
248: prop_title.setShortDescription(resources
249: .getString("HtmlOutputLabel_title_Description"));
250: prop_title.setExpert(false);
251: prop_title.setHidden(false);
252: prop_title.setPreferred(false);
253: attrib = new AttributeDescriptor("title", false, null, true);
254: prop_title.setValue(
255: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
256: attrib);
257: prop_title
258: .setValue(
259: Constants.PropertyDescriptor.CATEGORY,
260: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
261:
262: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
263: propertyDescriptorList.add(prop_accesskey);
264: propertyDescriptorList.add(prop_dir);
265: propertyDescriptorList.add(prop_for);
266: propertyDescriptorList.add(prop_lang);
267: propertyDescriptorList.add(prop_tabindex);
268: propertyDescriptorList.add(prop_title);
269:
270: propertyDescriptorList.addAll(Properties
271: .getVisualPropertyList(beanClass));
272: propertyDescriptorList.addAll(Properties
273: .getKeyEventPropertyList(beanClass));
274: propertyDescriptorList.addAll(Properties
275: .getMouseEventPropertyList(beanClass));
276: propertyDescriptorList.addAll(Properties
277: .getClickEventPropertyList(beanClass));
278: propertyDescriptorList.addAll(Properties
279: .getFocusEventPropertyList(beanClass));
280: propertyDescriptorList.addAll(Arrays.asList(super
281: .getPropertyDescriptors()));
282: propertyDescriptors = propertyDescriptorList
283: .toArray(new PropertyDescriptor[propertyDescriptorList
284: .size()]);
285: return propertyDescriptors;
286:
287: } catch (IntrospectionException e) {
288: e.printStackTrace();
289: return null;
290: }
291:
292: }
293:
294: }
|