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