Revision 45393

View differences:

branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataServerExplorerPoolEntry.java
4 4
package org.gvsig.fmap.dal;
5 5

  
6 6
import org.gvsig.tools.persistence.Persistent;
7
import org.gvsig.tools.util.LabeledValue;
7 8

  
8 9

  
9 10

  
10
public interface DataServerExplorerPoolEntry extends Persistent {
11
public interface DataServerExplorerPoolEntry extends Persistent, LabeledValue<DataServerExplorerPoolEntry> {
11 12
    
12 13
    public String getName();
13 14

  
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureQuery.java
303 303
   * @return a Map with the aggregate function by attribute
304 304
   */
305 305
  public Map<String,String> getAggregateFunctions();
306
  
307
  public void addAggregate(String funcName, String columnName);
306 308

  
307 309
  @Deprecated
308 310
  public String getAggregate(String name);
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/spi/DataServerExplorerPoolEntryImpl.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.fmap.dal.spi;
7

  
8
import org.gvsig.fmap.dal.DataServerExplorerParameters;
9
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry;
10
import org.gvsig.tools.ToolsLocator;
11
import org.gvsig.tools.dynobject.DynStruct;
12
import org.gvsig.tools.persistence.PersistenceManager;
13
import org.gvsig.tools.persistence.PersistentState;
14
import org.gvsig.tools.persistence.exception.PersistenceException;
15

  
16
/**
17
 *
18
 * @author gvSIG Team
19
 */
20
public class DataServerExplorerPoolEntryImpl implements DataServerExplorerPoolEntry {
21

  
22
    private static final String PERSISTENCE_DEFINITION_NAME = "DataServerExplorerPoolEntry";
23

  
24
    protected String name;
25
    protected String description;
26
    protected DataServerExplorerParameters explorer;
27

  
28
    public DataServerExplorerPoolEntryImpl() {
29
        // Required by Persistent 
30
    }
31
    
32
    public DataServerExplorerPoolEntryImpl(String name, String description, DataServerExplorerParameters explorer) {
33
        this.name = name;
34
        this.description = description;
35
        this.explorer = explorer;
36

  
37
    }
38

  
39
    @Override
40
    public String getName() {
41
        return this.name;
42
    }
43

  
44
    @Override
45
    public void copyTo(DataServerExplorerPoolEntry target) {
46
        DataServerExplorerPoolEntryImpl other = (DataServerExplorerPoolEntryImpl)target;
47
        other.name = this.name;
48
        other.description = this.description;
49
        other.explorer = this.explorer;                 
50
    }
51
    
52
    @Override
53
    public DataServerExplorerParameters getExplorerParameters() {
54
        return this.explorer;
55
    }
56

  
57
    @Override
58
    public String getDescription() {
59
        return this.description;
60
    }
61

  
62
    @Override
63
    public void saveToState(PersistentState state) throws PersistenceException {
64
        state.set("name", this.name);
65
        state.set("description", this.description);
66
        state.set("explorer", this.explorer);
67
    }
68

  
69
    @Override
70
    public void loadFromState(PersistentState state) throws PersistenceException {
71
        this.description = state.getString("description");
72
        this.name = state.getString("name");
73
        this.explorer = (DataServerExplorerParameters) state.get("explorer");
74
    }
75

  
76
    public static void registerPersistenceDefinition() {
77
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
78
        if ( manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null ) {
79
            DynStruct definition
80
                    = manager.addDefinition(DataServerExplorerPoolEntryImpl.class,
81
                            PERSISTENCE_DEFINITION_NAME, PERSISTENCE_DEFINITION_NAME
82
                            + " Persistent definition", null, null);
83

  
84
            definition.addDynFieldString("name")
85
                    .setMandatory(true)
86
                    .setPersistent(true);
87
            
88
            definition.addDynFieldString("description")
89
                    .setMandatory(false)
90
                    .setPersistent(true);
91
            
92
            definition.addDynFieldObject("explorer")
93
                    .setClassOfValue(DataServerExplorerParameters.class)
94
                    .setMandatory(true)
95
                    .setPersistent(true);
96
        }
97
    }
98

  
99
    @Override
100
    public String getLabel() {
101
        return this.getName();
102
    }
103

  
104
    @Override
105
    public DataServerExplorerPoolEntry getValue() {
106
        return this;
107
    }
108

  
109
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/spi/DataServerExplorerPoolImpl.java
1
package org.gvsig.fmap.dal.spi;
2

  
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.List;
6
import org.apache.commons.lang3.StringUtils;
7
import org.gvsig.fmap.dal.DataServerExplorerParameters;
8
import org.gvsig.fmap.dal.DataServerExplorerPool;
9
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry;
10
import org.gvsig.tools.ToolsLocator;
11
import org.gvsig.tools.dynobject.DynStruct;
12
import org.gvsig.tools.persistence.PersistenceManager;
13
import org.gvsig.tools.persistence.PersistentState;
14
import org.gvsig.tools.persistence.exception.PersistenceException;
15

  
16
public class DataServerExplorerPoolImpl implements DataServerExplorerPool {
17

  
18
    
19
    private static final String PERSISTENCE_DEFINITION_NAME = "DataServerExplorerPool";
20

  
21
    private List<DataServerExplorerPoolEntry> pool;
22

  
23
    public DataServerExplorerPoolImpl() {
24
        this.pool = new ArrayList();
25
    }
26

  
27
    @Override
28
    public boolean contains(String name) {
29
        DataServerExplorerPoolEntry entry = this.get(name);
30
        return entry!=null;
31
    }
32
    
33
    @Override
34
    public boolean contains(DataServerExplorerPoolEntry entry) {
35
        return contains(entry.getName());
36
    }
37
    
38
    @Override
39
    public boolean isEmpty() {
40
        return this.pool.isEmpty();
41
    }
42
    
43
    @Override
44
    public DataServerExplorerPoolEntry createEntry(String name, String description, DataServerExplorerParameters explorer) {
45
        DataServerExplorerPoolEntryImpl entry = new DataServerExplorerPoolEntryImpl(name, description, explorer);
46
        return entry;
47
    }
48

  
49
    @Override
50
    public void add(String name, DataServerExplorerParameters explorer) {
51
        this.add(name, null, explorer);
52
    }
53

  
54
    @Override
55
    public void add(String name, String description, DataServerExplorerParameters explorer) {
56
        DataServerExplorerPoolEntry newexplorer = createEntry(name, description, explorer);
57
        DataServerExplorerPoolEntry existent = this.get(name);
58
        if( existent!=null ) {
59
            newexplorer.copyTo(existent);
60
        } else {
61
            this.pool.add(newexplorer);
62
        }
63
    }
64

  
65
    @Override
66
    public void remove(DataServerExplorerPoolEntry entry) {
67
        this.remove(entry.getName());
68
    }
69

  
70
    @Override
71
    public void remove(int explorerIndex) {
72
        this.pool.remove(explorerIndex);
73
    }
74

  
75
    @Override
76
    public void remove(String name) {
77
        if( StringUtils.isBlank(name) ) {
78
            return;
79
        }
80
        for( int i=0; i<this.pool.size(); i++ ) {
81
            DataServerExplorerPoolEntry entry = (DataServerExplorerPoolEntry) this.pool.get(i);
82
            if( name.equalsIgnoreCase(entry.getName()) ) {
83
                this.remove(i);
84
            }
85
        }
86
    }
87
    
88
    @Override
89
    public int size() {
90
        return this.pool.size();
91
    }
92

  
93
    @Override
94
    public DataServerExplorerPoolEntry get(int index) {
95
        return (DataServerExplorerPoolEntry) this.pool.get(index);
96
    }
97

  
98
    @Override
99
    public DataServerExplorerPoolEntry get(String name) {
100
        if( StringUtils.isBlank(name) ) {
101
            return null;
102
        }
103
        for( int i=0; i<this.pool.size(); i++ ) {
104
            DataServerExplorerPoolEntry entry = (DataServerExplorerPoolEntry) this.pool.get(i);
105
            if( name.equalsIgnoreCase(entry.getName()) ) {
106
                return entry;
107
            }
108
        }
109
        return null;
110
    }
111

  
112
    @Override
113
    public Iterator iterator() {
114
        return this.pool.iterator();
115
    }
116

  
117
    @Override
118
    public void saveToState(PersistentState state) throws PersistenceException {
119
        state.set("pool", pool);
120
    }
121

  
122
    @Override
123
    public void loadFromState(PersistentState state) throws PersistenceException {
124
        List l = state.getList("pool");
125
        this.pool = new ArrayList();
126
        this.pool.addAll(l);
127
    }
128

  
129
    public static void registerPersistenceDefinition() {
130
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
131
        if ( manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null ) {
132
            DynStruct definition
133
                    = manager.addDefinition(DataServerExplorerPoolImpl.class,
134
                            PERSISTENCE_DEFINITION_NAME, PERSISTENCE_DEFINITION_NAME
135
                            + " Persistent definition", null, null);
136

  
137
            definition.addDynFieldList("pool")
138
                    .setClassOfItems(DataServerExplorerPoolEntryImpl.class)
139
                    .setMandatory(true)
140
                    .setPersistent(true);
141
        }
142
    }
143

  
144
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
744 744
  }
745 745

  
746 746
  @Override
747
  public void addAggregate(String funcName, String columnName) {
748
        Map<String, String> aggregateds = this.getAggregateFunctions();
749
        aggregateds.put(columnName, funcName);
750
  }
751

  
752
  @Override
747 753
  public Map<String, String> getAggregateFunctions() {
748 754
    if( this.aggregateFunctions == null ) {
749 755
      this.aggregateFunctions = new HashMap<>();
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerPool.java
1
package org.gvsig.fmap.dal.impl;
2

  
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.List;
6
import org.apache.commons.lang3.StringUtils;
7
import org.gvsig.fmap.dal.DataServerExplorerParameters;
8
import org.gvsig.fmap.dal.DataServerExplorerPool;
9
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry;
10
import org.gvsig.tools.ToolsLocator;
11
import org.gvsig.tools.dynobject.DynStruct;
12
import org.gvsig.tools.persistence.PersistenceManager;
13
import org.gvsig.tools.persistence.PersistentState;
14
import org.gvsig.tools.persistence.exception.PersistenceException;
15

  
16
public class DefaultDataServerExplorerPool implements DataServerExplorerPool {
17

  
18
    
19
    private static final String PERSISTENCE_DEFINITION_NAME = "DataServerExplorerPool";
20

  
21
    private List pool;
22

  
23
    public DefaultDataServerExplorerPool() {
24
        this.pool = new ArrayList();
25
    }
26

  
27
    public boolean contains(String name) {
28
        DataServerExplorerPoolEntry entry = this.get(name);
29
        return entry!=null;
30
    }
31
    
32
    public boolean contains(DataServerExplorerPoolEntry entry) {
33
        return contains(entry.getName());
34
    }
35
    
36
    public boolean isEmpty() {
37
        return this.pool.isEmpty();
38
    }
39
    
40
    public DataServerExplorerPoolEntry createEntry(String name, String description, DataServerExplorerParameters explorer) {
41
        DefaultDataServerExplorerPoolEntry entry = new DefaultDataServerExplorerPoolEntry(name, description, explorer);
42
        return entry;
43
    }
44

  
45
    @Override
46
    public void add(String name, DataServerExplorerParameters explorer) {
47
        this.add(name, null, explorer);
48
    }
49

  
50
    @Override
51
    public void add(String name, String description, DataServerExplorerParameters explorer) {
52
        DataServerExplorerPoolEntry newexplorer = createEntry(name, description, explorer);
53
        DataServerExplorerPoolEntry existent = this.get(name);
54
        if( existent!=null ) {
55
            newexplorer.copyTo(existent);
56
        } else {
57
            this.pool.add(newexplorer);
58
        }
59
    }
60

  
61
    @Override
62
    public void remove(DataServerExplorerPoolEntry entry) {
63
        this.remove(entry.getName());
64
    }
65

  
66
    @Override
67
    public void remove(int explorerIndex) {
68
        this.pool.remove(explorerIndex);
69
    }
70

  
71
    @Override
72
    public void remove(String name) {
73
        if( StringUtils.isBlank(name) ) {
74
            return;
75
        }
76
        for( int i=0; i<this.pool.size(); i++ ) {
77
            DataServerExplorerPoolEntry entry = (DataServerExplorerPoolEntry) this.pool.get(i);
78
            if( name.equalsIgnoreCase(entry.getName()) ) {
79
                this.remove(i);
80
            }
81
        }
82
    }
83
    
84
    @Override
85
    public int size() {
86
        return this.pool.size();
87
    }
88

  
89
    @Override
90
    public DataServerExplorerPoolEntry get(int index) {
91
        return (DataServerExplorerPoolEntry) this.pool.get(index);
92
    }
93

  
94
    @Override
95
    public DataServerExplorerPoolEntry get(String name) {
96
        if( StringUtils.isBlank(name) ) {
97
            return null;
98
        }
99
        for( int i=0; i<this.pool.size(); i++ ) {
100
            DataServerExplorerPoolEntry entry = (DataServerExplorerPoolEntry) this.pool.get(i);
101
            if( name.equalsIgnoreCase(entry.getName()) ) {
102
                return entry;
103
            }
104
        }
105
        return null;
106
    }
107

  
108
    @Override
109
    public Iterator iterator() {
110
        return this.pool.iterator();
111
    }
112

  
113
    @Override
114
    public void saveToState(PersistentState state) throws PersistenceException {
115
        state.set("pool", pool);
116
    }
117

  
118
    @Override
119
    public void loadFromState(PersistentState state) throws PersistenceException {
120
        List l = state.getList("pool");
121
        this.pool = new ArrayList();
122
        this.pool.addAll(l);
123
    }
124

  
125
    public static void registerPersistenceDefinition() {
126
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
127
        if ( manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null ) {
128
            DynStruct definition
129
                    = manager.addDefinition(DefaultDataServerExplorerPool.class,
130
                            PERSISTENCE_DEFINITION_NAME, PERSISTENCE_DEFINITION_NAME
131
                            + " Persistent definition", null, null);
132

  
133
            definition.addDynFieldList("pool")
134
                    .setClassOfItems(DefaultDataServerExplorerPoolEntry.class)
135
                    .setMandatory(true)
136
                    .setPersistent(true);
137
        }
138
    }
139

  
140
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerPoolEntry.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.fmap.dal.impl;
7

  
8
import org.gvsig.fmap.dal.DataServerExplorer;
9
import org.gvsig.fmap.dal.DataServerExplorerParameters;
10
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry;
11
import org.gvsig.tools.ToolsLocator;
12
import org.gvsig.tools.dynobject.DynStruct;
13
import org.gvsig.tools.persistence.PersistenceManager;
14
import org.gvsig.tools.persistence.PersistentState;
15
import org.gvsig.tools.persistence.exception.PersistenceException;
16

  
17
/**
18
 *
19
 * @author usuario
20
 */
21
public class DefaultDataServerExplorerPoolEntry implements DataServerExplorerPoolEntry {
22

  
23
    private static final String PERSISTENCE_DEFINITION_NAME = "DataServerExplorerPoolEntry";
24

  
25
    protected String name;
26
    protected String description;
27
    protected DataServerExplorerParameters explorer;
28

  
29
    public DefaultDataServerExplorerPoolEntry() {
30
        // Required by Persistent 
31
    }
32
    
33
    public DefaultDataServerExplorerPoolEntry(String name, String description, DataServerExplorerParameters explorer) {
34
        this.name = name;
35
        this.description = description;
36
        this.explorer = explorer;
37

  
38
    }
39

  
40
    @Override
41
    public String getName() {
42
        return this.name;
43
    }
44

  
45
    @Override
46
    public void copyTo(DataServerExplorerPoolEntry target) {
47
        DefaultDataServerExplorerPoolEntry other = (DefaultDataServerExplorerPoolEntry)target;
48
        other.name = this.name;
49
        other.description = this.description;
50
        other.explorer = this.explorer;                 
51
    }
52
    
53
    @Override
54
    public DataServerExplorerParameters getExplorerParameters() {
55
        return this.explorer;
56
    }
57

  
58
    @Override
59
    public String getDescription() {
60
        return this.description;
61
    }
62

  
63
    @Override
64
    public void saveToState(PersistentState state) throws PersistenceException {
65
        state.set("name", this.name);
66
        state.set("description", this.description);
67
        state.set("explorer", this.explorer);
68
    }
69

  
70
    @Override
71
    public void loadFromState(PersistentState state) throws PersistenceException {
72
        this.description = state.getString("description");
73
        this.name = state.getString("name");
74
        this.explorer = (DataServerExplorerParameters) state.get("explorer");
75
    }
76

  
77
    public static void registerPersistenceDefinition() {
78
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
79
        if ( manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null ) {
80
            DynStruct definition
81
                    = manager.addDefinition(DefaultDataServerExplorerPoolEntry.class,
82
                            PERSISTENCE_DEFINITION_NAME, PERSISTENCE_DEFINITION_NAME
83
                            + " Persistent definition", null, null);
84

  
85
            definition.addDynFieldString("name")
86
                    .setMandatory(true)
87
                    .setPersistent(true);
88
            
89
            definition.addDynFieldString("description")
90
                    .setMandatory(false)
91
                    .setPersistent(true);
92
            
93
            definition.addDynFieldObject("explorer")
94
                    .setClassOfValue(DataServerExplorerParameters.class)
95
                    .setMandatory(true)
96
                    .setPersistent(true);
97
        }
98
    }
99

  
100
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java
112 112
import org.gvsig.tools.dispose.DisposeUtils;
113 113
import org.gvsig.tools.observer.Observer;
114 114
import org.gvsig.fmap.dal.feature.FeatureSet.DisposableFeatureSetIterable;
115
import org.gvsig.fmap.dal.spi.DataServerExplorerPoolImpl;
115 116
import static org.gvsig.fmap.dal.spi.DataStoreProviderServices.PROVIDER_PARAMTER_NAME;
116 117
import org.gvsig.json.Json;
117 118

  
......
910 911
    @Override
911 912
    public DataServerExplorerPool getDataServerExplorerPool() {
912 913
        if (this.dataServerExplorerPool == null) {
913
            this.dataServerExplorerPool = new DefaultDataServerExplorerPool();
914
            this.dataServerExplorerPool = new DataServerExplorerPoolImpl();
914 915
        }
915 916
        return this.dataServerExplorerPool;
916 917
    }
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
66 66
import org.gvsig.fmap.dal.resource.spi.MultiResource;
67 67
import org.gvsig.fmap.dal.resource.spi.MultiResourceParameters;
68 68
import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
69
import org.gvsig.fmap.dal.spi.DataServerExplorerPoolEntryImpl;
70
import org.gvsig.fmap.dal.spi.DataServerExplorerPoolImpl;
69 71
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
70 72
import org.gvsig.i18n.Messages;
71 73
import org.gvsig.json.Json;
......
135 137
        DefaultFeatureExtraColumns.registerPersistent();
136 138

  
137 139
        DefaultFeatureStore.registerPersistenceDefinition();
138
        DefaultDataServerExplorerPool.registerPersistenceDefinition();
139
        DefaultDataServerExplorerPoolEntry.registerPersistenceDefinition();
140
        DataServerExplorerPoolImpl.registerPersistenceDefinition();
141
        DataServerExplorerPoolEntryImpl.registerPersistenceDefinition();
140 142
        
141 143
        DALFile.registerPersistenceDefinition();
142 144
        DefaultFeatureAttributeEmulatorExpression.selfRegister();
143 145

  
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/featuretable/SimpleFeaturesTableModel.java
1
/*
2
 * gvSIG. Desktop Geographic Information System.
3
 * 
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program 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
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License 
17
 * along with this program. If not, see <https://www.gnu.org/licenses/>. 
18
 * 
19
 * For any additional information, do not hesitate to contact us
20
 * at info AT gvsig.com, or visit our website www.gvsig.com.
21
 */
22
package org.gvsig.fmap.dal.swing.featuretable;
23

  
24
import java.util.Iterator;
25
import java.util.List;
26
import javax.swing.JTable;
27
import javax.swing.table.TableModel;
28
import org.gvsig.fmap.dal.feature.Feature;
29
import org.gvsig.tools.dispose.Disposable;
30
import org.gvsig.tools.util.UnmodifiableBasicList;
31

  
32
/**
33
 *
34
 * @author gvSIG Team
35
 */
36
public interface SimpleFeaturesTableModel extends TableModel, Disposable, UnmodifiableBasicList<Feature> {
37

  
38
    public List<Feature> getFeatures();
39

  
40
    public boolean hasErrors();
41

  
42
    public void setCellRenderers(JTable table);
43
    
44
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/SimpleFeaturesTableModel.java
1
package org.gvsig.fmap.dal.swing.impl.featuretable;
2

  
3
import java.math.BigDecimal;
4
import java.util.ArrayList;
5
import java.util.Date;
6
import java.util.Iterator;
7
import java.util.List;
8
import java.util.logging.Level;
9
import javax.swing.JTable;
10
import javax.swing.table.AbstractTableModel;
11
import javax.swing.table.DefaultTableCellRenderer;
12
import javax.swing.table.TableCellRenderer;
13
import org.gvsig.fmap.dal.complements.Search;
14
import org.gvsig.fmap.dal.exception.DataException;
15
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
16
import org.gvsig.fmap.dal.feature.Feature;
17
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
18
import org.gvsig.fmap.dal.feature.FeatureStore;
19
import org.gvsig.fmap.dal.feature.FeatureType;
20
import org.gvsig.fmap.dal.feature.paging.FacadeOfAFeaturePagingHelper;
21
import org.gvsig.tools.ToolsLocator;
22
import org.gvsig.tools.dataTypes.Coercion;
23
import org.gvsig.tools.dataTypes.CoercionException;
24
import org.gvsig.tools.dataTypes.DataTypes;
25
import org.gvsig.tools.dispose.Disposable;
26
import org.gvsig.tools.dispose.DisposeUtils;
27
import org.gvsig.tools.logger.FilteredLogger;
28
import org.gvsig.tools.util.UnmodifiableBasicList;
29
import org.slf4j.Logger;
30
import org.slf4j.LoggerFactory;
31

  
32
/**
33
 *
34
 * @author jjdelcerro
35
 */
36
public class SimpleFeaturesTableModel
37
        extends AbstractTableModel
38
        implements UnmodifiableBasicList<Feature>, Disposable {
39

  
40
    private static final Logger LOGGER = LoggerFactory.getLogger(SimpleFeaturesTableModel.class);
41

  
42
    private static class FeatureAttributeCellRenderer extends DefaultTableCellRenderer {
43

  
44
        private final FeatureAttributeDescriptor descriptor;
45
        private final Coercion toStr;
46

  
47
        public FeatureAttributeCellRenderer(FeatureAttributeDescriptor descriptor) {
48
            this.descriptor = descriptor;
49
            this.toStr = ToolsLocator.getDataTypesManager().get(DataTypes.STRING).getCoercion();
50
        }
51

  
52
        @Override
53
        protected void setValue(Object value) {
54
            if (value == null) {
55
                setText("");
56
            } else {
57
                try {
58
                    value = toStr.coerce(value);
59
                } catch (CoercionException ex) {
60
                    LOGGER.debug("Can't coerce value to string.", ex);
61
                }
62
                setText((String) value);
63
            }
64
        }
65

  
66
    }
67

  
68
    private List<Feature> features;
69
    private final List<String> columnNames;
70
    private final FeatureType featureType;
71
    private FilteredLogger logger;
72
    private boolean errors;
73

  
74
    public static void setCellRenderers(JTable table) {
75
        if (!(table.getModel() instanceof SimpleFeaturesTableModel)) {
76
            return;
77
        }
78
        SimpleFeaturesTableModel model = (SimpleFeaturesTableModel) table.getModel();
79
        for (String columnName : model.columnNames) {
80
            try {
81
                FeatureAttributeDescriptor descriptor = model.featureType.getAttributeDescriptor(columnName);
82
                if (descriptor == null) {
83
                    descriptor = model.featureType.getExtraColumns().get(columnName);
84
                }
85
                switch (descriptor.getType()) {
86
                    case DataTypes.BYTEARRAY:
87
                        table.setDefaultRenderer(byte[].class, new FeatureAttributeCellRenderer(descriptor));
88
                        break;
89
                    case DataTypes.DATE:
90
                        table.setDefaultRenderer(java.sql.Date.class, new FeatureAttributeCellRenderer(descriptor));
91
                        break;
92
                    case DataTypes.TIME:
93
                        table.setDefaultRenderer(java.sql.Time.class, new FeatureAttributeCellRenderer(descriptor));
94
                        break;
95
                    case DataTypes.TIMESTAMP:
96
                        table.setDefaultRenderer(java.util.Date.class, new FeatureAttributeCellRenderer(descriptor));
97
                        table.setDefaultRenderer(java.sql.Timestamp.class, new FeatureAttributeCellRenderer(descriptor));
98
                        break;
99
                    case DataTypes.FLOAT:
100
                        table.setDefaultRenderer(Float.class, new FeatureAttributeCellRenderer(descriptor));
101
                        break;
102
                    case DataTypes.DECIMAL:
103
                        table.setDefaultRenderer(BigDecimal.class, new FeatureAttributeCellRenderer(descriptor));
104
                        break;
105
                    case DataTypes.DOUBLE:
106
                        table.setDefaultRenderer(Double.class, new FeatureAttributeCellRenderer(descriptor));
107
                        break;
108
                }
109
            } catch (Exception ex) {
110
                throw new RuntimeException("Not able to get type of descriptor for column", ex);
111
            }
112
        }
113
    }
114

  
115
    public SimpleFeaturesTableModel(FeatureStore store) throws DataException {
116
        this(store.getDefaultFeatureType(), null, store.getFeatures());
117
    }
118

  
119
    public SimpleFeaturesTableModel(FeatureType featureType) {
120
        this(featureType, null, null);
121
        this.logger = new FilteredLogger(LOGGER, "SimpleFeaturesTableModel", 10);
122
    }
123

  
124
    public SimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) {
125
        this.logger = new FilteredLogger(LOGGER, "SimpleFeaturesTableModel", 10);
126
        this.features = features;
127
        this.featureType = featureType;
128
        this.errors = false;
129
        if (columnNames == null || columnNames.isEmpty()) {
130
            this.columnNames = new ArrayList<>();
131
            Search search = (Search) ToolsLocator.getComplementsManager().get(
132
                    Search.COMPLEMENT_MANE, featureType
133
            );
134
            List<Search.OrderedAttribute> attributos = search.getOrderedAttributes(
135
                    Search.BASIC_TYPES_FILTER,
136
                    Search.STR_INT_LONG_LABEL_ORDER,
137
                    12
138
            );
139
            for (Search.OrderedAttribute attrdesc : attributos) {
140
                this.columnNames.add(attrdesc.getDescriptor().getName());
141
            }
142
        } else {
143
            this.columnNames = columnNames;
144
        }
145
    }
146

  
147
    public List<Feature> getFeatures() {
148
        return this.features;
149
    }
150

  
151
    @Override
152
    public int getRowCount() {
153
        if (this.features == null) {
154
            return 0;
155
        }
156
        try {
157
            return this.features.size();
158
        } catch (Throwable ex) {
159
            this.errors = true;
160
            LOGGER.warn("Can't calculate row count.", ex);
161
            return 0;
162
        }
163
    }
164

  
165
    public boolean hasErrors() {
166
        return this.errors;
167
    }
168

  
169
    @Override
170
    public int getColumnCount() {
171
        return this.columnNames.size();
172
    }
173

  
174
    @Override
175
    public String getColumnName(int columnIndex) {
176
        String attrName = this.columnNames.get(columnIndex);
177
        if (this.featureType == null) {
178
            return attrName;
179
        }
180
        FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
181
        if (attrdesc == null) {
182
            EditableFeatureAttributeDescriptor extraCol = this.featureType.getExtraColumns().get(attrName);
183
            if (extraCol != null) {
184
                return extraCol.getLocalizedShortLabel();
185
            }
186
            if (attrName == null) {
187
                return "Column" + columnIndex;
188
            }
189
            return attrName;
190
        }
191
        return attrdesc.getLocalizedShortLabel();
192
    }
193

  
194
    @Override
195
    public Class<?> getColumnClass(int columnIndex) {
196
        if (this.featureType == null) {
197
            return String.class;
198
        }
199
        try {
200
            String attrName = this.columnNames.get(columnIndex);
201
            FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
202
            if (attrdesc == null) {
203
                int extraIndex = featureType.getExtraColumns().getIndexOf(attrName);
204
                if (extraIndex != -1) {
205
                    attrdesc = featureType.getExtraColumns().get(extraIndex);
206
                }
207
            }
208
            if (attrdesc == null) {
209
                return String.class;
210
            }
211
            if (attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList()) {
212
                return String.class;
213
            }
214
            Class theClass = attrdesc.getDataType().getDefaultClass();
215
            if (theClass == null) {
216
                return String.class;
217
            }
218
            return theClass;
219
        } catch (Exception ex) {
220
            return String.class;
221
        }
222
    }
223

  
224
    @Override
225
    public boolean isCellEditable(int rowIndex, int columnIndex) {
226
        return false;
227
    }
228

  
229
    @Override
230
    public Feature get(int position) {
231
        if (this.features == null) {
232
            return null;
233
        }
234
        Feature feature = this.features.get(position);
235
        return feature;
236
    }
237

  
238
    @Override
239
    public Object getValueAt(int rowIndex, int columnIndex) {
240
        if (this.features == null) {
241
            return null;
242
        }
243
        try {
244
            Feature feature = this.features.get(rowIndex);
245
            String attrName = this.columnNames.get(columnIndex);
246
            Object value = null;
247
            value = feature.get(attrName);
248
            FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
249
            if (attrdesc != null) {
250
                if (value == null) {
251
                    return null;
252
                }
253
                if (attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList()) {
254
                    value = attrdesc.getForeingKey().getLabelForValue(value);
255
                }
256
            }
257
            return value;
258
        } catch (Throwable th) {
259
            this.errors = true;
260
            logger.warn("Can't get cell value at " + rowIndex + ", " + columnIndex + ".", th);
261
            return null;
262
        }
263
    }
264

  
265
    @Override
266
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
267

  
268
    }
269

  
270
    @Override
271
    public List<Feature> toList() {
272
        return this.features;
273
    }
274

  
275
    @Override
276
    public boolean isEmpty() {
277
        return this.features.isEmpty();
278
    }
279

  
280
    @Override
281
    public int size() {
282
        return this.features.size();
283
    }
284

  
285
    @Override
286
    public Iterator<Feature> iterator() {
287
        return this.features.iterator();
288
    }
289

  
290
    @Override
291
    public void dispose() {
292
        if (this.features != null) {
293
            DisposeUtils.disposeQuietly(((FacadeOfAFeaturePagingHelper) features).getFeaturePagingHelper());
294
            this.features = null;
295
        }
296
        this.features = null;
297
    }
298

  
299
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/SimpleFeaturesTableModelImpl.java
1
package org.gvsig.fmap.dal.swing.impl.featuretable;
2

  
3
import org.gvsig.fmap.dal.swing.featuretable.SimpleFeaturesTableModel;
4
import java.math.BigDecimal;
5
import java.util.ArrayList;
6
import java.util.Iterator;
7
import java.util.List;
8
import javax.swing.JTable;
9
import javax.swing.table.AbstractTableModel;
10
import javax.swing.table.DefaultTableCellRenderer;
11
import org.gvsig.fmap.dal.complements.Search;
12
import org.gvsig.fmap.dal.exception.DataException;
13
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
14
import org.gvsig.fmap.dal.feature.Feature;
15
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
16
import org.gvsig.fmap.dal.feature.FeatureStore;
17
import org.gvsig.fmap.dal.feature.FeatureType;
18
import org.gvsig.fmap.dal.feature.paging.FacadeOfAFeaturePagingHelper;
19
import org.gvsig.tools.ToolsLocator;
20
import org.gvsig.tools.dataTypes.Coercion;
21
import org.gvsig.tools.dataTypes.CoercionException;
22
import org.gvsig.tools.dataTypes.DataTypes;
23
import org.gvsig.tools.dispose.DisposeUtils;
24
import org.gvsig.tools.logger.FilteredLogger;
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

  
28
/**
29
 *
30
 * @author jjdelcerro
31
 */
32
public class SimpleFeaturesTableModelImpl
33
        extends AbstractTableModel
34
        implements SimpleFeaturesTableModel {
35

  
36
    private static final Logger LOGGER = LoggerFactory.getLogger(SimpleFeaturesTableModelImpl.class);
37

  
38
    private static class FeatureAttributeCellRenderer extends DefaultTableCellRenderer {
39

  
40
        private final FeatureAttributeDescriptor descriptor;
41
        private final Coercion toStr;
42

  
43
        public FeatureAttributeCellRenderer(FeatureAttributeDescriptor descriptor) {
44
            this.descriptor = descriptor;
45
            this.toStr = ToolsLocator.getDataTypesManager().get(DataTypes.STRING).getCoercion();
46
        }
47

  
48
        @Override
49
        protected void setValue(Object value) {
50
            if (value == null) {
51
                setText("");
52
            } else {
53
                try {
54
                    value = toStr.coerce(value);
55
                } catch (CoercionException ex) {
56
                    LOGGER.debug("Can't coerce value to string.", ex);
57
                }
58
                setText((String) value);
59
            }
60
        }
61

  
62
    }
63

  
64
    private List<Feature> features;
65
    private final List<String> columnNames;
66
    private final FeatureType featureType;
67
    private FilteredLogger logger;
68
    private boolean errors;
69

  
70
    public SimpleFeaturesTableModelImpl(FeatureStore store) throws DataException {
71
        this(store.getDefaultFeatureType(), null, store.getFeatures());
72
    }
73

  
74
    public SimpleFeaturesTableModelImpl(FeatureType featureType) {
75
        this(featureType, null, null);
76
        this.logger = new FilteredLogger(LOGGER, "SimpleFeaturesTableModel", 10);
77
    }
78

  
79
    public SimpleFeaturesTableModelImpl(FeatureType featureType, List<String> columnNames, List<Feature> features) {
80
        this.logger = new FilteredLogger(LOGGER, "SimpleFeaturesTableModel", 10);
81
        this.features = features;
82
        this.featureType = featureType;
83
        this.errors = false;
84
        if (columnNames == null || columnNames.isEmpty()) {
85
            this.columnNames = new ArrayList<>();
86
            Search search = (Search) ToolsLocator.getComplementsManager().get(
87
                    Search.COMPLEMENT_MANE, featureType
88
            );
89
            List<Search.OrderedAttribute> attributos = search.getOrderedAttributes(
90
                    Search.BASIC_TYPES_FILTER,
91
                    Search.STR_INT_LONG_LABEL_ORDER,
92
                    12
93
            );
94
            for (Search.OrderedAttribute attrdesc : attributos) {
95
                this.columnNames.add(attrdesc.getDescriptor().getName());
96
            }
97
        } else {
98
            this.columnNames = columnNames;
99
        }
100
    }
101

  
102
    public void setCellRenderers(JTable table) {
103
        if ( table.getModel() != this ) {
104
            return;
105
        }
106
        for (String columnName : this.columnNames) {
107
            try {
108
                FeatureAttributeDescriptor descriptor = this.featureType.getAttributeDescriptor(columnName);
109
                if (descriptor == null) {
110
                    descriptor = this.featureType.getExtraColumns().get(columnName);
111
                }
112
                switch (descriptor.getType()) {
113
                    case DataTypes.BYTEARRAY:
114
                        table.setDefaultRenderer(byte[].class, new FeatureAttributeCellRenderer(descriptor));
115
                        break;
116
                    case DataTypes.DATE:
117
                        table.setDefaultRenderer(java.sql.Date.class, new FeatureAttributeCellRenderer(descriptor));
118
                        break;
119
                    case DataTypes.TIME:
120
                        table.setDefaultRenderer(java.sql.Time.class, new FeatureAttributeCellRenderer(descriptor));
121
                        break;
122
                    case DataTypes.TIMESTAMP:
123
                        table.setDefaultRenderer(java.util.Date.class, new FeatureAttributeCellRenderer(descriptor));
124
                        table.setDefaultRenderer(java.sql.Timestamp.class, new FeatureAttributeCellRenderer(descriptor));
125
                        break;
126
                    case DataTypes.FLOAT:
127
                        table.setDefaultRenderer(Float.class, new FeatureAttributeCellRenderer(descriptor));
128
                        break;
129
                    case DataTypes.DECIMAL:
130
                        table.setDefaultRenderer(BigDecimal.class, new FeatureAttributeCellRenderer(descriptor));
131
                        break;
132
                    case DataTypes.DOUBLE:
133
                        table.setDefaultRenderer(Double.class, new FeatureAttributeCellRenderer(descriptor));
134
                        break;
135
                }
136
            } catch (Exception ex) {
137
                throw new RuntimeException("Not able to get type of descriptor for column", ex);
138
            }
139
        }
140
    }
141

  
142
    @Override
143
    public List<Feature> getFeatures() {
144
        return this.features;
145
    }
146

  
147
    @Override
148
    public int getRowCount() {
149
        if (this.features == null) {
150
            return 0;
151
        }
152
        try {
153
            return this.features.size();
154
        } catch (Throwable ex) {
155
            this.errors = true;
156
            LOGGER.warn("Can't calculate row count.", ex);
157
            return 0;
158
        }
159
    }
160

  
161
    @Override
162
    public boolean hasErrors() {
163
        return this.errors;
164
    }
165

  
166
    @Override
167
    public int getColumnCount() {
168
        return this.columnNames.size();
169
    }
170

  
171
    @Override
172
    public String getColumnName(int columnIndex) {
173
        String attrName = this.columnNames.get(columnIndex);
174
        if (this.featureType == null) {
175
            return attrName;
176
        }
177
        FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
178
        if (attrdesc == null) {
179
            EditableFeatureAttributeDescriptor extraCol = this.featureType.getExtraColumns().get(attrName);
180
            if (extraCol != null) {
181
                return extraCol.getLocalizedShortLabel();
182
            }
183
            if (attrName == null) {
184
                return "Column" + columnIndex;
185
            }
186
            return attrName;
187
        }
188
        return attrdesc.getLocalizedShortLabel();
189
    }
190

  
191
    @Override
192
    public Class<?> getColumnClass(int columnIndex) {
193
        if (this.featureType == null) {
194
            return String.class;
195
        }
196
        try {
197
            String attrName = this.columnNames.get(columnIndex);
198
            FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
199
            if (attrdesc == null) {
200
                int extraIndex = featureType.getExtraColumns().getIndexOf(attrName);
201
                if (extraIndex != -1) {
202
                    attrdesc = featureType.getExtraColumns().get(extraIndex);
203
                }
204
            }
205
            if (attrdesc == null) {
206
                return String.class;
207
            }
208
            if (attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList()) {
209
                return String.class;
210
            }
211
            Class theClass = attrdesc.getDataType().getDefaultClass();
212
            if (theClass == null) {
213
                return String.class;
214
            }
215
            return theClass;
216
        } catch (Exception ex) {
217
            return String.class;
218
        }
219
    }
220

  
221
    @Override
222
    public boolean isCellEditable(int rowIndex, int columnIndex) {
223
        return false;
224
    }
225

  
226
    @Override
227
    public Feature get(int position) {
228
        if (this.features == null) {
229
            return null;
230
        }
231
        Feature feature = this.features.get(position);
232
        return feature;
233
    }
234

  
235
    @Override
236
    public Object getValueAt(int rowIndex, int columnIndex) {
237
        if (this.features == null) {
238
            return null;
239
        }
240
        try {
241
            Feature feature = this.features.get(rowIndex);
242
            String attrName = this.columnNames.get(columnIndex);
243
            Object value = null;
244
            value = feature.get(attrName);
245
            FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName);
246
            if (attrdesc != null) {
247
                if (value == null) {
248
                    return null;
249
                }
250
                if (attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList()) {
251
                    value = attrdesc.getForeingKey().getLabelForValue(value);
252
                }
253
            }
254
            return value;
255
        } catch (Throwable th) {
256
            this.errors = true;
257
            logger.warn("Can't get cell value at " + rowIndex + ", " + columnIndex + ".", th);
258
            return null;
259
        }
260
    }
261

  
262
    @Override
263
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
264

  
265
    }
266

  
267
    @Override
268
    public List<Feature> toList() {
269
        return this.features;
270
    }
271

  
272
    @Override
273
    public boolean isEmpty() {
274
        return this.features.isEmpty();
275
    }
276

  
277
    @Override
278
    public int size() {
279
        return this.features.size();
280
    }
281

  
282
    @Override
283
    public Iterator<Feature> iterator() {
284
        return this.features.iterator();
285
    }
286

  
287
    @Override
288
    public void dispose() {
289
        if (this.features != null) {
290
            DisposeUtils.disposeQuietly(((FacadeOfAFeaturePagingHelper) features).getFeaturePagingHelper());
291
            this.features = null;
292
        }
293
        this.features = null;
294
    }
295

  
296
}
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/searchpanel/DefaultSearchPanel.java
64 64
import org.gvsig.fmap.dal.swing.DALActionFactory;
65 65
import org.gvsig.fmap.dal.swing.DALSwingLocator;
66 66
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryCalculatedColumnsPanel;
67
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel;
67
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModelImpl;
68 68
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryGroupByPanel;
69 69
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel;
70 70
import org.gvsig.fmap.dal.swing.searchpanel.SearchConditionPanel;
......
85 85
import org.slf4j.LoggerFactory;
86 86
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryGroupByPanel;
87 87
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryOrderPanel;
88
import org.gvsig.fmap.dal.swing.featuretable.SimpleFeaturesTableModel;
88 89
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryCalculatedColumnsPanel;
89 90
import org.gvsig.fmap.dal.swing.featuretype.FeatureAttributesSelectionPanel;
90 91
import org.gvsig.fmap.dal.swing.searchpanel.SearchParameters;
......
732 733
                FacadeOfAFeaturePagingHelper facade = (FacadeOfAFeaturePagingHelper) features;
733 734
                FeatureType ftype = facade.getFeaturePagingHelper().getFeatureSet().getDefaultFeatureType();
734 735
                    // al modelo le pasamos el ftype de esas features
735
                    SimpleFeaturesTableModel tableModel = new SimpleFeaturesTableModel(
736
                    SimpleFeaturesTableModelImpl tableModel = new SimpleFeaturesTableModelImpl(
736 737
                            ftype,
737 738
                            resultColumnNames,
738 739
                            features
......
750 751
                        TableModel oldmodel = tblResults.getModel();
751 752
                        SimpleFeaturesTableModel m = (SimpleFeaturesTableModel) model.getValue();
752 753
                        tblResults.setModel(m);
753
                        SimpleFeaturesTableModel.setCellRenderers(tblResults);
754
                        if (oldmodel instanceof SimpleFeaturesTableModel) {
755
                            ((SimpleFeaturesTableModel) oldmodel).dispose();
754
                        m.setCellRenderers(tblResults);
755
                        if (oldmodel instanceof SimpleFeaturesTableModelImpl) {
756
                            ((SimpleFeaturesTableModelImpl) oldmodel).dispose();
756 757
                        }
757 758
                        if (m.hasErrors()) {
758 759
                            lblMsg.setText(i18n.getTranslation("_Errors_occurred_during_search"));
......
793 794
            
794 795
        }
795 796
        FeatureType ftype = this.store.getDefaultFeatureTypeQuietly();
796
        SimpleFeaturesTableModel emptyTableModel = new SimpleFeaturesTableModel(
797
        SimpleFeaturesTableModelImpl emptyTableModel = new SimpleFeaturesTableModelImpl(
797 798
                ftype,
798 799
                resultColumnNames,
799 800
                null
......
808 809
        if (this.conditionPanels == null) {
809 810
            return;
810 811
        }
811
        SimpleFeaturesTableModel model;
812
        SimpleFeaturesTableModelImpl model;
812 813
//        model = (SimpleFeaturesTableModel) this.tblResults.getModel();
813 814
        List<Feature> features = store.getFeatures(this.parameters.getQuery());
814 815
        FacadeOfAFeaturePagingHelper facade = (FacadeOfAFeaturePagingHelper) features;
815 816
        FeatureType ftype = facade.getFeaturePagingHelper().getFeatureSet().getDefaultFeatureType();
816
        model = new SimpleFeaturesTableModel(
817
        model = new SimpleFeaturesTableModelImpl(
817 818
                ftype,
818 819
                this.parameters.getResultColumnNames(),
819 820
                features
......
876 877
            return null;
877 878
        }
878 879
        try {
879
            List<Feature> features = ((SimpleFeaturesTableModel) this.tblResults.getModel()).getFeatures();
880
            List<Feature> features = ((SimpleFeaturesTableModelImpl) this.tblResults.getModel()).getFeatures();
880 881
            Feature feature = features.get(selectedRow);
881 882

  
882 883
            ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
branches/org.gvsig.desktop-cvsgis1/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/DefaultDataSwingManager.java
34 34
import javax.swing.JButton;
35 35
import javax.swing.JComboBox;
36 36
import javax.swing.JList;
37
import javax.swing.JTable;
37 38
import javax.swing.JTextField;
38 39
import javax.swing.ListCellRenderer;
39 40
import javax.swing.table.TableModel;
......
93 94
import org.gvsig.tools.exception.BaseException;
94 95
import org.gvsig.fmap.dal.swing.DALActionFactory;
95 96
import org.gvsig.fmap.dal.swing.DALActionFactory.DALActionContext;
96
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel;
97
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModelImpl;
97 98
import org.gvsig.fmap.dal.swing.impl.featuretype.FeatureAttributeListCellRenderer;
98 99
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributesSelectionPanel;
99 100
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionDialog;
......
387 388
    @Override
388 389
    public TableModel createSimpleFeaturesTableModel(FeatureStore store) {
389 390
        try {
390
            SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(store);
391
            SimpleFeaturesTableModelImpl m = new SimpleFeaturesTableModelImpl(store);
391 392
            return m;
392 393
        } catch (DataException ex) {
393 394
            throw new RuntimeException("Can't creatre SimpleFeaturesTableModel.", ex);
......
396 397
    
397 398
    @Override
398 399
    public TableModel createSimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) {
399
        SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(featureType, columnNames, features);
400
        SimpleFeaturesTableModelImpl m = new SimpleFeaturesTableModelImpl(featureType, columnNames, features);
400 401
        return m;
401 402
    }
402

  
403
    
403 404
    @Override
404 405
    public ListCellRenderer createDefaultFeatureAttributeListCellRenderer() {
405 406
        ListCellRenderer r = new FeatureAttributeListCellRenderer();

Also available in: Unified diff