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