01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2004 TOPP - www.openplans.org
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.validation.relate;
18:
19: import java.beans.IntrospectionException;
20: import java.beans.PropertyDescriptor;
21: import java.util.ResourceBundle;
22:
23: import org.geotools.validation.DefaultIntegrityValidationBeanInfo;
24:
25: /**
26: * @author bowens
27: *
28: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/validation/src/main/java/org/geotools/validation/relate/RelationIntegrityBeanInfo.java $
29: */
30: public abstract class RelationIntegrityBeanInfo extends
31: DefaultIntegrityValidationBeanInfo {
32:
33: /**
34: *
35: */
36: public RelationIntegrityBeanInfo() {
37: super ();
38: }
39:
40: /**
41: *
42: *
43: * (non-Javadoc)
44: * @see java.beans.BeanInfo#getPropertyDescriptors()
45: **/
46: public PropertyDescriptor[] getPropertyDescriptors() {
47: PropertyDescriptor[] pd2 = super .getPropertyDescriptors();
48: ResourceBundle resourceBundle = getResourceBundle(RelationIntegrity.class);
49: if (pd2 == null) {
50: pd2 = new PropertyDescriptor[0];
51: }
52:
53: PropertyDescriptor[] pd = new PropertyDescriptor[pd2.length + 3];
54: int i = 0;
55:
56: for (; i < pd2.length; i++)
57: pd[i] = pd2[i];
58:
59: try {
60: pd[i] = createPropertyDescriptor("expected", resourceBundle);
61: pd[i].setExpert(false);
62:
63: pd[i + 1] = createPropertyDescriptor("geomTypeRefA",
64: resourceBundle);
65: pd[i + 1].setExpert(false);
66:
67: pd[i + 2] = createPropertyDescriptor("geomTypeRefB",
68: resourceBundle);
69: pd[i + 2].setExpert(false);
70: } catch (IntrospectionException e) {
71: pd = pd2;
72:
73: // TODO error, log here
74: e.printStackTrace();
75: }
76:
77: return pd;
78: }
79:
80: }
|