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.html;
043:
044: import java.beans.BeanDescriptor;
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:
053: import com.sun.rave.designtime.CategoryDescriptor;
054: import com.sun.rave.designtime.Constants;
055: import com.sun.rave.designtime.faces.FacetDescriptor;
056: import com.sun.rave.designtime.markup.AttributeDescriptor;
057: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
058: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
059: import org.netbeans.modules.visualweb.faces.dt_1_2.component.UIGraphicBeanInfoBase;
060:
061: public class HtmlGraphicImageBeanInfo extends UIGraphicBeanInfoBase {
062:
063: protected static ResourceBundle resources = ResourceBundle
064: .getBundle(
065: "org.netbeans.modules.visualweb.faces.dt_1_2.component.html.Bundle-JSF",
066: Locale.getDefault(), HtmlGraphicImageBeanInfo.class
067: .getClassLoader());
068:
069: public HtmlGraphicImageBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlGraphicImage.class;
071: defaultPropertyName = "value";
072: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlGraphicImage_C16";
073: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlGraphicImage_C32";
074: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlGraphicImage_M16";
075: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlGraphicImage_M32";
076: }
077:
078: private BeanDescriptor beanDescriptor;
079:
080: public BeanDescriptor getBeanDescriptor() {
081:
082: if (beanDescriptor != null) {
083: return beanDescriptor;
084: }
085:
086: beanDescriptor = new BeanDescriptorBase(beanClass);
087: beanDescriptor.setDisplayName(resources
088: .getString("HtmlGraphicImage_DisplayName"));
089: beanDescriptor.setShortDescription(resources
090: .getString("HtmlGraphicImage_Description"));
091: beanDescriptor.setExpert(false);
092: beanDescriptor.setHidden(false);
093: beanDescriptor.setPreferred(false);
094: beanDescriptor.setValue(
095: Constants.BeanDescriptor.FACET_DESCRIPTORS,
096: getFacetDescriptors());
097: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
098: "projrave_ui_elements_palette_jsfstd_image");
099: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
100: "image");
101: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
102: Boolean.FALSE);
103: beanDescriptor.setValue(
104: Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
105: "projrave_ui_elements_propsheets_jsfstd_image_props");
106: beanDescriptor.setValue(
107: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
108: getCategoryDescriptors());
109: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
110: "graphicImage");
111: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
112: "h");
113: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
114: "http://java.sun.com/jsf/html");
115: beanDescriptor
116: .setValue(
117: Constants.BeanDescriptor.RESIZE_CONSTRAINTS,
118: new Integer(
119: Constants.ResizeConstraints.MAINTAIN_ASPECT_RATIO
120: | Constants.ResizeConstraints.ANY));
121:
122: return beanDescriptor;
123: }
124:
125: private PropertyDescriptor[] propertyDescriptors;
126:
127: public PropertyDescriptor[] getPropertyDescriptors() {
128:
129: if (propertyDescriptors != null) {
130: return propertyDescriptors;
131: }
132: AttributeDescriptor attrib = null;
133:
134: try {
135:
136: PropertyDescriptor prop_alt = new PropertyDescriptorBase(
137: "alt", beanClass, "getAlt", "setAlt");
138: prop_alt.setDisplayName(resources
139: .getString("HtmlGraphicImage_alt_DisplayName"));
140: prop_alt.setShortDescription(resources
141: .getString("HtmlGraphicImage_alt_Description"));
142: prop_alt.setExpert(false);
143: prop_alt.setHidden(false);
144: prop_alt.setPreferred(false);
145: attrib = new AttributeDescriptor("alt", false, null, true);
146: prop_alt.setValue(
147: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
148: attrib);
149: prop_alt
150: .setValue(
151: Constants.PropertyDescriptor.CATEGORY,
152: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
153:
154: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
155: "dir", beanClass, "getDir", "setDir");
156: prop_dir.setDisplayName(resources
157: .getString("HtmlGraphicImage_dir_DisplayName"));
158: prop_dir.setShortDescription(resources
159: .getString("HtmlGraphicImage_dir_Description"));
160: prop_dir
161: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
162: prop_dir.setExpert(false);
163: prop_dir.setHidden(false);
164: prop_dir.setPreferred(false);
165: attrib = new AttributeDescriptor("dir", false, null, true);
166: prop_dir.setValue(
167: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
168: attrib);
169: prop_dir
170: .setValue(
171: Constants.PropertyDescriptor.CATEGORY,
172: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
173: prop_dir
174: .setValue(
175: com.sun.rave.propertyeditors.DomainPropertyEditor.DOMAIN_CLASS,
176: com.sun.rave.propertyeditors.domains.TextDirectionDomain.class);
177:
178: PropertyDescriptor prop_height = new PropertyDescriptorBase(
179: "height", beanClass, "getHeight", "setHeight");
180: prop_height.setDisplayName(resources
181: .getString("HtmlGraphicImage_height_DisplayName"));
182: prop_height.setShortDescription(resources
183: .getString("HtmlGraphicImage_height_Description"));
184: prop_height
185: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
186: prop_height.setExpert(false);
187: prop_height.setHidden(false);
188: prop_height.setPreferred(false);
189: attrib = new AttributeDescriptor("height", false, null,
190: true);
191: prop_height.setValue(
192: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
193: attrib);
194: prop_height
195: .setValue(
196: Constants.PropertyDescriptor.CATEGORY,
197: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
198:
199: PropertyDescriptor prop_ismap = new PropertyDescriptorBase(
200: "ismap", beanClass, "isIsmap", "setIsmap");
201: prop_ismap.setDisplayName(resources
202: .getString("HtmlGraphicImage_ismap_DisplayName"));
203: prop_ismap.setShortDescription(resources
204: .getString("HtmlGraphicImage_ismap_Description"));
205: prop_ismap.setExpert(false);
206: prop_ismap.setHidden(false);
207: prop_ismap.setPreferred(false);
208: attrib = new AttributeDescriptor("ismap", false, null, true);
209: prop_ismap.setValue(
210: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
211: attrib);
212: prop_ismap
213: .setValue(
214: Constants.PropertyDescriptor.CATEGORY,
215: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
216:
217: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
218: "lang", beanClass, "getLang", "setLang");
219: prop_lang.setDisplayName(resources
220: .getString("HtmlGraphicImage_lang_DisplayName"));
221: prop_lang.setShortDescription(resources
222: .getString("HtmlGraphicImage_lang_Description"));
223: prop_lang
224: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
225: prop_lang.setExpert(false);
226: prop_lang.setHidden(false);
227: prop_lang.setPreferred(false);
228: attrib = new AttributeDescriptor("lang", false, null, true);
229: prop_lang.setValue(
230: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
231: attrib);
232: prop_lang
233: .setValue(
234: Constants.PropertyDescriptor.CATEGORY,
235: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
236: prop_lang
237: .setValue(
238: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
239: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
240:
241: PropertyDescriptor prop_longdesc = new PropertyDescriptorBase(
242: "longdesc", beanClass, "getLongdesc", "setLongdesc");
243: prop_longdesc
244: .setDisplayName(resources
245: .getString("HtmlGraphicImage_longdesc_DisplayName"));
246: prop_longdesc
247: .setShortDescription(resources
248: .getString("HtmlGraphicImage_longdesc_Description"));
249: prop_longdesc.setExpert(false);
250: prop_longdesc.setHidden(false);
251: prop_longdesc.setPreferred(false);
252: attrib = new AttributeDescriptor("longdesc", false, null,
253: true);
254: prop_longdesc.setValue(
255: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
256: attrib);
257: prop_longdesc
258: .setValue(
259: Constants.PropertyDescriptor.CATEGORY,
260: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
261:
262: PropertyDescriptor prop_usemap = new PropertyDescriptorBase(
263: "usemap", beanClass, "getUsemap", "setUsemap");
264: prop_usemap.setDisplayName(resources
265: .getString("HtmlGraphicImage_usemap_DisplayName"));
266: prop_usemap.setShortDescription(resources
267: .getString("HtmlGraphicImage_usemap_Description"));
268: prop_usemap
269: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
270: prop_usemap.setExpert(false);
271: prop_usemap.setHidden(false);
272: prop_usemap.setPreferred(false);
273: attrib = new AttributeDescriptor("usemap", false, null,
274: true);
275: prop_usemap.setValue(
276: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
277: attrib);
278: prop_usemap
279: .setValue(
280: Constants.PropertyDescriptor.CATEGORY,
281: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
282:
283: PropertyDescriptor prop_width = new PropertyDescriptorBase(
284: "width", beanClass, "getWidth", "setWidth");
285: prop_width.setDisplayName(resources
286: .getString("HtmlGraphicImage_width_DisplayName"));
287: prop_width.setShortDescription(resources
288: .getString("HtmlGraphicImage_width_Description"));
289: prop_width
290: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
291: prop_width.setExpert(false);
292: prop_width.setHidden(false);
293: prop_width.setPreferred(false);
294: attrib = new AttributeDescriptor("width", false, null, true);
295: prop_width.setValue(
296: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
297: attrib);
298: prop_width
299: .setValue(
300: Constants.PropertyDescriptor.CATEGORY,
301: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
302:
303: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
304: propertyDescriptorList.add(prop_alt);
305: propertyDescriptorList.add(prop_dir);
306: propertyDescriptorList.add(prop_height);
307: propertyDescriptorList.add(prop_ismap);
308: propertyDescriptorList.add(prop_lang);
309: propertyDescriptorList.add(prop_longdesc);
310: propertyDescriptorList.add(prop_usemap);
311: propertyDescriptorList.add(prop_width);
312:
313: propertyDescriptorList.addAll(Properties
314: .getVisualPropertyList(beanClass));
315: propertyDescriptorList.addAll(Properties
316: .getKeyEventPropertyList(beanClass));
317: propertyDescriptorList.addAll(Properties
318: .getMouseEventPropertyList(beanClass));
319: propertyDescriptorList.addAll(Properties
320: .getClickEventPropertyList(beanClass));
321: propertyDescriptorList.addAll(Arrays.asList(super
322: .getPropertyDescriptors()));
323: propertyDescriptors = propertyDescriptorList
324: .toArray(new PropertyDescriptor[propertyDescriptorList
325: .size()]);
326: return propertyDescriptors;
327:
328: } catch (IntrospectionException e) {
329: e.printStackTrace();
330: return null;
331: }
332:
333: }
334:
335: }
|