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