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