Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / attributes / DefaultAttributeDescriptor.java @ 24060

History | View | Annotate | Download (2.26 KB)

1
package org.gvsig.tools.attributes;
2

    
3
import org.gvsig.tools.attributes.AttributeDescriptor;
4

    
5
public class DefaultAttributeDescriptor implements AttributeDescriptor {
6
        private int dataType;
7
        private String name;
8
        private Object defaultValue;
9

    
10
        private int availableValuesType;
11
        private Object[] availableValues;
12
        private Object minValue;
13
        private Object maxValue;
14
        Object value;
15
        private String description;
16

    
17
        DefaultAttributeDescriptor(String name, int dataType, String description,
18
                        Object defaultValue) {
19
                this.name = name;
20
                this.description = description;
21
                this.dataType = dataType;
22
                this.defaultValue = defaultValue;
23
                this.availableValuesType = SINGLE;
24

    
25
                this.minValue = null;
26
                this.maxValue = null;
27
                this.availableValues = null;
28

    
29
                this.value = defaultValue;
30

    
31
        }
32

    
33
        DefaultAttributeDescriptor(String name, int dataType, String description,
34
                        Object defaultValue, Object[] avaliableValues) {
35
                this.name = name;
36
                this.description = description;
37
                this.dataType = dataType;
38
                this.defaultValue = defaultValue;
39
                this.availableValuesType = CHOICE;
40
                this.availableValues = avaliableValues;
41
                this.minValue = null;
42
                this.maxValue = null;
43

    
44
                this.value = defaultValue;
45
        }
46

    
47
        DefaultAttributeDescriptor(String name, int dataType, String description,
48
                        Object defaultValue, Object minValue, Object maxValue) {
49
                this.name = name;
50
                this.description = description;
51
                this.dataType = dataType;
52
                this.defaultValue = defaultValue;
53
                this.availableValuesType = RANGE;
54
                this.availableValues = null;
55
                this.minValue = minValue;
56
                this.maxValue = maxValue;
57

    
58
                this.value = defaultValue;
59
        }
60

    
61
        public Object[] getAvailableValues() {
62
                return this.availableValues;
63
        }
64

    
65
        public Object getDefaultValue() {
66
                return this.defaultValue;
67
        }
68

    
69
        public String getName() {
70
                return this.name;
71
        }
72

    
73
        public int getDataType() {
74
                return this.dataType;
75
        }
76

    
77
        public void clear() {
78
                value = defaultValue;
79
        }
80

    
81
        public Object getValue() {
82
                return value;
83
        }
84

    
85
        public void setValue(Object value) {
86
                // FIXME: hacer comprobaciones de tipos.
87
                this.value = value;
88
        }
89

    
90
        public int getAvailableValuesType() {
91
                return this.availableValuesType;
92
        }
93

    
94
        public String getDescription() {
95
                return this.description;
96
        }
97

    
98
        public Object getMaxValue() {
99
                return this.maxValue;
100
        }
101

    
102
        public Object getMinValue() {
103
                return this.minValue;
104
        }
105

    
106
}