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 org.netbeans.modules.visualweb.faces.dt_1_2.component.UICommandBeanInfoBase;
045: import java.awt.Image;
046: import java.beans.BeanDescriptor;
047: import java.beans.BeanInfo;
048: import java.beans.IntrospectionException;
049: import java.beans.PropertyDescriptor;
050: import java.util.Locale;
051: import java.util.List;
052: import java.util.ArrayList;
053: import java.util.Arrays;
054: import java.util.ResourceBundle;
055:
056: import com.sun.rave.designtime.CategoryDescriptor;
057: import com.sun.rave.designtime.Constants;
058: import com.sun.rave.designtime.faces.FacetDescriptor;
059: import com.sun.rave.designtime.markup.AttributeDescriptor;
060:
061: import org.netbeans.modules.visualweb.faces.dt.HtmlBeanInfoBase;
062: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
063: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
064:
065: /**
066: * The HtmlCommandHyperlinkBeanInfo class provides design-time meta data
067: * for the HtmlCommandHyperlink component for use in a visual design tool.
068: */
069: public class HtmlCommandLinkBeanInfo extends UICommandBeanInfoBase {
070:
071: protected static ResourceBundle resources = ResourceBundle
072: .getBundle(
073: "org.netbeans.modules.visualweb.faces.dt_1_2.component.html.Bundle-JSF",
074: Locale.getDefault(), HtmlCommandLinkBeanInfo.class
075: .getClassLoader());
076:
077: public HtmlCommandLinkBeanInfo() {
078: beanClass = javax.faces.component.html.HtmlCommandLink.class;
079: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlCommandLink_C16";
080: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlCommandLink_C32";
081: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlCommandLink_M16";
082: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlCommandLink_M32";
083: }
084:
085: private BeanDescriptor beanDescriptor;
086:
087: /**
088: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
089: */
090: public BeanDescriptor getBeanDescriptor() {
091:
092: if (beanDescriptor != null) {
093: return beanDescriptor;
094: }
095:
096: beanDescriptor = new BeanDescriptorBase(beanClass);
097: beanDescriptor.setDisplayName(resources
098: .getString("HtmlCommandLink_DisplayName"));
099: beanDescriptor.setShortDescription(resources
100: .getString("HtmlCommandLink_Description"));
101: beanDescriptor.setExpert(false);
102: beanDescriptor.setHidden(false);
103: beanDescriptor.setPreferred(false);
104: beanDescriptor.setValue(
105: Constants.BeanDescriptor.FACET_DESCRIPTORS,
106: getFacetDescriptors());
107: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
108: "projrave_ui_elements_palette_jsfstd_link_action");
109: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
110: "linkAction");
111: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
112: Boolean.TRUE);
113: beanDescriptor
114: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
115: "projrave_ui_elements_propsheets_jsfstd_link_action_props");
116: beanDescriptor.setValue(
117: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
118: getCategoryDescriptors());
119: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
120: "commandLink");
121: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
122: "h");
123: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
124: "http://java.sun.com/jsf/html");
125: beanDescriptor.setValue(
126: Constants.BeanDescriptor.INLINE_EDITABLE_PROPERTIES,
127: new String[] { "*value://a" }); // NOI18N
128:
129: return beanDescriptor;
130:
131: }
132:
133: private PropertyDescriptor[] propertyDescriptors;
134:
135: /**
136: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
137: */
138: public PropertyDescriptor[] getPropertyDescriptors() {
139:
140: if (propertyDescriptors != null) {
141: return propertyDescriptors;
142: }
143: AttributeDescriptor attrib = null;
144:
145: try {
146:
147: PropertyDescriptor prop_accesskey = new PropertyDescriptorBase(
148: "accesskey", beanClass, "getAccesskey",
149: "setAccesskey");
150: prop_accesskey
151: .setDisplayName(resources
152: .getString("HtmlCommandLink_accesskey_DisplayName"));
153: prop_accesskey
154: .setShortDescription(resources
155: .getString("HtmlCommandLink_accesskey_Description"));
156: prop_accesskey.setExpert(false);
157: prop_accesskey.setHidden(false);
158: prop_accesskey.setPreferred(false);
159: attrib = new AttributeDescriptor("accesskey", false, null,
160: true);
161: prop_accesskey.setValue(
162: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
163: attrib);
164: prop_accesskey
165: .setValue(
166: Constants.PropertyDescriptor.CATEGORY,
167: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
168:
169: PropertyDescriptor prop_charset = new PropertyDescriptorBase(
170: "charset", beanClass, "getCharset", "setCharset");
171: prop_charset.setDisplayName(resources
172: .getString("HtmlOutputLink_charset_DisplayName"));
173: prop_charset.setShortDescription(resources
174: .getString("HtmlOutputLink_charset_Description"));
175: prop_charset
176: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
177: prop_charset.setExpert(false);
178: prop_charset.setHidden(false);
179: prop_charset.setPreferred(false);
180: attrib = new AttributeDescriptor("charset", false, null,
181: true);
182: prop_charset.setValue(
183: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
184: attrib);
185: prop_charset
186: .setValue(
187: Constants.PropertyDescriptor.CATEGORY,
188: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
189: prop_charset
190: .setValue(
191: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
192: com.sun.rave.propertyeditors.domains.CharacterSetsDomain.class);
193:
194: PropertyDescriptor prop_coords = new PropertyDescriptorBase(
195: "coords", beanClass, "getCoords", "setCoords");
196: prop_coords.setDisplayName(resources
197: .getString("HtmlOutputLink_coords_DisplayName"));
198: prop_coords.setShortDescription(resources
199: .getString("HtmlOutputLink_coords_Description"));
200: prop_coords
201: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
202: prop_coords.setExpert(false);
203: prop_coords.setHidden(false);
204: prop_coords.setPreferred(false);
205: attrib = new AttributeDescriptor("coords", false, null,
206: true);
207: prop_coords.setValue(
208: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
209: attrib);
210: prop_coords
211: .setValue(
212: Constants.PropertyDescriptor.CATEGORY,
213: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
214:
215: PropertyDescriptor prop_dir = new PropertyDescriptorBase(
216: "dir", beanClass, "getDir", "setDir");
217: prop_dir.setDisplayName(resources
218: .getString("HtmlCommandLink_dir_DisplayName"));
219: prop_dir.setShortDescription(resources
220: .getString("HtmlCommandLink_dir_Description"));
221: prop_dir
222: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
223: prop_dir.setExpert(false);
224: prop_dir.setHidden(false);
225: prop_dir.setPreferred(false);
226: attrib = new AttributeDescriptor("dir", false, null, true);
227: prop_dir.setValue(
228: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
229: attrib);
230: prop_dir
231: .setValue(
232: Constants.PropertyDescriptor.CATEGORY,
233: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
234: prop_dir
235: .setValue(
236: com.sun.rave.propertyeditors.DomainPropertyEditor.DOMAIN_CLASS,
237: com.sun.rave.propertyeditors.domains.TextDirectionDomain.class);
238:
239: PropertyDescriptor prop_disabled = new PropertyDescriptorBase(
240: "disabled", beanClass, "isDisabled", "setDisabled");
241: prop_disabled.setDisplayName(resources
242: .getString("HtmlCommandLink_disabled_DisplayName"));
243: prop_disabled.setShortDescription(resources
244: .getString("HtmlCommandLink_disabled_Description"));
245: prop_disabled.setExpert(false);
246: prop_disabled.setHidden(false);
247: prop_disabled.setPreferred(false);
248: attrib = new AttributeDescriptor("disabled", false, null,
249: true);
250: prop_disabled.setValue(
251: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
252: attrib);
253: prop_disabled
254: .setValue(
255: Constants.PropertyDescriptor.CATEGORY,
256: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
257:
258: PropertyDescriptor prop_hreflang = new PropertyDescriptorBase(
259: "hreflang", beanClass, "getHreflang", "setHreflang");
260: prop_hreflang.setDisplayName(resources
261: .getString("HtmlCommandLink_hreflang_DisplayName"));
262: prop_hreflang.setShortDescription(resources
263: .getString("HtmlCommandLink_hreflang_Description"));
264: prop_hreflang
265: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
266: prop_hreflang.setExpert(false);
267: prop_hreflang.setHidden(false);
268: prop_hreflang.setPreferred(false);
269: attrib = new AttributeDescriptor("hreflang", false, null,
270: true);
271: prop_hreflang.setValue(
272: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
273: attrib);
274: prop_hreflang
275: .setValue(
276: Constants.PropertyDescriptor.CATEGORY,
277: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
278: prop_hreflang
279: .setValue(
280: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
281: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
282:
283: PropertyDescriptor prop_lang = new PropertyDescriptorBase(
284: "lang", beanClass, "getLang", "setLang");
285: prop_lang.setDisplayName(resources
286: .getString("HtmlCommandLink_lang_DisplayName"));
287: prop_lang.setShortDescription(resources
288: .getString("HtmlCommandLink_lang_Description"));
289: prop_lang
290: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
291: prop_lang.setExpert(false);
292: prop_lang.setHidden(false);
293: prop_lang.setPreferred(false);
294: attrib = new AttributeDescriptor("lang", false, null, true);
295: prop_lang.setValue(
296: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
297: attrib);
298: prop_lang
299: .setValue(
300: Constants.PropertyDescriptor.CATEGORY,
301: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
302: prop_lang
303: .setValue(
304: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
305: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
306:
307: PropertyDescriptor prop_rel = new PropertyDescriptorBase(
308: "rel", beanClass, "getRel", "setRel");
309: prop_rel.setDisplayName(resources
310: .getString("HtmlCommandLink_rel_DisplayName"));
311: prop_rel.setShortDescription(resources
312: .getString("HtmlCommandLink_rel_Description"));
313: prop_rel
314: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
315: prop_rel.setExpert(false);
316: prop_rel.setHidden(false);
317: prop_rel.setPreferred(false);
318: attrib = new AttributeDescriptor("rel", false, null, true);
319: prop_rel.setValue(
320: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
321: attrib);
322: prop_rel
323: .setValue(
324: Constants.PropertyDescriptor.CATEGORY,
325: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
326: prop_rel
327: .setValue(
328: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
329: com.sun.rave.propertyeditors.domains.HtmlLinkTypesDomain.class);
330:
331: PropertyDescriptor prop_rev = new PropertyDescriptorBase(
332: "rev", beanClass, "getRev", "setRev");
333: prop_rev.setDisplayName(resources
334: .getString("HtmlCommandLink_rev_DisplayName"));
335: prop_rev.setShortDescription(resources
336: .getString("HtmlCommandLink_rev_Description"));
337: prop_rev
338: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
339: prop_rev.setExpert(false);
340: prop_rev.setHidden(false);
341: prop_rev.setPreferred(false);
342: attrib = new AttributeDescriptor("rev", false, null, true);
343: prop_rev.setValue(
344: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
345: attrib);
346: prop_rev
347: .setValue(
348: Constants.PropertyDescriptor.CATEGORY,
349: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
350: prop_rev
351: .setValue(
352: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
353: com.sun.rave.propertyeditors.domains.HtmlLinkTypesDomain.class);
354:
355: PropertyDescriptor prop_shape = new PropertyDescriptorBase(
356: "shape", beanClass, "getShape", "setShape");
357: prop_shape.setDisplayName(resources
358: .getString("HtmlCommandLink_shape_DisplayName"));
359: prop_shape.setShortDescription(resources
360: .getString("HtmlCommandLink_shape_Description"));
361: prop_shape
362: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
363: prop_shape.setExpert(false);
364: prop_shape.setHidden(false);
365: prop_shape.setPreferred(false);
366: attrib = new AttributeDescriptor("shape", false, null, true);
367: prop_shape.setValue(
368: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
369: attrib);
370: prop_shape
371: .setValue(
372: Constants.PropertyDescriptor.CATEGORY,
373: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
374: prop_shape
375: .setValue(
376: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
377: com.sun.rave.propertyeditors.domains.HtmlRegionShapesDomain.class);
378:
379: PropertyDescriptor prop_tabindex = new PropertyDescriptorBase(
380: "tabindex", beanClass, "getTabindex", "setTabindex");
381: prop_tabindex.setDisplayName(resources
382: .getString("HtmlCommandLink_tabindex_DisplayName"));
383: prop_tabindex.setShortDescription(resources
384: .getString("HtmlCommandLink_tabindex_Description"));
385: prop_tabindex
386: .setPropertyEditorClass(com.sun.rave.propertyeditors.IntegerPropertyEditor.class);
387: prop_tabindex.setExpert(false);
388: prop_tabindex.setHidden(false);
389: prop_tabindex.setPreferred(false);
390: attrib = new AttributeDescriptor("tabindex", false, null,
391: true);
392: prop_tabindex.setValue(
393: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
394: attrib);
395: prop_tabindex
396: .setValue(
397: Constants.PropertyDescriptor.CATEGORY,
398: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
399: prop_tabindex.setValue("maxValue", new Integer(
400: Short.MAX_VALUE));
401: prop_tabindex.setValue("minValue", new Integer(0));
402:
403: PropertyDescriptor prop_target = new PropertyDescriptorBase(
404: "target", beanClass, "getTarget", "setTarget");
405: prop_target.setDisplayName(resources
406: .getString("HtmlCommandLink_target_DisplayName"));
407: prop_target.setShortDescription(resources
408: .getString("HtmlCommandLink_target_Description"));
409: prop_target
410: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
411: prop_target.setExpert(false);
412: prop_target.setHidden(false);
413: prop_target.setPreferred(false);
414: attrib = new AttributeDescriptor("target", false, null,
415: true);
416: prop_target.setValue(
417: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
418: attrib);
419: prop_target
420: .setValue(
421: Constants.PropertyDescriptor.CATEGORY,
422: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
423: prop_target
424: .setValue(
425: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
426: com.sun.rave.propertyeditors.domains.HtmlFrameTargetsDomain.class);
427:
428: PropertyDescriptor prop_type = new PropertyDescriptorBase(
429: "type", beanClass, "getType", "setType");
430: prop_type.setDisplayName(resources
431: .getString("HtmlCommandLink_type_DisplayName"));
432: prop_type.setShortDescription(resources
433: .getString("HtmlCommandLink_type_Description"));
434: prop_type
435: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
436: prop_type.setExpert(false);
437: prop_type.setHidden(false);
438: prop_type.setPreferred(false);
439: attrib = new AttributeDescriptor("type", false, null, true);
440: prop_type.setValue(
441: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
442: attrib);
443: prop_type
444: .setValue(
445: Constants.PropertyDescriptor.CATEGORY,
446: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
447: prop_type
448: .setValue(
449: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
450: com.sun.rave.propertyeditors.domains.MimeTypesDomain.class);
451:
452: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
453: propertyDescriptorList.add(prop_accesskey);
454: propertyDescriptorList.add(prop_charset);
455: propertyDescriptorList.add(prop_coords);
456: propertyDescriptorList.add(prop_dir);
457: propertyDescriptorList.add(prop_disabled);
458: propertyDescriptorList.add(prop_hreflang);
459: propertyDescriptorList.add(prop_lang);
460: propertyDescriptorList.add(prop_rel);
461: propertyDescriptorList.add(prop_rev);
462: propertyDescriptorList.add(prop_shape);
463: propertyDescriptorList.add(prop_tabindex);
464: propertyDescriptorList.add(prop_target);
465: propertyDescriptorList.add(prop_type);
466:
467: propertyDescriptorList.addAll(Properties
468: .getVisualPropertyList(beanClass));
469: propertyDescriptorList.addAll(Properties
470: .getKeyEventPropertyList(beanClass));
471: propertyDescriptorList.addAll(Properties
472: .getMouseEventPropertyList(beanClass));
473: propertyDescriptorList.addAll(Properties
474: .getClickEventPropertyList(beanClass));
475: propertyDescriptorList.addAll(Properties
476: .getFocusEventPropertyList(beanClass));
477: propertyDescriptorList.addAll(Arrays.asList(super
478: .getPropertyDescriptors()));
479: propertyDescriptors = propertyDescriptorList
480: .toArray(new PropertyDescriptor[propertyDescriptorList
481: .size()]);
482: return propertyDescriptors;
483:
484: } catch (IntrospectionException e) {
485: e.printStackTrace();
486: return null;
487: }
488:
489: }
490:
491: }
|