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.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: 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 com.sun.rave.propertyeditors.domains.TextDirectionDomain;
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_1.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_1.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_1/component/html/HtmlGraphicImage_C16";
073: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlGraphicImage_C32";
074: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_1/component/html/HtmlGraphicImage_M16";
075: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_1/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(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.setValue(DomainPropertyEditor.DOMAIN_CLASS,
174: TextDirectionDomain.class);
175:
176: PropertyDescriptor prop_height = new PropertyDescriptorBase(
177: "height", beanClass, "getHeight", "setHeight");
178: prop_height.setDisplayName(resources
179: .getString("HtmlGraphicImage_height_DisplayName"));
180: prop_height.setShortDescription(resources
181: .getString("HtmlGraphicImage_height_Description"));
182: prop_height
183: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
184: prop_height.setExpert(false);
185: prop_height.setHidden(false);
186: prop_height.setPreferred(false);
187: attrib = new AttributeDescriptor("height", false, null,
188: true);
189: prop_height.setValue(
190: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
191: attrib);
192: prop_height
193: .setValue(
194: Constants.PropertyDescriptor.CATEGORY,
195: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
196:
197: PropertyDescriptor prop_ismap = new PropertyDescriptorBase(
198: "ismap", beanClass, "isIsmap", "setIsmap");
199: prop_ismap.setDisplayName(resources
200: .getString("HtmlGraphicImage_ismap_DisplayName"));
201: prop_ismap.setShortDescription(resources
202: .getString("HtmlGraphicImage_ismap_Description"));
203: prop_ismap.setExpert(false);
204: prop_ismap.setHidden(false);
205: prop_ismap.setPreferred(false);
206: attrib = new AttributeDescriptor("ismap", false, null, true);
207: prop_ismap.setValue(
208: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
209: attrib);
210: prop_ismap
211: .setValue(
212: Constants.PropertyDescriptor.CATEGORY,
213: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
214:
215: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
216: "lang", beanClass, "getLang", "setLang");
217: prop_lang.setDisplayName(resources
218: .getString("HtmlGraphicImage_lang_DisplayName"));
219: prop_lang.setShortDescription(resources
220: .getString("HtmlGraphicImage_lang_Description"));
221: prop_lang
222: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
223: prop_lang.setExpert(false);
224: prop_lang.setHidden(false);
225: prop_lang.setPreferred(false);
226: attrib = new AttributeDescriptor("lang", false, null, true);
227: prop_lang.setValue(
228: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
229: attrib);
230: prop_lang
231: .setValue(
232: Constants.PropertyDescriptor.CATEGORY,
233: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
234: prop_lang
235: .setValue(
236: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
237: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
238:
239: PropertyDescriptor prop_longdesc = new PropertyDescriptorBase(
240: "longdesc", beanClass, "getLongdesc", "setLongdesc");
241: prop_longdesc
242: .setDisplayName(resources
243: .getString("HtmlGraphicImage_longdesc_DisplayName"));
244: prop_longdesc
245: .setShortDescription(resources
246: .getString("HtmlGraphicImage_longdesc_Description"));
247: prop_longdesc.setExpert(false);
248: prop_longdesc.setHidden(false);
249: prop_longdesc.setPreferred(false);
250: attrib = new AttributeDescriptor("longdesc", false, null,
251: true);
252: prop_longdesc.setValue(
253: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
254: attrib);
255: prop_longdesc
256: .setValue(
257: Constants.PropertyDescriptor.CATEGORY,
258: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
259:
260: PropertyDescriptor prop_title = new PropertyDescriptorBase(
261: "title", beanClass, "getTitle", "setTitle");
262: prop_title.setDisplayName(resources
263: .getString("HtmlGraphicImage_title_DisplayName"));
264: prop_title.setShortDescription(resources
265: .getString("HtmlGraphicImage_title_Description"));
266: prop_title.setExpert(false);
267: prop_title.setHidden(false);
268: prop_title.setPreferred(false);
269: attrib = new AttributeDescriptor("title", false, null, true);
270: prop_title.setValue(
271: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
272: attrib);
273: prop_title
274: .setValue(
275: Constants.PropertyDescriptor.CATEGORY,
276: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
277:
278: PropertyDescriptor prop_usemap = new PropertyDescriptorBase(
279: "usemap", beanClass, "getUsemap", "setUsemap");
280: prop_usemap.setDisplayName(resources
281: .getString("HtmlGraphicImage_usemap_DisplayName"));
282: prop_usemap.setShortDescription(resources
283: .getString("HtmlGraphicImage_usemap_Description"));
284: prop_usemap
285: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
286: prop_usemap.setExpert(false);
287: prop_usemap.setHidden(false);
288: prop_usemap.setPreferred(false);
289: attrib = new AttributeDescriptor("usemap", false, null,
290: true);
291: prop_usemap.setValue(
292: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
293: attrib);
294: prop_usemap
295: .setValue(
296: Constants.PropertyDescriptor.CATEGORY,
297: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
298:
299: PropertyDescriptor prop_width = new PropertyDescriptorBase(
300: "width", beanClass, "getWidth", "setWidth");
301: prop_width.setDisplayName(resources
302: .getString("HtmlGraphicImage_width_DisplayName"));
303: prop_width.setShortDescription(resources
304: .getString("HtmlGraphicImage_width_Description"));
305: prop_width
306: .setPropertyEditorClass(com.sun.rave.propertyeditors.LengthPropertyEditor.class);
307: prop_width.setExpert(false);
308: prop_width.setHidden(false);
309: prop_width.setPreferred(false);
310: attrib = new AttributeDescriptor("width", false, null, true);
311: prop_width.setValue(
312: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
313: attrib);
314: prop_width
315: .setValue(
316: Constants.PropertyDescriptor.CATEGORY,
317: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
318:
319: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
320: propertyDescriptorList.add(prop_alt);
321: propertyDescriptorList.add(prop_dir);
322: propertyDescriptorList.add(prop_height);
323: propertyDescriptorList.add(prop_ismap);
324: propertyDescriptorList.add(prop_lang);
325: propertyDescriptorList.add(prop_longdesc);
326: propertyDescriptorList.add(prop_title);
327: propertyDescriptorList.add(prop_usemap);
328: propertyDescriptorList.add(prop_width);
329:
330: propertyDescriptorList.addAll(Properties
331: .getVisualPropertyList(beanClass));
332: propertyDescriptorList.addAll(Properties
333: .getKeyEventPropertyList(beanClass));
334: propertyDescriptorList.addAll(Properties
335: .getMouseEventPropertyList(beanClass));
336: propertyDescriptorList.addAll(Properties
337: .getClickEventPropertyList(beanClass));
338: propertyDescriptorList.addAll(Arrays.asList(super
339: .getPropertyDescriptors()));
340: propertyDescriptors = propertyDescriptorList
341: .toArray(new PropertyDescriptor[propertyDescriptorList
342: .size()]);
343: return propertyDescriptors;
344:
345: } catch (IntrospectionException e) {
346: e.printStackTrace();
347: return null;
348: }
349:
350: }
351:
352: }
|