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.UIMessagesBeanInfoBase;
060:
061: public class HtmlMessagesBeanInfo extends UIMessagesBeanInfoBase {
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(), HtmlMessagesBeanInfo.class
067: .getClassLoader());
068:
069: public HtmlMessagesBeanInfo() {
070: beanClass = javax.faces.component.html.HtmlMessages.class;
071: iconFileName_C16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlMessages_C16";
072: iconFileName_C32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlMessages_C32";
073: iconFileName_M16 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlMessages_M16";
074: iconFileName_M32 = "/org/netbeans/modules/visualweb/faces/dt_1_2/component/html/HtmlMessages_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("HtmlMessages_DisplayName"));
088: beanDescriptor.setShortDescription(resources
089: .getString("HtmlMessages_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_message_list");
098: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
099: "messageList");
100: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
101: Boolean.FALSE);
102: beanDescriptor
103: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
104: "projrave_ui_elements_propsheets_jsfstd_message_list_props");
105: beanDescriptor.setValue(
106: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
107: getCategoryDescriptors());
108: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
109: "messages");
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_errorClass = new PropertyDescriptorBase(
131: "errorClass", beanClass, "getErrorClass",
132: "setErrorClass");
133: prop_errorClass.setDisplayName(resources
134: .getString("HtmlMessages_errorClass_DisplayName"));
135: prop_errorClass.setShortDescription(resources
136: .getString("HtmlMessages_errorClass_Description"));
137: prop_errorClass
138: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
139: prop_errorClass.setExpert(false);
140: prop_errorClass.setHidden(false);
141: prop_errorClass.setPreferred(false);
142: attrib = new AttributeDescriptor("errorClass", false, null,
143: true);
144: prop_errorClass.setValue(
145: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
146: attrib);
147: prop_errorClass
148: .setValue(
149: Constants.PropertyDescriptor.CATEGORY,
150: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
151:
152: PropertyDescriptor prop_errorStyle = new PropertyDescriptorBase(
153: "errorStyle", beanClass, "getErrorStyle",
154: "setErrorStyle");
155: prop_errorStyle.setDisplayName(resources
156: .getString("HtmlMessages_errorStyle_DisplayName"));
157: prop_errorStyle.setShortDescription(resources
158: .getString("HtmlMessages_errorStyle_Description"));
159: prop_errorStyle
160: .setPropertyEditorClass(com.sun.rave.propertyeditors.css.CssStylePropertyEditor.class);
161: prop_errorStyle.setExpert(false);
162: prop_errorStyle.setHidden(false);
163: prop_errorStyle.setPreferred(false);
164: attrib = new AttributeDescriptor("errorStyle", false, null,
165: true);
166: prop_errorStyle.setValue(
167: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
168: attrib);
169: prop_errorStyle
170: .setValue(
171: Constants.PropertyDescriptor.CATEGORY,
172: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
173:
174: PropertyDescriptor prop_fatalClass = new PropertyDescriptorBase(
175: "fatalClass", beanClass, "getFatalClass",
176: "setFatalClass");
177: prop_fatalClass.setDisplayName(resources
178: .getString("HtmlMessages_fatalClass_DisplayName"));
179: prop_fatalClass.setShortDescription(resources
180: .getString("HtmlMessages_fatalClass_Description"));
181: prop_fatalClass
182: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
183: prop_fatalClass.setExpert(false);
184: prop_fatalClass.setHidden(false);
185: prop_fatalClass.setPreferred(false);
186: attrib = new AttributeDescriptor("fatalClass", false, null,
187: true);
188: prop_fatalClass.setValue(
189: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
190: attrib);
191: prop_fatalClass
192: .setValue(
193: Constants.PropertyDescriptor.CATEGORY,
194: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
195:
196: PropertyDescriptor prop_fatalStyle = new PropertyDescriptorBase(
197: "fatalStyle", beanClass, "getFatalStyle",
198: "setFatalStyle");
199: prop_fatalStyle.setDisplayName(resources
200: .getString("HtmlMessages_fatalStyle_DisplayName"));
201: prop_fatalStyle.setShortDescription(resources
202: .getString("HtmlMessages_fatalStyle_Description"));
203: prop_fatalStyle
204: .setPropertyEditorClass(com.sun.rave.propertyeditors.css.CssStylePropertyEditor.class);
205: prop_fatalStyle.setExpert(false);
206: prop_fatalStyle.setHidden(false);
207: prop_fatalStyle.setPreferred(false);
208: attrib = new AttributeDescriptor("fatalStyle", false, null,
209: true);
210: prop_fatalStyle.setValue(
211: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
212: attrib);
213: prop_fatalStyle
214: .setValue(
215: Constants.PropertyDescriptor.CATEGORY,
216: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
217:
218: PropertyDescriptor prop_infoClass = new PropertyDescriptorBase(
219: "infoClass", beanClass, "getInfoClass",
220: "setInfoClass");
221: prop_infoClass.setDisplayName(resources
222: .getString("HtmlMessages_infoClass_DisplayName"));
223: prop_infoClass.setShortDescription(resources
224: .getString("HtmlMessages_infoClass_Description"));
225: prop_infoClass
226: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
227: prop_infoClass.setExpert(false);
228: prop_infoClass.setHidden(false);
229: prop_infoClass.setPreferred(false);
230: attrib = new AttributeDescriptor("infoClass", false, null,
231: true);
232: prop_infoClass.setValue(
233: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
234: attrib);
235: prop_infoClass
236: .setValue(
237: Constants.PropertyDescriptor.CATEGORY,
238: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
239:
240: PropertyDescriptor prop_infoStyle = new PropertyDescriptorBase(
241: "infoStyle", beanClass, "getInfoStyle",
242: "setInfoStyle");
243: prop_infoStyle.setDisplayName(resources
244: .getString("HtmlMessages_infoStyle_DisplayName"));
245: prop_infoStyle.setShortDescription(resources
246: .getString("HtmlMessages_infoStyle_Description"));
247: prop_infoStyle
248: .setPropertyEditorClass(com.sun.rave.propertyeditors.css.CssStylePropertyEditor.class);
249: prop_infoStyle.setExpert(false);
250: prop_infoStyle.setHidden(false);
251: prop_infoStyle.setPreferred(false);
252: attrib = new AttributeDescriptor("infoStyle", false, null,
253: true);
254: prop_infoStyle.setValue(
255: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
256: attrib);
257: prop_infoStyle
258: .setValue(
259: Constants.PropertyDescriptor.CATEGORY,
260: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
261:
262: PropertyDescriptor prop_layout = new PropertyDescriptorBase(
263: "layout", beanClass, "getLayout", "setLayout");
264: prop_layout.setDisplayName(resources
265: .getString("HtmlMessages_layout_DisplayName"));
266: prop_layout.setShortDescription(resources
267: .getString("HtmlMessages_layout_Description"));
268: prop_layout
269: .setPropertyEditorClass(com.sun.rave.propertyeditors.SelectOneDomainEditor.class);
270: prop_layout.setExpert(false);
271: prop_layout.setHidden(false);
272: prop_layout.setPreferred(false);
273: attrib = new AttributeDescriptor("layout", false,
274: "\"list\"", true);
275: prop_layout.setValue(
276: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
277: attrib);
278: prop_layout
279: .setValue(
280: Constants.PropertyDescriptor.CATEGORY,
281: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
282: prop_layout
283: .setValue(
284: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
285: org.netbeans.modules.visualweb.faces.dt_1_2.component.html.HtmlMessagesLayoutStylesDomain.class);
286:
287: PropertyDescriptor prop_tooltip = new PropertyDescriptorBase(
288: "tooltip", beanClass, "isTooltip", "setTooltip");
289: prop_tooltip.setDisplayName(resources
290: .getString("HtmlMessages_tooltip_DisplayName"));
291: prop_tooltip.setShortDescription(resources
292: .getString("HtmlMessages_tooltip_Description"));
293: prop_tooltip.setExpert(false);
294: prop_tooltip.setHidden(false);
295: prop_tooltip.setPreferred(false);
296: attrib = new AttributeDescriptor("tooltip", false, null,
297: true);
298: prop_tooltip.setValue(
299: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
300: attrib);
301: prop_tooltip
302: .setValue(
303: Constants.PropertyDescriptor.CATEGORY,
304: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
305:
306: PropertyDescriptor prop_warnClass = new PropertyDescriptorBase(
307: "warnClass", beanClass, "getWarnClass",
308: "setWarnClass");
309: prop_warnClass.setDisplayName(resources
310: .getString("HtmlMessages_warnClass_DisplayName"));
311: prop_warnClass.setShortDescription(resources
312: .getString("HtmlMessages_warnClass_Description"));
313: prop_warnClass
314: .setPropertyEditorClass(com.sun.rave.propertyeditors.StyleClassPropertyEditor.class);
315: prop_warnClass.setExpert(false);
316: prop_warnClass.setHidden(false);
317: prop_warnClass.setPreferred(false);
318: attrib = new AttributeDescriptor("warnClass", false, null,
319: true);
320: prop_warnClass.setValue(
321: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
322: attrib);
323: prop_warnClass
324: .setValue(
325: Constants.PropertyDescriptor.CATEGORY,
326: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
327:
328: PropertyDescriptor prop_warnStyle = new PropertyDescriptorBase(
329: "warnStyle", beanClass, "getWarnStyle",
330: "setWarnStyle");
331: prop_warnStyle.setDisplayName(resources
332: .getString("HtmlMessages_warnStyle_DisplayName"));
333: prop_warnStyle.setShortDescription(resources
334: .getString("HtmlMessages_warnStyle_Description"));
335: prop_warnStyle
336: .setPropertyEditorClass(com.sun.rave.propertyeditors.css.CssStylePropertyEditor.class);
337: prop_warnStyle.setExpert(false);
338: prop_warnStyle.setHidden(false);
339: prop_warnStyle.setPreferred(false);
340: attrib = new AttributeDescriptor("warnStyle", false, null,
341: true);
342: prop_warnStyle.setValue(
343: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
344: attrib);
345: prop_warnStyle
346: .setValue(
347: Constants.PropertyDescriptor.CATEGORY,
348: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
349:
350: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
351: propertyDescriptorList.add(prop_errorClass);
352: propertyDescriptorList.add(prop_errorStyle);
353: propertyDescriptorList.add(prop_fatalClass);
354: propertyDescriptorList.add(prop_fatalStyle);
355: propertyDescriptorList.add(prop_infoClass);
356: propertyDescriptorList.add(prop_infoStyle);
357: propertyDescriptorList.add(prop_layout);
358: propertyDescriptorList.add(prop_tooltip);
359: propertyDescriptorList.add(prop_warnClass);
360: propertyDescriptorList.add(prop_warnStyle);
361:
362: propertyDescriptorList.addAll(Properties
363: .getVisualPropertyList(beanClass));
364: propertyDescriptorList.addAll(Arrays.asList(super
365: .getPropertyDescriptors()));
366: propertyDescriptors = propertyDescriptorList
367: .toArray(new PropertyDescriptor[propertyDescriptorList
368: .size()]);
369: return propertyDescriptors;
370:
371: } catch (IntrospectionException e) {
372: e.printStackTrace();
373: return null;
374: }
375:
376: }
377:
378: }
|