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:
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_1.component.UIOutputBeanInfoBase;
060:
061: public class HtmlOutputFormatBeanInfo extends UIOutputBeanInfoBase {
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(), HtmlOutputFormatBeanInfo.class
067: .getClassLoader());
068:
069: public HtmlOutputFormatBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlOutputFormat.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputFormat_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputFormat_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputFormat_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlOutputFormat_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("HtmlOutputFormat_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlOutputFormat_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_formatted_output");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "formattedOutput");
100: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
101: Boolean.FALSE);
102: beanDescriptor
103: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
104: "projrave_ui_elements_propsheets_jsfstd_formatted_output_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "outputFormat");
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_escape = new PropertyDescriptorBase(
131: "escape", beanClass, "isEscape", "setEscape");
132: prop_escape.setDisplayName(resources
133: .getString("HtmlOutputFormat_escape_DisplayName"));
134: prop_escape.setShortDescription(resources
135: .getString("HtmlOutputFormat_escape_Description"));
136: prop_escape.setExpert(false);
137: prop_escape.setHidden(false);
138: prop_escape.setPreferred(false);
139: attrib = new AttributeDescriptor("escape", false, "true",
140: true);
141: prop_escape.setValue(
142: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
143: attrib);
144: prop_escape
145: .setValue(
146: Constants.PropertyDescriptor.CATEGORY,
147: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
148:
149: PropertyDescriptor prop_title = new PropertyDescriptorBase(
150: "title", beanClass, "getTitle", "setTitle");
151: prop_title.setDisplayName(resources
152: .getString("HtmlOutputFormat_title_DisplayName"));
153: prop_title.setShortDescription(resources
154: .getString("HtmlOutputFormat_title_Description"));
155: prop_title.setExpert(false);
156: prop_title.setHidden(false);
157: prop_title.setPreferred(false);
158: attrib = new AttributeDescriptor("title", false, null, true);
159: prop_title.setValue(
160: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
161: attrib);
162: prop_title
163: .setValue(
164: Constants.PropertyDescriptor.CATEGORY,
165: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
166:
167: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
168: propertyDescriptorList.add(prop_escape);
169: propertyDescriptorList.add(prop_title);
170:
171: propertyDescriptorList.addAll(Properties
172: .getVisualPropertyList(beanClass));
173: propertyDescriptorList.addAll(Arrays.asList(super
174: .getPropertyDescriptors()));
175: propertyDescriptors = propertyDescriptorList
176: .toArray(new PropertyDescriptor[propertyDescriptorList
177: .size()]);
178: return propertyDescriptors;
179:
180: } catch (IntrospectionException e) {
181: e.printStackTrace();
182: return null;
183: }
184:
185: }
186:
187: }
|