KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > text > PrintSettingsBeanInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.openide.text;
20
21
22 import java.awt.Image JavaDoc;
23 import java.beans.*;
24 import org.openide.util.*;
25
26
27 /** BeanInfo for PrintSettings.
28 *
29 * @author Ales Novak
30 */

31 public class PrintSettingsBeanInfo extends SimpleBeanInfo {
32     /** Returns the PrintSettings' icon */
33     public Image JavaDoc getIcon(int type) {
34         return Utilities.loadImage("org/openide/text/printSettings.gif"); // NOI18N
35
}
36
37     /** Descriptor of valid properties
38     * @return array of properties
39     */

40     public PropertyDescriptor[] getPropertyDescriptors() {
41         try {
42             PropertyDescriptor[] desc = new PropertyDescriptor[] {
43                     new PropertyDescriptor(PrintSettings.PROP_WRAP, PrintSettings.class), // 0
44
new PropertyDescriptor(PrintSettings.PROP_HEADER_FORMAT, PrintSettings.class), // 1
45
new PropertyDescriptor(PrintSettings.PROP_FOOTER_FORMAT, PrintSettings.class), // 2
46
new PropertyDescriptor(PrintSettings.PROP_HEADER_FONT, PrintSettings.class), // 3
47
new PropertyDescriptor(PrintSettings.PROP_FOOTER_FONT, PrintSettings.class), // 4
48
new PropertyDescriptor(PrintSettings.PROP_HEADER_ALIGNMENT, PrintSettings.class), // 5
49
new PropertyDescriptor(PrintSettings.PROP_FOOTER_ALIGNMENT, PrintSettings.class), // 6
50

51                     // new PropertyDescriptor(PrintSettings.PROP_PAGE_FORMAT, PrintSettings.class), // 7
52
new PropertyDescriptor(PrintSettings.PROP_LINE_ASCENT_CORRECTION, PrintSettings.class) // 8
53
};
54             desc[0].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_WRAP"));
55             desc[0].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_WRAP"));
56             desc[1].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FORMAT"));
57             desc[1].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FORMAT"));
58             desc[2].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FORMAT"));
59             desc[2].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FORMAT"));
60             desc[3].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FONT"));
61             desc[3].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FONT"));
62             desc[4].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FONT"));
63             desc[4].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FONT"));
64             desc[5].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_ALIGNMENT"));
65             desc[5].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_ALIGNMENT"));
66             desc[5].setPropertyEditorClass(PrintSettings.AlignmentEditor.class);
67             desc[6].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_ALIGNMENT"));
68             desc[6].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_ALIGNMENT"));
69             desc[6].setPropertyEditorClass(PrintSettings.AlignmentEditor.class);
70
71             /*
72             desc[7].setDisplayName(PrintSettings.getString("PROP_PAGE_FORMAT"));
73             desc[7].setShortDescription(PrintSettings.getString("HINT_PAGE_FORMAT"));
74             desc[7].setPropertyEditorClass(PrintSettings.PageFormatEditor.class);
75             */

76             desc[7].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_LINE_ASCENT_CORRECTION"));
77             desc[7].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_LINE_ASCENT_CORRECTION"));
78
79             return desc;
80         } catch (IntrospectionException ex) {
81             Exceptions.printStackTrace(ex);
82
83             return null;
84         }
85     }
86 }
87
Popular Tags