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;
043:
044: import java.beans.IntrospectionException;
045: import java.beans.PropertyDescriptor;
046: import java.util.Locale;
047: import java.util.List;
048: import java.util.ArrayList;
049: import java.util.Arrays;
050: import java.util.ResourceBundle;
051: import com.sun.rave.designtime.Constants;
052: import com.sun.rave.designtime.markup.AttributeDescriptor;
053: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
054: import org.netbeans.modules.visualweb.faces.dt_1_1.propertyeditors.JSF1_1ConverterPropertyEditor;
055:
056: public abstract class UIOutputBeanInfoBase extends
057: UIComponentBeanInfoBase {
058:
059: protected static ResourceBundle resources = ResourceBundle
060: .getBundle(
061: "org.netbeans.modules.visualweb.faces.dt_1_1.component.Bundle",
062: Locale.getDefault(), UIOutputBeanInfoBase.class
063: .getClassLoader());
064:
065: public UIOutputBeanInfoBase() {
066: beanClass = javax.faces.component.UIOutput.class;
067: defaultPropertyName = "value";
068: }
069:
070: private PropertyDescriptor[] propertyDescriptors;
071:
072: /**
073: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
074: */
075: public PropertyDescriptor[] getPropertyDescriptors() {
076:
077: if (propertyDescriptors != null) {
078: return propertyDescriptors;
079: }
080: AttributeDescriptor attrib = null;
081:
082: try {
083:
084: PropertyDescriptor prop_converter = new PropertyDescriptorBase(
085: "converter", beanClass, "getConverter",
086: "setConverter");
087: prop_converter.setDisplayName(resources
088: .getString("UIOutput_converter_DisplayName"));
089: prop_converter.setShortDescription(resources
090: .getString("UIOutput_converter_Description"));
091: prop_converter
092: .setPropertyEditorClass(JSF1_1ConverterPropertyEditor.class);
093: prop_converter.setExpert(false);
094: prop_converter.setHidden(false);
095: prop_converter.setPreferred(false);
096: attrib = new AttributeDescriptor("converter", false, null,
097: true);
098: prop_converter.setValue(
099: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
100: attrib);
101: prop_converter
102: .setValue(
103: Constants.PropertyDescriptor.CATEGORY,
104: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
105:
106: PropertyDescriptor prop_localValue = new PropertyDescriptorBase(
107: "localValue", beanClass, "getLocalValue", null);
108: prop_localValue.setDisplayName(resources
109: .getString("UIOutput_localValue_DisplayName"));
110: prop_localValue.setShortDescription(resources
111: .getString("UIOutput_localValue_Description"));
112: prop_localValue.setExpert(false);
113: prop_localValue.setHidden(true);
114: prop_localValue.setPreferred(false);
115: prop_localValue
116: .setValue(
117: Constants.PropertyDescriptor.CATEGORY,
118: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
119:
120: PropertyDescriptor prop_value = new PropertyDescriptorBase(
121: "value", beanClass, "getValue", "setValue");
122: prop_value.setDisplayName(resources
123: .getString("UIOutput_value_DisplayName"));
124: prop_value.setShortDescription(resources
125: .getString("UIOutput_value_Description"));
126: prop_value
127: .setPropertyEditorClass(org.netbeans.modules.visualweb.faces.dt.std.ValueBindingPropertyEditor.class);
128: prop_value.setExpert(false);
129: prop_value.setHidden(false);
130: prop_value.setPreferred(false);
131: attrib = new AttributeDescriptor("value", false, null, true);
132: prop_value.setValue(
133: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
134: attrib);
135: prop_value
136: .setValue(
137: Constants.PropertyDescriptor.CATEGORY,
138: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
139: prop_value.setValue("ignoreIsBound", "true");
140:
141: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
142: propertyDescriptorList.add(prop_converter);
143: propertyDescriptorList.add(prop_localValue);
144: propertyDescriptorList.add(prop_value);
145:
146: propertyDescriptorList.addAll(Arrays.asList(super
147: .getPropertyDescriptors()));
148: propertyDescriptors = propertyDescriptorList
149: .toArray(new PropertyDescriptor[propertyDescriptorList
150: .size()]);
151: return propertyDescriptors;
152:
153: } catch (IntrospectionException e) {
154: e.printStackTrace();
155: return null;
156: }
157:
158: }
159:
160: }
|