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.awt.Image;
045: import java.beans.BeanDescriptor;
046: import java.beans.BeanInfo;
047: import java.beans.IntrospectionException;
048: import java.beans.PropertyDescriptor;
049: import java.util.Locale;
050: import java.util.List;
051: import java.util.ArrayList;
052: import java.util.Arrays;
053: import java.util.ResourceBundle;
054:
055: import com.sun.rave.designtime.CategoryDescriptor;
056: import com.sun.rave.designtime.Constants;
057: import com.sun.rave.designtime.faces.FacetDescriptor;
058: import com.sun.rave.designtime.markup.AttributeDescriptor;
059:
060: import org.netbeans.modules.visualweb.faces.dt.HtmlBeanInfoBase;
061: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
062: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
063:
064: public abstract class UIMessagesBeanInfoBase extends
065: UIComponentBeanInfoBase {
066:
067: protected static ResourceBundle resources = ResourceBundle
068: .getBundle(
069: "org.netbeans.modules.visualweb.faces.dt_1_1.component.Bundle",
070: Locale.getDefault(), UIMessagesBeanInfoBase.class
071: .getClassLoader());
072:
073: public UIMessagesBeanInfoBase() {
074: beanClass = javax.faces.component.UIMessages.class;
075: }
076:
077: private PropertyDescriptor[] propertyDescriptors;
078:
079: public PropertyDescriptor[] getPropertyDescriptors() {
080:
081: if (propertyDescriptors != null) {
082: return propertyDescriptors;
083: }
084: AttributeDescriptor attrib = null;
085:
086: try {
087:
088: PropertyDescriptor prop_globalOnly = new PropertyDescriptorBase(
089: "globalOnly", beanClass, "isGlobalOnly",
090: "setGlobalOnly");
091: prop_globalOnly.setDisplayName(resources
092: .getString("UIMessages_globalOnly_DisplayName"));
093: prop_globalOnly.setShortDescription(resources
094: .getString("UIMessages_globalOnly_Description"));
095: prop_globalOnly.setExpert(false);
096: prop_globalOnly.setHidden(false);
097: prop_globalOnly.setPreferred(false);
098: attrib = new AttributeDescriptor("globalOnly", false,
099: "false", true);
100: prop_globalOnly.setValue(
101: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
102: attrib);
103: prop_globalOnly
104: .setValue(
105: Constants.PropertyDescriptor.CATEGORY,
106: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
107:
108: PropertyDescriptor prop_showDetail = new PropertyDescriptorBase(
109: "showDetail", beanClass, "isShowDetail",
110: "setShowDetail");
111: prop_showDetail.setDisplayName(resources
112: .getString("UIMessages_showDetail_DisplayName"));
113: prop_showDetail.setShortDescription(resources
114: .getString("UIMessages_showDetail_Description"));
115: prop_showDetail.setExpert(false);
116: prop_showDetail.setHidden(false);
117: prop_showDetail.setPreferred(false);
118: attrib = new AttributeDescriptor("showDetail", false,
119: "false", true);
120: prop_showDetail.setValue(
121: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
122: attrib);
123: prop_showDetail
124: .setValue(
125: Constants.PropertyDescriptor.CATEGORY,
126: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
127:
128: PropertyDescriptor prop_showSummary = new PropertyDescriptorBase(
129: "showSummary", beanClass, "isShowSummary",
130: "setShowSummary");
131: prop_showSummary.setDisplayName(resources
132: .getString("UIMessages_showSummary_DisplayName"));
133: prop_showSummary.setShortDescription(resources
134: .getString("UIMessages_showSummary_Description"));
135: prop_showSummary.setExpert(false);
136: prop_showSummary.setHidden(false);
137: prop_showSummary.setPreferred(false);
138: attrib = new AttributeDescriptor("showSummary", false,
139: "true", true);
140: prop_showSummary.setValue(
141: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
142: attrib);
143: prop_showSummary
144: .setValue(
145: Constants.PropertyDescriptor.CATEGORY,
146: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
147:
148: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
149: propertyDescriptorList.add(prop_globalOnly);
150: propertyDescriptorList.add(prop_showDetail);
151: propertyDescriptorList.add(prop_showSummary);
152:
153: propertyDescriptorList.addAll(Arrays.asList(super
154: .getPropertyDescriptors()));
155: propertyDescriptors = propertyDescriptorList
156: .toArray(new PropertyDescriptor[propertyDescriptorList
157: .size()]);
158: return propertyDescriptors;
159:
160: } catch (IntrospectionException e) {
161: e.printStackTrace();
162: return null;
163: }
164:
165: }
166:
167: }
|