1 | /* |
---|
2 | * $Id: PanelModelBeanInfo.java,v 1.5 2003/09/18 17:31:44 dwd Exp $ |
---|
3 | * |
---|
4 | * This software is provided by NOAA for full, free and open release. It is |
---|
5 | * understood by the recipient/user that NOAA assumes no liability for any |
---|
6 | * errors contained in the code. Although this software is released without |
---|
7 | * conditions or restrictions in its use, it is expected that appropriate |
---|
8 | * credit be given to its author and to the National Oceanic and Atmospheric |
---|
9 | * Administration should the software be included by the recipient as an |
---|
10 | * element in other product development. |
---|
11 | */ |
---|
12 | |
---|
13 | package gov.noaa.pmel.sgt.beans; |
---|
14 | |
---|
15 | import java.beans.*; |
---|
16 | |
---|
17 | /** |
---|
18 | * @author Donald Denbo |
---|
19 | * @version $Revision: 1.5 $, $Date: 2003/09/18 17:31:44 $ |
---|
20 | * @since 3.0 |
---|
21 | */ |
---|
22 | public class PanelModelBeanInfo extends SimpleBeanInfo { |
---|
23 | private Class beanClass = PanelModel.class; |
---|
24 | private Class customizerClass = PanelModelCustomizer.class; |
---|
25 | private String iconColor16x16Filename = "PanelModelIcon16.gif"; |
---|
26 | private String iconColor32x32Filename = "PanelModelIcon32.gif"; |
---|
27 | private String iconMono16x16Filename; |
---|
28 | private String iconMono32x32Filename; |
---|
29 | |
---|
30 | public PanelModelBeanInfo() { |
---|
31 | } |
---|
32 | |
---|
33 | public BeanDescriptor getBeanDescriptor() { |
---|
34 | return new BeanDescriptor(beanClass, customizerClass); |
---|
35 | } |
---|
36 | |
---|
37 | public PropertyDescriptor[] getPropertyDescriptors() { |
---|
38 | try { |
---|
39 | PropertyDescriptor _batch = new PropertyDescriptor("batch", beanClass, null, null); |
---|
40 | _batch.setValue("transient", Boolean.TRUE); |
---|
41 | PropertyDescriptor _dpi = new PropertyDescriptor("dpi", beanClass, "getDpi", "setDpi"); |
---|
42 | PropertyDescriptor _modified = new PropertyDescriptor("modified", beanClass, null, null); |
---|
43 | _modified.setValue("transient", Boolean.TRUE); |
---|
44 | PropertyDescriptor _page = new PropertyDescriptor("page", beanClass, "getPage", "setPage"); |
---|
45 | _page.setValue("transient", Boolean.TRUE); |
---|
46 | PropertyDescriptor _panelList = new PropertyDescriptor("panelList", beanClass, "getPanelList", "setPanelList"); |
---|
47 | PropertyDescriptor _panelCount = new PropertyDescriptor("panelCount", beanClass, "getPanelCount", null); |
---|
48 | PropertyDescriptor _pageSize = new PropertyDescriptor("pageSize", beanClass, "getPageSize", "setPageSize"); |
---|
49 | PropertyDescriptor _pageBackgroundColor = |
---|
50 | new PropertyDescriptor("pageBackgroundColor", beanClass, "getPageBackgroundColor", "setPageBackgroundColor"); |
---|
51 | PropertyDescriptor _printWhitePage = |
---|
52 | new PropertyDescriptor("printWhitePage", beanClass, "isPrintWhitePage", "setPrintWhitePage"); |
---|
53 | PropertyDescriptor _printBorders = |
---|
54 | new PropertyDescriptor("printBorders", beanClass, "isPrintBorders", "setPrintBorders"); |
---|
55 | PropertyDescriptor _pageHAlign = |
---|
56 | new PropertyDescriptor("printHAlign", beanClass, "getPrintHAlign", "setPrintHAlign"); |
---|
57 | PropertyDescriptor _pageVAlign = |
---|
58 | new PropertyDescriptor("printVAlign", beanClass, "getPrintVAlign", "setPrintVAlign"); |
---|
59 | PropertyDescriptor _printMode = |
---|
60 | new PropertyDescriptor("printScaleMode", beanClass, "getPrintScaleMode", "setPrintScaleMode"); |
---|
61 | PropertyDescriptor _pageOrigin = |
---|
62 | new PropertyDescriptor("printOrigin", beanClass, "getPrintOrigin", "setPrintOrigin"); |
---|
63 | PropertyDescriptor[] pds = new PropertyDescriptor[] { |
---|
64 | _batch, |
---|
65 | _dpi, |
---|
66 | _modified, |
---|
67 | _page, |
---|
68 | _pageBackgroundColor, |
---|
69 | _pageSize, |
---|
70 | _panelList, |
---|
71 | _panelCount, |
---|
72 | _printWhitePage, |
---|
73 | _printBorders, |
---|
74 | _pageHAlign, |
---|
75 | _pageVAlign, |
---|
76 | _printMode, |
---|
77 | _pageOrigin}; |
---|
78 | return pds; |
---|
79 | } |
---|
80 | catch(IntrospectionException ex) { |
---|
81 | ex.printStackTrace(); |
---|
82 | return null; |
---|
83 | } |
---|
84 | } |
---|
85 | public java.awt.Image getIcon(int iconKind) { |
---|
86 | switch (iconKind) { |
---|
87 | case BeanInfo.ICON_COLOR_16x16: |
---|
88 | return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null; |
---|
89 | case BeanInfo.ICON_COLOR_32x32: |
---|
90 | return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null; |
---|
91 | case BeanInfo.ICON_MONO_16x16: |
---|
92 | return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null; |
---|
93 | case BeanInfo.ICON_MONO_32x32: |
---|
94 | return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null; |
---|
95 | } |
---|
96 | return null; |
---|
97 | } |
---|
98 | } |
---|