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 com.sun.rave.propertyeditors.domains.InputComponentIdsDomain;
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 com.sun.rave.propertyeditors.DomainPropertyEditor;
055: import com.sun.rave.propertyeditors.SelectOneDomainEditor;
056: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
057:
058: public abstract class UIMessageBeanInfoBase extends
059: UIComponentBeanInfoBase {
060:
061: protected static ResourceBundle resources = ResourceBundle
062: .getBundle(
063: "org.netbeans.modules.visualweb.faces.dt_1_1.component.Bundle",
064: Locale.getDefault(), UIMessageBeanInfoBase.class
065: .getClassLoader());
066:
067: public UIMessageBeanInfoBase() {
068: beanClass = javax.faces.component.UIMessage.class;
069: }
070:
071: private PropertyDescriptor[] propertyDescriptors;
072:
073: public PropertyDescriptor[] getPropertyDescriptors() {
074:
075: if (propertyDescriptors != null) {
076: return propertyDescriptors;
077: }
078: AttributeDescriptor attrib = null;
079:
080: try {
081:
082: PropertyDescriptor prop_for = new PropertyDescriptorBase(
083: "for", beanClass, "getFor", "setFor");
084: prop_for.setDisplayName(resources
085: .getString("UIMessage_for_DisplayName"));
086: prop_for.setShortDescription(resources
087: .getString("UIMessage_for_Description"));
088: prop_for
089: .setPropertyEditorClass(SelectOneDomainEditor.class);
090: prop_for.setExpert(false);
091: prop_for.setHidden(false);
092: prop_for.setPreferred(false);
093: attrib = new AttributeDescriptor("for", true, null, true);
094: prop_for.setValue(
095: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
096: attrib);
097: prop_for
098: .setValue(
099: Constants.PropertyDescriptor.CATEGORY,
100: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
101: prop_for.setValue(DomainPropertyEditor.DOMAIN_CLASS,
102: InputComponentIdsDomain.class);
103:
104: PropertyDescriptor prop_showDetail = new PropertyDescriptorBase(
105: "showDetail", beanClass, "isShowDetail",
106: "setShowDetail");
107: prop_showDetail.setDisplayName(resources
108: .getString("UIMessage_showDetail_DisplayName"));
109: prop_showDetail.setShortDescription(resources
110: .getString("UIMessage_showDetail_Description"));
111: prop_showDetail.setExpert(false);
112: prop_showDetail.setHidden(false);
113: prop_showDetail.setPreferred(false);
114: attrib = new AttributeDescriptor("showDetail", false,
115: "true", true);
116: prop_showDetail.setValue(
117: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
118: attrib);
119: prop_showDetail
120: .setValue(
121: Constants.PropertyDescriptor.CATEGORY,
122: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
123:
124: PropertyDescriptor prop_showSummary = new PropertyDescriptorBase(
125: "showSummary", beanClass, "isShowSummary",
126: "setShowSummary");
127: prop_showSummary.setDisplayName(resources
128: .getString("UIMessage_showSummary_DisplayName"));
129: prop_showSummary.setShortDescription(resources
130: .getString("UIMessage_showSummary_Description"));
131: prop_showSummary.setExpert(false);
132: prop_showSummary.setHidden(false);
133: prop_showSummary.setPreferred(false);
134: attrib = new AttributeDescriptor("showSummary", false,
135: "false", true);
136: prop_showSummary.setValue(
137: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
138: attrib);
139: prop_showSummary
140: .setValue(
141: Constants.PropertyDescriptor.CATEGORY,
142: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
143:
144: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
145: propertyDescriptorList.add(prop_for);
146: propertyDescriptorList.add(prop_showDetail);
147: propertyDescriptorList.add(prop_showSummary);
148:
149: propertyDescriptorList.addAll(Arrays.asList(super
150: .getPropertyDescriptors()));
151: propertyDescriptors = propertyDescriptorList
152: .toArray(new PropertyDescriptor[propertyDescriptorList
153: .size()]);
154: return propertyDescriptors;
155:
156: } catch (IntrospectionException e) {
157: e.printStackTrace();
158: return null;
159: }
160:
161: }
162:
163: }
|