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: package org.netbeans.modules.visualweb.faces.dt_1_2.component;
042:
043: import org.netbeans.modules.visualweb.faces.dt.HtmlNonGeneratedBeanInfoBase;
044: import java.beans.*;
045: import com.sun.rave.designtime.*;
046: import com.sun.rave.designtime.faces.*;
047: import com.sun.rave.designtime.markup.*;
048: import org.netbeans.modules.visualweb.faces.dt.util.ComponentBundle;
049: import javax.faces.component.UIColumn;
050:
051: /**
052: * The UIColumnBeanInfo class provides design-time meta data for the
053: * UIColumn component for use in a visual design tool.
054: */
055: public class UIColumnBeanInfo extends HtmlNonGeneratedBeanInfoBase {
056:
057: private static final ComponentBundle bundle = ComponentBundle
058: .getBundle(UIColumnBeanInfo.class);
059:
060: /**
061: * Construct a <code>UIColumnBeanInfoBase</code> instance
062: */
063: public UIColumnBeanInfo() {
064: beanClass = UIColumn.class;
065: iconFileName_C16 = "UIColumn_C16"; //NOI18N
066: iconFileName_C32 = "UIColumn_C32"; //NOI18N
067: iconFileName_M16 = "UIColumn_M16"; //NOI18N
068: iconFileName_M32 = "UIColumn_M32"; //NOI18N
069: }
070:
071: private BeanDescriptor beanDescriptor;
072:
073: /**
074: * @return The BeanDescriptor
075: */
076: public BeanDescriptor getBeanDescriptor() {
077: if (beanDescriptor == null) {
078: beanDescriptor = new BeanDescriptor(beanClass);
079: beanDescriptor.setValue(
080: Constants.BeanDescriptor.TAGLIB_URI,
081: "http://java.sun.com/jsf/html"); //NOI18N
082: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
083: "column"); //NOI18N
084: beanDescriptor.setValue(
085: Constants.BeanDescriptor.INSTANCE_NAME, "column"); //NOI18N
086: beanDescriptor.setValue(
087: Constants.BeanDescriptor.RESIZE_CONSTRAINTS,
088: new Integer(Constants.ResizeConstraints.NONE));
089: beanDescriptor.setValue(
090: Constants.BeanDescriptor.FACET_DESCRIPTORS,
091: getFacetDescriptors());
092: }
093: return beanDescriptor;
094: }
095:
096: public FacetDescriptor[] getFacetDescriptors() {
097: return new FacetDescriptor[] { new FacetDescriptor("header"), //NOI18N
098: new FacetDescriptor("footer"), //NOI18N
099: };
100: }
101:
102: PropertyDescriptor[] propertyDescriptors;
103:
104: /**
105: * Returns the PropertyDescriptor array which describes
106: * the property meta-data for this JavaBean
107: *
108: * @return An array of PropertyDescriptor objects
109: */
110: public PropertyDescriptor[] getPropertyDescriptors() {
111:
112: if (propertyDescriptors == null) {
113: try {
114:
115: PropertyDescriptor prop_rendered = new PropertyDescriptor(
116: "rendered", beanClass, "isRendered",
117: "setRendered"); //NOI18N
118: prop_rendered.setShortDescription(bundle
119: .getMessage("rendPropShortDesc")); //NOI18N
120: AttributeDescriptor attrib_rendered = new AttributeDescriptor(
121: "rendered"); //NOI18N
122: attrib_rendered.setBindable(true);
123: prop_rendered
124: .setValue(
125: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
126: attrib_rendered);
127:
128: PropertyDescriptor prop_id = new PropertyDescriptor(
129: "id", beanClass, "getId", "setId"); //NOI18N
130: prop_id.setShortDescription(bundle
131: .getMessage("idPropShortDesc")); //NOI18N
132: prop_id.setHidden(true);
133: AttributeDescriptor attrib_id = new AttributeDescriptor(
134: "id"); //NOI18N
135: attrib_id.setBindable(false);
136: prop_id
137: .setValue(
138: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
139: attrib_id);
140:
141: propertyDescriptors = new PropertyDescriptor[] {
142: prop_rendered, prop_id, };
143:
144: } catch (IntrospectionException ix) {
145: ix.printStackTrace();
146: }
147: }
148:
149: return propertyDescriptors;
150: }
151: }
|