Revision 21743 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/gui/filter/DefaultExpressionDataSource.java

View differences:

DefaultExpressionDataSource.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.filter;
42 42

  
43
import org.gvsig.fmap.datasources.SelectableDataSource;
43
import org.gvsig.data.ReadException;
44
import org.gvsig.data.vectorial.FeatureAttributeDescriptor;
45
import org.gvsig.data.vectorial.FeatureStore;
44 46

  
45
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
46
import com.hardcode.gdbms.engine.values.Value;
47 47

  
48

  
49 48
/**
50 49
 * DOCUMENT ME!
51 50
 *
52 51
 * @author Fernando Gonz?lez Cort?s
53 52
 */
54 53
public class DefaultExpressionDataSource implements ExpressionDataSource {
55
    private SelectableDataSource tabla = null;
54
    private FeatureStore featureStore = null;
56 55

  
57 56
    /**
58 57
     * DOCUMENT ME!
59 58
     *
60 59
     * @param table DOCUMENT ME!
61 60
     */
62
    public void setTable(SelectableDataSource table) {
63
        this.tabla = table;
61
    public void setTable(FeatureStore fs) {
62
        this.featureStore = fs;
64 63
    }
65
    public void start() throws ReadDriverException
66
    {
67
        tabla.start();
68
    }
69
    public void stop() throws ReadDriverException
70
    {
71
        tabla.stop();
72
    }
64
//    public void start() throws ReadDriverException
65
//    {
66
//        tabla.start();
67
//    }
68
//    public void stop() throws ReadDriverException
69
//    {
70
//        tabla.stop();
71
//    }
73 72

  
74 73
    /**
75 74
     * DOCUMENT ME!
......
80 79
     * @throws FilterException
81 80
     */
82 81
    public String getFieldName(int idField) throws FilterException {
83
        try {
84
			return tabla.getFieldName(idField);
85
		} catch (ReadDriverException e) {
86
			throw new FilterException();
87
		}
82
//        try {
83
			return ((FeatureAttributeDescriptor)featureStore.getDefaultFeatureType().get(idField)).getName();
84
//		} catch (ReadException e) {
85
//			throw new FilterException();
86
//		}
88 87
    }
89 88

  
90 89
    /**
......
94 93
     * @throws FilterException
95 94
     */
96 95
    public int getFieldCount() throws FilterException {
97
        try {
98
			return tabla.getFieldCount();
99
		} catch (ReadDriverException e) {
100
			throw new FilterException();
101
		}
96
//        try {
97
			return featureStore.getDefaultFeatureType().size();
98
//		} catch (ReadException e) {
99
//			throw new FilterException();
100
//		}
102 101
    }
103 102

  
104 103
    /**
......
109 108
     * @return
110 109
     * @throws FilterException
111 110
     */
112
    public Value getFieldValue(int row, int field) throws FilterException {
111
    public Object getFieldValue(int row, int field) throws FilterException {
113 112
    	try {
114
			return tabla.getFieldValue(row, field);
113
			return featureStore.getFieldValue(row, field);
115 114
		} catch (ReadDriverException e) {
116 115
			throw new FilterException();
117 116
		}
......
124 123
		try {
125 124
			return (int) tabla.getRowCount();
126 125

  
127
		} catch (ReadDriverException e) {
126
		} catch (ReadException e) {
128 127
			throw new FilterException();
129 128
		}
130 129
	}

Also available in: Unified diff