Revision 25068
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableManageFields.java | ||
---|---|---|
47 | 47 |
package com.iver.cit.gvsig; |
48 | 48 |
|
49 | 49 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
50 |
import org.gvsig.project.document.table.FeatureTableDocument; |
|
51 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
50 | 52 |
|
51 | 53 |
import com.iver.andami.PluginServices; |
52 | 54 |
import com.iver.andami.plugins.Extension; |
53 | 55 |
import com.iver.andami.ui.mdiManager.IWindow; |
54 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
|
55 | 56 |
import com.iver.cit.gvsig.project.documents.table.gui.DlgFieldManager; |
56 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
57 | 57 |
|
58 | 58 |
|
59 | 59 |
/** |
... | ... | |
69 | 69 |
public void execute(String s) { |
70 | 70 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
71 | 71 |
|
72 |
Table t = (Table) v;
|
|
73 |
ProjectTable pt = t.getModel();
|
|
74 |
FeatureStore fs = pt.getModel();
|
|
72 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
|
|
73 |
FeatureTableDocument pt = t.getModel();
|
|
74 |
FeatureStore fs = pt.getStore();
|
|
75 | 75 |
if (fs.canAlterFeatureType()) |
76 | 76 |
{ |
77 | 77 |
// IFieldManager fieldManager = (IFieldManager) writer; |
... | ... | |
107 | 107 |
return false; |
108 | 108 |
} |
109 | 109 |
|
110 |
if (v instanceof Table) {
|
|
111 |
Table t = (Table) v;
|
|
112 |
FeatureStore fs = t.getModel().getModel();
|
|
110 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
111 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
|
|
112 |
FeatureStore fs = t.getModel().getStore();
|
|
113 | 113 |
// ProjectTable pt = t.getModel(); |
114 | 114 |
return fs.isEditing(); |
115 | 115 |
|
... | ... | |
138 | 138 |
return false; |
139 | 139 |
} |
140 | 140 |
|
141 |
if (v instanceof Table) {
|
|
141 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
142 | 142 |
return true; |
143 | 143 |
} |
144 | 144 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditStopExtension.java | ||
---|---|---|
8 | 8 |
import org.gvsig.fmap.dal.exception.ReadException; |
9 | 9 |
import org.gvsig.fmap.dal.exception.WriteException; |
10 | 10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
11 |
import org.gvsig.project.document.table.FeatureTableDocument; |
|
12 |
import org.gvsig.project.document.table.FeatureTableDocumentFactory; |
|
13 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
11 | 14 |
|
12 | 15 |
import com.iver.andami.PluginServices; |
13 | 16 |
import com.iver.andami.messages.NotificationManager; |
... | ... | |
17 | 20 |
import com.iver.andami.plugins.status.IUnsavedData; |
18 | 21 |
import com.iver.andami.plugins.status.UnsavedData; |
19 | 22 |
import com.iver.andami.ui.mdiManager.IWindow; |
20 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
|
21 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
|
22 | 23 |
import com.iver.cit.gvsig.project.documents.table.exceptions.CancelEditingTableException; |
23 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
24 | 24 |
import com.iver.utiles.swing.threads.IMonitorableTask; |
25 | 25 |
|
26 | 26 |
|
... | ... | |
41 | 41 |
*/ |
42 | 42 |
public void execute(String actionCommand) { |
43 | 43 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
44 |
Table table = (Table) v;
|
|
44 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
45 | 45 |
if ("STOPEDITING".equals(actionCommand)) { |
46 | 46 |
stopEditing(table); |
47 | 47 |
} |
... | ... | |
53 | 53 |
/** |
54 | 54 |
* DOCUMENT ME! |
55 | 55 |
*/ |
56 |
public void stopEditing(Table table) {
|
|
56 |
public void stopEditing(FeatureTableDocumentPanel table) {
|
|
57 | 57 |
int resp = JOptionPane |
58 | 58 |
.showConfirmDialog(null, PluginServices.getText(this, |
59 | 59 |
"realmente_desea_guardar") +" : "+ table.getModel().getName(), "Guardar", |
... | ... | |
85 | 85 |
|
86 | 86 |
if (v == null) { |
87 | 87 |
return false; |
88 |
} else if (v instanceof Table && ((Table) v).isEditing() && ((Table)v).getModel().getAssociatedTable()==null) {
|
|
88 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing() && ((FeatureTableDocumentPanel)v).getModel().getAssociatedLayer()==null) {
|
|
89 | 89 |
return true; |
90 | 90 |
} else { |
91 | 91 |
return false; |
... | ... | |
107 | 107 |
*/ |
108 | 108 |
public boolean hasUnsavedData() { |
109 | 109 |
ProjectExtension pe=(ProjectExtension)PluginServices.getExtension(ProjectExtension.class); |
110 |
ProjectTable[] tables=pe.getProject().getDocumentsByType(ProjectTableFactory.registerName).toArray(new ProjectTable[0]);
|
|
110 |
FeatureTableDocument[] tables=pe.getProject().getDocumentsByType(FeatureTableDocumentFactory.registerName).toArray(new FeatureTableDocument[0]);
|
|
111 | 111 |
for (int i=0;i<tables.length;i++) { |
112 |
if (tables[i].getModel() == null){
|
|
112 |
if (tables[i].getStore() == null){
|
|
113 | 113 |
continue; |
114 | 114 |
} |
115 |
if (tables[i].getModel().isEditing()) {
|
|
115 |
if (tables[i].getStore().isEditing()) {
|
|
116 | 116 |
return true; |
117 | 117 |
} |
118 | 118 |
} |
... | ... | |
147 | 147 |
*/ |
148 | 148 |
public IUnsavedData[] getUnsavedData() { |
149 | 149 |
ProjectExtension pe=(ProjectExtension)PluginServices.getExtension(ProjectExtension.class); |
150 |
ProjectTable[] tables =pe.getProject().getDocumentsByType(ProjectTableFactory.registerName).toArray(new ProjectTable[0]);
|
|
150 |
FeatureTableDocument[] tables =pe.getProject().getDocumentsByType(FeatureTableDocumentFactory.registerName).toArray(new FeatureTableDocument[0]);
|
|
151 | 151 |
ArrayList unsavedTables = new ArrayList(); |
152 | 152 |
for (int i=0;i<tables.length;i++) { |
153 |
if (tables[i].getModel() == null){
|
|
153 |
if (tables[i].getStore() == null){
|
|
154 | 154 |
continue; |
155 | 155 |
} |
156 |
if (tables[i].getModel().isEditing()) {
|
|
156 |
if (tables[i].getStore().isEditing()) {
|
|
157 | 157 |
UnsavedTable ul=new UnsavedTable(TableEditStopExtension.this); |
158 | 158 |
ul.setTable(tables[i]); |
159 | 159 |
unsavedTables.add(ul); |
... | ... | |
165 | 165 |
|
166 | 166 |
private class UnsavedTable extends UnsavedData{ |
167 | 167 |
|
168 |
private ProjectTable table;
|
|
168 |
private FeatureTableDocument table;
|
|
169 | 169 |
|
170 | 170 |
public UnsavedTable(IExtension extension) { |
171 | 171 |
super(extension); |
... | ... | |
187 | 187 |
|
188 | 188 |
|
189 | 189 |
|
190 |
public void setTable(ProjectTable table) {
|
|
190 |
public void setTable(FeatureTableDocument table) {
|
|
191 | 191 |
this.table=table; |
192 | 192 |
|
193 | 193 |
} |
... | ... | |
195 | 195 |
|
196 | 196 |
|
197 | 197 |
//TODO Este c?digo est? duplicado, tambi?n est? en la clase Table en el m?todo "public void stopEditing()" |
198 |
private boolean executeSaveTable(ProjectTable table2) {
|
|
199 |
FeatureStore fs = table2.getModel();
|
|
198 |
private boolean executeSaveTable(FeatureTableDocument table2) {
|
|
199 |
FeatureStore fs = table2.getStore();
|
|
200 | 200 |
try { |
201 | 201 |
fs.finishEditing(); |
202 | 202 |
} catch (WriteException e) { |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditChangeColumnsExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.plugins.Extension; |
47 | 48 |
import com.iver.andami.ui.mdiManager.IWindow; |
48 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
49 | 49 |
|
50 | 50 |
|
51 | 51 |
/** |
... | ... | |
65 | 65 |
*/ |
66 | 66 |
public void execute(String actionCommand) { |
67 | 67 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
68 |
Table t = (Table) v;
|
|
68 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
|
|
69 | 69 |
if ("REMOVECOLUMN".equals(actionCommand)) { |
70 | 70 |
t.removeColumn(); |
71 | 71 |
|
... | ... | |
108 | 108 |
return false; |
109 | 109 |
} |
110 | 110 |
|
111 |
if (v instanceof Table) {
|
|
112 |
return (((Table) v).isEditing()) && ((Table) v).getSelectedFieldIndices().cardinality()>0;
|
|
111 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
112 |
return (((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) && ((FeatureTableDocumentPanel) v).getSelectedFieldIndices().cardinality()>0;
|
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
return false; |
... | ... | |
123 | 123 |
|
124 | 124 |
if (v == null) { |
125 | 125 |
return false; |
126 |
} else if (v instanceof Table && ((Table) v).isEditing()) {
|
|
126 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
127 | 127 |
return true; |
128 | 128 |
} else { |
129 | 129 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditCutExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.messages.NotificationManager; |
47 | 48 |
import com.iver.andami.plugins.Extension; |
48 | 49 |
import com.iver.andami.ui.mdiManager.IWindow; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
77 | 77 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
78 | 78 |
|
79 | 79 |
try { |
80 |
((Table) v).cutFeature();
|
|
80 |
((FeatureTableDocumentPanel) v).cutFeature();
|
|
81 | 81 |
} catch (ReadException e) { |
82 | 82 |
NotificationManager.addError("No se pudo cortar la fila", e); |
83 | 83 |
} |
... | ... | |
94 | 94 |
return false; |
95 | 95 |
} |
96 | 96 |
|
97 |
if (v.getClass() == Table.class) {
|
|
98 |
return (((Table) v).isEditing()) && (((Table) v).getSelectedRowIndices().length>0);
|
|
97 |
if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
98 |
return (((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) && (((FeatureTableDocumentPanel) v).getSelectedRowIndices().length>0);
|
|
99 | 99 |
} |
100 | 100 |
|
101 | 101 |
return false; |
... | ... | |
109 | 109 |
|
110 | 110 |
if (v == null) { |
111 | 111 |
return false; |
112 |
} else if (v instanceof Table && ((Table) v).isEditing()) {
|
|
112 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
113 | 113 |
return true; |
114 | 114 |
} else { |
115 | 115 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditInsertExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.messages.NotificationManager; |
47 | 48 |
import com.iver.andami.plugins.Extension; |
48 | 49 |
import com.iver.andami.ui.mdiManager.IWindow; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
69 | 69 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
70 | 70 |
|
71 | 71 |
try { |
72 |
((Table) v).addFeatures(null);
|
|
72 |
((FeatureTableDocumentPanel) v).addFeatures(null);
|
|
73 | 73 |
} catch (ReadException e) { |
74 | 74 |
NotificationManager.addError("No se pudo insertar la fila", e); |
75 | 75 |
} |
... | ... | |
92 | 92 |
|
93 | 93 |
if (v == null) { |
94 | 94 |
return false; |
95 |
} else if (v instanceof Table && ((Table) v).isEditing()) {
|
|
95 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
96 | 96 |
return true; |
97 | 97 |
} else { |
98 | 98 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableNumericFieldOperations.java | ||
---|---|---|
4 | 4 |
import java.util.BitSet; |
5 | 5 |
import java.util.Iterator; |
6 | 6 |
|
7 |
import org.gvsig.fmap.dal.DataTypes; |
|
7 | 8 |
import org.gvsig.fmap.dal.exception.ReadException; |
8 | 9 |
import org.gvsig.fmap.dal.feature.Feature; |
9 | 10 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
10 | 11 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
11 | 12 |
import org.gvsig.fmap.mapcontext.rendering.legend.NullValue; |
13 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
12 | 14 |
import org.opengis.feature.FeatureCollection; |
13 | 15 |
|
14 | 16 |
import com.iver.andami.PluginServices; |
15 | 17 |
import com.iver.andami.plugins.Extension; |
16 | 18 |
import com.iver.andami.ui.mdiManager.IWindow; |
17 | 19 |
import com.iver.cit.gvsig.project.documents.table.gui.Statistics; |
18 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
19 | 20 |
|
20 | 21 |
/** |
21 | 22 |
* @author Fernando Gonz?lez Cort?s |
... | ... | |
43 | 44 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
44 | 45 |
|
45 | 46 |
if (v != null) { |
46 |
if (v.getClass() == Table.class) {
|
|
47 |
if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
47 | 48 |
|
48 |
Table table = (Table) v;
|
|
49 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
49 | 50 |
|
50 | 51 |
doExecute(table); |
51 | 52 |
} |
... | ... | |
59 | 60 |
* Table to operate |
60 | 61 |
*/ |
61 | 62 |
|
62 |
protected void doExecute(Table table){
|
|
63 |
protected void doExecute(FeatureTableDocumentPanel table){
|
|
63 | 64 |
int fieldIndex = table.getSelectedFieldIndices().nextSetBit(0); |
64 | 65 |
int numRows=0; |
65 | 66 |
FeatureStore fs=null; |
66 | 67 |
// try { |
67 |
fs = table.getModel().getModel();
|
|
68 |
fs = table.getModel().getStore();
|
|
68 | 69 |
// } catch (ReadException e) { |
69 | 70 |
// e.printStackTrace(); |
70 | 71 |
// } |
... | ... | |
96 | 97 |
}else{ |
97 | 98 |
|
98 | 99 |
try { |
99 |
fCollec = (FeatureCollection)fs.getDataCollection(new String[]{((FeatureAttributeDescriptor)fs.getDefaultFeatureType().get(fieldIndex)).getName()},null,null);
|
|
100 |
fCollec = (FeatureCollection)fs.getDataSet(new String[]{((FeatureAttributeDescriptor)fs.getDefaultFeatureType().get(fieldIndex)).getName()});
|
|
100 | 101 |
} catch (ReadException e) { |
101 | 102 |
// TODO Auto-generated catch block |
102 | 103 |
e.printStackTrace(); |
... | ... | |
217 | 218 |
return false; |
218 | 219 |
} |
219 | 220 |
|
220 |
if (v instanceof Table) {
|
|
221 |
Table table = (Table) v;
|
|
221 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
222 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
222 | 223 |
return doIsEnabled(table); |
223 | 224 |
} |
224 | 225 |
return false; |
225 | 226 |
} |
226 | 227 |
|
227 |
protected boolean doIsEnabled(Table table){
|
|
228 |
protected boolean doIsEnabled(FeatureTableDocumentPanel table){
|
|
228 | 229 |
BitSet indices = table.getSelectedFieldIndices(); |
229 | 230 |
// System.out.println("TableNumericFieldOperations.isEnabled: Tabla: " + table.getModel().getModelo().getRecordset().getName() ); |
230 | 231 |
if (indices.cardinality() == 1){ |
231 | 232 |
// try { |
232 | 233 |
int index=indices.nextSetBit(0); |
233 |
if (table.getModel().getModel().getDefaultFeatureType().size()<index+1) {
|
|
234 |
if (table.getModel().getStore().getDefaultFeatureType().size()<index+1) {
|
|
234 | 235 |
return false; |
235 | 236 |
} |
236 |
String type = ((FeatureAttributeDescriptor)table.getModel().getModel().getDefaultFeatureType().get(index)).getDataType();
|
|
237 |
if ((type.equals(FeatureAttributeDescriptor.TYPE_LONG)) ||
|
|
238 |
(type.equals(FeatureAttributeDescriptor.TYPE_DOUBLE)) ||
|
|
239 |
(type.equals(FeatureAttributeDescriptor.TYPE_FLOAT)) ||
|
|
240 |
(type.equals(FeatureAttributeDescriptor.TYPE_INT))){
|
|
237 |
int type = ((FeatureAttributeDescriptor)table.getModel().getStore().getDefaultFeatureType().get(index)).getDataType();
|
|
238 |
if ((type==DataTypes.LONG) ||
|
|
239 |
(type== DataTypes.DOUBLE) ||
|
|
240 |
(type==DataTypes.FLOAT) ||
|
|
241 |
(type==DataTypes.INT)){
|
|
241 | 242 |
return true; |
242 | 243 |
} |
243 | 244 |
// } catch (ReadException e) { |
... | ... | |
258 | 259 |
return false; |
259 | 260 |
} |
260 | 261 |
|
261 |
if (v instanceof Table) {
|
|
262 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
262 | 263 |
return true; |
263 | 264 |
} |
264 | 265 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditCopyExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.messages.NotificationManager; |
47 | 48 |
import com.iver.andami.plugins.Extension; |
48 | 49 |
import com.iver.andami.ui.mdiManager.IWindow; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
76 | 76 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
77 | 77 |
|
78 | 78 |
try { |
79 |
((Table) v).copyFeature();
|
|
79 |
((FeatureTableDocumentPanel) v).copyFeature();
|
|
80 | 80 |
} catch (ReadException e) { |
81 | 81 |
NotificationManager.addError("No se pudo copiar la fila", e); |
82 | 82 |
} |
... | ... | |
91 | 91 |
|
92 | 92 |
if (v == null) { |
93 | 93 |
return false; |
94 |
} else if (v.getClass() == Table.class) {
|
|
95 |
return (((Table) v).getSelectedRowIndices().length>0);
|
|
94 |
} else if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
95 |
return (((FeatureTableDocumentPanel) v).getSelectedRowIndices().length>0);
|
|
96 | 96 |
} else { |
97 | 97 |
return false; |
98 | 98 |
} |
... | ... | |
106 | 106 |
|
107 | 107 |
if (v == null) { |
108 | 108 |
return false; |
109 |
} else if (v instanceof Table) {
|
|
109 |
} else if (v instanceof FeatureTableDocumentPanel) {
|
|
110 | 110 |
return true; |
111 | 111 |
} else { |
112 | 112 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditPasteExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.messages.NotificationManager; |
47 | 48 |
import com.iver.andami.plugins.Extension; |
48 | 49 |
import com.iver.andami.ui.mdiManager.IWindow; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
76 | 76 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
77 | 77 |
|
78 | 78 |
try { |
79 |
((Table) v).pasteFeature();
|
|
79 |
((FeatureTableDocumentPanel) v).pasteFeature();
|
|
80 | 80 |
} catch (ReadException e) { |
81 | 81 |
NotificationManager.addError("No se pudo pegar la fila", e); |
82 | 82 |
} |
... | ... | |
91 | 91 |
|
92 | 92 |
if (v == null) { |
93 | 93 |
return false; |
94 |
} else if (v.getClass() == Table.class) {
|
|
95 |
return ((Table) v).isEditing() && ((Table) v).isCopied();
|
|
94 |
} else if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
95 |
return ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing() && ((FeatureTableDocumentPanel) v).isCopied();
|
|
96 | 96 |
} else { |
97 | 97 |
return false; |
98 | 98 |
} |
... | ... | |
106 | 106 |
|
107 | 107 |
if (v == null) { |
108 | 108 |
return false; |
109 |
} else if (v instanceof Table && ((Table) v).isEditing()) {
|
|
109 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
110 | 110 |
return true; |
111 | 111 |
} else { |
112 | 112 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableOperations.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
import javax.swing.JOptionPane; |
48 | 48 |
|
49 |
import org.gvsig.fmap.dal.DALLocator; |
|
49 | 50 |
import org.gvsig.fmap.dal.DataManager; |
50 | 51 |
import org.gvsig.fmap.dal.exception.DataException; |
51 | 52 |
import org.gvsig.fmap.dal.exception.ReadException; |
52 | 53 |
import org.gvsig.fmap.dal.feature.Feature; |
54 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
53 | 55 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
54 | 56 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
57 |
import org.gvsig.project.document.table.FeatureTableDocument; |
|
58 |
import org.gvsig.project.document.table.FeatureTableDocumentFactory; |
|
59 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
55 | 60 |
import org.opengis.feature.FeatureCollection; |
56 | 61 |
|
57 | 62 |
import com.iver.andami.PluginServices; |
... | ... | |
62 | 67 |
import com.iver.cit.gvsig.project.Project; |
63 | 68 |
import com.iver.cit.gvsig.project.documents.table.FieldSelectionModel; |
64 | 69 |
import com.iver.cit.gvsig.project.documents.table.ObjectSelectionStep; |
65 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
|
66 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
|
67 | 70 |
import com.iver.cit.gvsig.project.documents.table.TableSelectionModel; |
68 | 71 |
import com.iver.cit.gvsig.project.documents.table.gui.AndamiWizard; |
69 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
70 | 72 |
import com.iver.utiles.swing.objectSelection.SelectionException; |
71 | 73 |
import com.iver.utiles.swing.wizard.WizardControl; |
72 | 74 |
import com.iver.utiles.swing.wizard.WizardEvent; |
... | ... | |
88 | 90 |
public void execute(String actionCommand) { |
89 | 91 |
ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
90 | 92 |
Project project=pe.getProject(); |
91 |
ProjectTable[] pts = project.getDocumentsByType(ProjectTableFactory.registerName)
|
|
92 |
.toArray(new ProjectTable[0]);
|
|
93 |
FeatureTableDocument[] pts = project.getDocumentsByType(FeatureTableDocumentFactory.registerName)
|
|
94 |
.toArray(new FeatureTableDocument[0]);
|
|
93 | 95 |
if ("JOIN".equals(actionCommand)) { |
94 | 96 |
try { |
95 | 97 |
final ObjectSelectionStep sourceTable = new ObjectSelectionStep(); |
... | ... | |
117 | 119 |
public void finished(WizardEvent w) { |
118 | 120 |
PluginServices.getMDIManager().closeWindow(wiz); |
119 | 121 |
|
120 |
ProjectTable sourceProjectTable = (ProjectTable) sourceTable.getSelected();
|
|
121 |
FeatureStore fs1 = sourceProjectTable.getModel();
|
|
122 |
FeatureTableDocument sourceProjectTable = (FeatureTableDocument) sourceTable.getSelected();
|
|
123 |
FeatureStore fs1 = sourceProjectTable.getStore();
|
|
122 | 124 |
String tableName1 = fs1.getName(); |
123 | 125 |
|
124 |
ProjectTable targetProjectTable = (ProjectTable) targetTable.getSelected();
|
|
125 |
FeatureStore fs2 = targetProjectTable.getModel();
|
|
126 |
FeatureTableDocument targetProjectTable = (FeatureTableDocument) targetTable.getSelected();
|
|
127 |
FeatureStore fs2 = targetProjectTable.getStore();
|
|
126 | 128 |
|
127 | 129 |
String tableName2 = fs2.getName(); |
128 | 130 |
|
... | ... | |
136 | 138 |
System.out.println(sql); |
137 | 139 |
|
138 | 140 |
try { |
139 |
DataManager dm=DataManager.getManager();
|
|
141 |
DataManager dm=DALLocator.getDataManager();
|
|
140 | 142 |
JoinFeatureStoreParameters jfsp=(JoinFeatureStoreParameters)dm.createDataStoreParameters(JoinFeatureStore.DATASTORE_NAME); |
141 | 143 |
jfsp.setStorePrimary(fs1.getParameters()); |
142 | 144 |
jfsp.setStoreSecondary(fs2.getParameters()); |
... | ... | |
147 | 149 |
|
148 | 150 |
JoinFeatureStore jfs=(JoinFeatureStore)dm.createDataStore(jfsp); |
149 | 151 |
featureStore=jfs; |
150 |
ProjectTable projectTable = (ProjectTable) sourceTable.getSelected();
|
|
151 |
FeatureStore original = projectTable.getModel();
|
|
152 |
FeatureTableDocument projectTable = (FeatureTableDocument) sourceTable.getSelected();
|
|
153 |
FeatureStore original = projectTable.getStore();
|
|
152 | 154 |
projectTable.setModel(jfs); |
153 | 155 |
|
154 |
if (projectTable.getAssociatedTable() != null) {
|
|
155 |
projectTable.getAssociatedTable().setDataStore(
|
|
156 |
if (projectTable.getAssociatedLayer() != null) {
|
|
157 |
projectTable.getAssociatedLayer().setDataStore(
|
|
156 | 158 |
jfs); |
157 | 159 |
} |
158 | 160 |
|
159 | 161 |
original.dispose(); |
160 | 162 |
|
161 | 163 |
IWindow[] windows=PluginServices.getMDIManager().getAllWindows(); |
162 |
Table tableWindow;
|
|
164 |
FeatureTableDocumentPanel tableWindow;
|
|
163 | 165 |
for (int i = 0; i < windows.length; i++) { |
164 |
if (windows[i] instanceof Table){
|
|
165 |
tableWindow = (Table) windows[i];
|
|
166 |
if (windows[i] instanceof FeatureTableDocumentPanel){
|
|
167 |
tableWindow = (FeatureTableDocumentPanel) windows[i];
|
|
166 | 168 |
if (tableWindow.getModel().equals( |
167 | 169 |
projectTable)) { |
168 | 170 |
tableWindow.setModel(projectTable); |
... | ... | |
183 | 185 |
wiz.enableNext(((ObjectSelectionStep) wiz.getCurrentStep()).getSelectedItem() != null); |
184 | 186 |
|
185 | 187 |
if (w.currentStep == 1) { |
186 |
ProjectTable pt = (ProjectTable) sourceTable.getSelected();
|
|
188 |
FeatureTableDocument pt = (FeatureTableDocument) sourceTable.getSelected();
|
|
187 | 189 |
|
188 | 190 |
try { |
189 | 191 |
firstTableField.setModel(new FieldSelectionModel( |
190 |
pt.getModel(),
|
|
192 |
pt.getStore(),
|
|
191 | 193 |
PluginServices.getText(this, "seleccione_campo_enlace"), |
192 | 194 |
null)); |
193 | 195 |
} catch (SelectionException e) { |
... | ... | |
197 | 199 |
} else if (w.currentStep == 3) { |
198 | 200 |
try { |
199 | 201 |
//tabla |
200 |
ProjectTable pt = (ProjectTable) sourceTable.getSelected();
|
|
202 |
FeatureTableDocument pt = (FeatureTableDocument) sourceTable.getSelected();
|
|
201 | 203 |
|
202 | 204 |
//?ndice del campo |
203 |
FeatureStore fs = pt.getModel();
|
|
205 |
FeatureStore fs = pt.getStore();
|
|
204 | 206 |
String fieldName = (String) firstTableField.getSelected(); |
205 |
String type = fs.getDefaultFeatureType().get(fieldName).getDataType();
|
|
207 |
int type = ((FeatureAttributeDescriptor)fs.getDefaultFeatureType().get(fieldName)).getDataType();
|
|
206 | 208 |
|
207 | 209 |
|
208 | 210 |
secondTableField.setModel(new FieldSelectionModel( |
209 |
((ProjectTable) targetTable
|
|
211 |
((FeatureTableDocument) targetTable
|
|
210 | 212 |
.getSelected()) |
211 |
.getModel(),
|
|
213 |
.getStore(),
|
|
212 | 214 |
PluginServices.getText(this, "seleccione_campo_enlace"), |
213 | 215 |
type)); |
214 | 216 |
} catch (SelectionException e) { |
... | ... | |
256 | 258 |
public void finished(WizardEvent w) { |
257 | 259 |
PluginServices.getMDIManager().closeWindow(wiz); |
258 | 260 |
|
259 |
ProjectTable sourceProjectTable = (ProjectTable) sourceTable.getSelected();
|
|
260 |
FeatureStore sds1 = sourceProjectTable.getModel();
|
|
261 |
FeatureTableDocument sourceProjectTable = (FeatureTableDocument) sourceTable.getSelected();
|
|
262 |
FeatureStore sds1 = sourceProjectTable.getStore();
|
|
261 | 263 |
|
262 |
ProjectTable targetProjectTable = (ProjectTable) targetTable.getSelected();
|
|
263 |
FeatureStore sds2 = targetProjectTable.getModel();
|
|
264 |
FeatureTableDocument targetProjectTable = (FeatureTableDocument) targetTable.getSelected();
|
|
265 |
FeatureStore sds2 = targetProjectTable.getStore();
|
|
264 | 266 |
|
265 | 267 |
String field1 = (String) firstTableField.getSelected(); |
266 | 268 |
String field2 = (String) secondTableField.getSelected(); |
... | ... | |
275 | 277 |
wiz.enableNext(((ObjectSelectionStep) wiz.getCurrentStep()).getSelectedItem() != null); |
276 | 278 |
|
277 | 279 |
if (w.currentStep == 1) { |
278 |
ProjectTable pt = (ProjectTable) sourceTable.getSelected();
|
|
280 |
FeatureTableDocument pt = (FeatureTableDocument) sourceTable.getSelected();
|
|
279 | 281 |
|
280 | 282 |
try { |
281 | 283 |
firstTableField.setModel(new FieldSelectionModel( |
282 |
pt.getModel(),
|
|
284 |
pt.getStore(),
|
|
283 | 285 |
PluginServices.getText(this, "seleccione_campo_enlace"), |
284 | 286 |
null)); |
285 | 287 |
} catch (SelectionException e) { |
... | ... | |
289 | 291 |
} else if (w.currentStep == 3) { |
290 | 292 |
try { |
291 | 293 |
//tabla |
292 |
ProjectTable pt = (ProjectTable) sourceTable.getSelected();
|
|
294 |
FeatureTableDocument pt = (FeatureTableDocument) sourceTable.getSelected();
|
|
293 | 295 |
|
294 | 296 |
//?ndice del campo |
295 |
FeatureStore fs = pt.getModel();
|
|
297 |
FeatureStore fs = pt.getStore();
|
|
296 | 298 |
String fieldName = (String) firstTableField.getSelected(); |
297 | 299 |
String type = fs.getDefaultFeatureType().get(fieldName).getDataType(); |
298 | 300 |
|
299 | 301 |
secondTableField.setModel(new FieldSelectionModel( |
300 |
((ProjectTable) targetTable
|
|
302 |
((FeatureTableDocument) targetTable
|
|
301 | 303 |
.getSelected()) |
302 |
.getModel(),
|
|
304 |
.getStore(),
|
|
303 | 305 |
PluginServices.getText(this, "seleccione_campo_enlace"), |
304 | 306 |
type)); |
305 | 307 |
} catch (SelectionException e) { |
... | ... | |
359 | 361 |
// By Pablo: if no filter expression -> don't add more elements to set |
360 | 362 |
if (! this.filterExpressionFromWhereIsEmpty(expression)) { |
361 | 363 |
FeatureCollection sel=null; |
362 |
try { |
|
363 |
sel = doSet(expression); |
|
364 |
} catch (ReadException e) { |
|
365 |
throw new DataException("Expression",e); |
|
366 |
} |
|
364 |
sel = doSet(expression); |
|
367 | 365 |
|
368 | 366 |
if (sel == null) { |
369 | 367 |
throw new RuntimeException("Not a 'where' clause?"); |
... | ... | |
444 | 442 |
return false; |
445 | 443 |
} |
446 | 444 |
|
447 |
if (v instanceof Table) {
|
|
445 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
448 | 446 |
return true; |
449 | 447 |
} /*else { |
450 | 448 |
if (v instanceof com.iver.cit.gvsig.gui.View) { |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditRemoveRowExtension.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
44 | 45 |
|
45 | 46 |
import com.iver.andami.PluginServices; |
46 | 47 |
import com.iver.andami.messages.NotificationManager; |
47 | 48 |
import com.iver.andami.plugins.Extension; |
48 | 49 |
import com.iver.andami.ui.mdiManager.IWindow; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
69 | 69 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
70 | 70 |
|
71 | 71 |
try { |
72 |
((Table) v).removeFeature();
|
|
72 |
((FeatureTableDocumentPanel) v).removeFeature();
|
|
73 | 73 |
} catch (ReadException e) { |
74 | 74 |
NotificationManager.addError("No se pudo elimnar la fila", e); |
75 | 75 |
} |
... | ... | |
86 | 86 |
return false; |
87 | 87 |
} |
88 | 88 |
|
89 |
if (v instanceof Table) {
|
|
90 |
return (((Table) v).isEditing()) && ((Table) v).getSelectedRowIndices().length>0;
|
|
89 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
90 |
return (((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) && ((FeatureTableDocumentPanel) v).getSelectedRowIndices().length>0;
|
|
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
return false; |
... | ... | |
101 | 101 |
|
102 | 102 |
if (v == null) { |
103 | 103 |
return false; |
104 |
} else if (v instanceof Table && ((Table) v).isEditing()) {
|
|
104 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) {
|
|
105 | 105 |
return true; |
106 | 106 |
} else { |
107 | 107 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/RemoveTableUnion.java | ||
---|---|---|
46 | 46 |
return; |
47 | 47 |
} |
48 | 48 |
|
49 |
pt.setModel(original);
|
|
49 |
pt.setStore(original);
|
|
50 | 50 |
try { |
51 | 51 |
fs.dispose(); |
52 | 52 |
} catch (CloseException e) { |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableFieldOperations.java | ||
---|---|---|
5 | 5 |
import org.gvsig.fmap.dal.exception.DataException; |
6 | 6 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
7 | 7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
8 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
8 | 9 |
|
9 | 10 |
import com.iver.andami.PluginServices; |
10 | 11 |
import com.iver.andami.plugins.Extension; |
11 | 12 |
import com.iver.andami.ui.mdiManager.IWindow; |
12 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
13 | 13 |
|
14 | 14 |
/** |
15 | 15 |
* @author Fernando Gonz?lez Cort?s |
... | ... | |
42 | 42 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
43 | 43 |
|
44 | 44 |
if (v != null) { |
45 |
if (v instanceof Table) {
|
|
45 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
46 | 46 |
|
47 |
Table table = (Table) v;
|
|
47 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
48 | 48 |
|
49 | 49 |
doExecute(actionCommand,table); |
50 | 50 |
table.getModel().setModified(true); |
... | ... | |
59 | 59 |
* @param table |
60 | 60 |
* Table to operate |
61 | 61 |
*/ |
62 |
protected void doExecute(String actionCommand,Table table){
|
|
62 |
protected void doExecute(String actionCommand,FeatureTableDocumentPanel table){
|
|
63 | 63 |
int fieldIndex = table.getSelectedFieldIndices().nextSetBit(0); |
64 |
FeatureStore fs=table.getModel().getModel();
|
|
64 |
FeatureStore fs=table.getModel().getStore();
|
|
65 | 65 |
// DataSource sds=null; |
66 | 66 |
// try { |
67 | 67 |
// sds = table.getModel().getModelo().getRecordset(); |
... | ... | |
107 | 107 |
return false; |
108 | 108 |
} |
109 | 109 |
|
110 |
if (v instanceof Table) {
|
|
111 |
Table t = (Table) v;
|
|
110 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
111 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
|
|
112 | 112 |
BitSet indices = t.getSelectedFieldIndices(); |
113 | 113 |
if (indices.cardinality() == 1){ |
114 | 114 |
return true; |
... | ... | |
127 | 127 |
return false; |
128 | 128 |
} |
129 | 129 |
|
130 |
if (v instanceof Table) {
|
|
130 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
131 | 131 |
return true; |
132 | 132 |
} |
133 | 133 |
return false; |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableRowsOperations.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.gvsig.fmap.dal.exception.DataException; |
4 | 4 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
5 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
5 | 6 |
|
6 | 7 |
import com.iver.andami.PluginServices; |
7 | 8 |
import com.iver.andami.messages.NotificationManager; |
8 | 9 |
import com.iver.andami.plugins.Extension; |
9 | 10 |
import com.iver.andami.ui.mdiManager.IWindow; |
10 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
11 | 11 |
|
12 | 12 |
|
13 | 13 |
/** |
... | ... | |
44 | 44 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
45 | 45 |
|
46 | 46 |
if (v != null) { |
47 |
if (v.getClass() == Table.class) {
|
|
48 |
Table table = (Table) v;
|
|
47 |
if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
48 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
49 | 49 |
if (actionCommand.compareTo("SELECTIONUP") == 0) { |
50 | 50 |
showsSelectedRows(table); |
51 | 51 |
} |
... | ... | |
61 | 61 |
* Flip the selection (inverts selection) |
62 | 62 |
* @param table |
63 | 63 |
*/ |
64 |
private void invertSelection(Table table) {
|
|
64 |
private void invertSelection(FeatureTableDocumentPanel table) {
|
|
65 | 65 |
try { |
66 |
FeatureStore fs = table.getModel().getModel();
|
|
66 |
FeatureStore fs = table.getModel().getStore();
|
|
67 | 67 |
fs.getFeatureSelection().reverse(); |
68 | 68 |
} catch (DataException e) { |
69 | 69 |
e.printStackTrace(); |
... | ... | |
71 | 71 |
} |
72 | 72 |
} |
73 | 73 |
|
74 |
private void showsSelectedRows(Table table) {
|
|
74 |
private void showsSelectedRows(FeatureTableDocumentPanel table) {
|
|
75 | 75 |
// long[] mapping=null; |
76 | 76 |
// try { |
77 | 77 |
// FeatureStore fs=table.getModel().getModel(); |
... | ... | |
111 | 111 |
return false; |
112 | 112 |
} |
113 | 113 |
|
114 |
if (v.getClass() == Table.class) {
|
|
115 |
Table table = (Table) v;
|
|
114 |
if (v.getClass() == FeatureTableDocumentPanel.class) {
|
|
115 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
116 | 116 |
|
117 | 117 |
try { |
118 |
return !table.getModel().getModel().getFeatureSelection().isEmpty();
|
|
118 |
return !table.getModel().getStore().getFeatureSelection().isEmpty();
|
|
119 | 119 |
} catch (DataException e) { |
120 | 120 |
NotificationManager.addError(e); |
121 | 121 |
} |
... | ... | |
162 | 162 |
return false; |
163 | 163 |
} |
164 | 164 |
|
165 |
if (v instanceof Table) {
|
|
165 |
if (v instanceof FeatureTableDocumentPanel) {
|
|
166 | 166 |
return true; |
167 | 167 |
} |
168 | 168 |
|
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditStartExtension.java | ||
---|---|---|
43 | 43 |
import java.awt.HeadlessException; |
44 | 44 |
|
45 | 45 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
46 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
46 | 47 |
|
47 | 48 |
import com.iver.andami.PluginServices; |
48 | 49 |
import com.iver.andami.plugins.Extension; |
49 | 50 |
import com.iver.andami.ui.mdiManager.IWindow; |
50 | 51 |
import com.iver.cit.gvsig.project.documents.table.exceptions.StartEditingTableException; |
51 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
52 | 52 |
|
53 | 53 |
|
54 | 54 |
/** |
... | ... | |
71 | 71 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
72 | 72 |
|
73 | 73 |
try { |
74 |
Table table = (Table) v;
|
|
74 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
|
|
75 | 75 |
// Driver drv = table.getModel().getModelo().getOriginalDriver(); |
76 | 76 |
// if (drv instanceof IWriteable) |
77 | 77 |
// { |
... | ... | |
117 | 117 |
if (v == null) { |
118 | 118 |
return false; |
119 | 119 |
} |
120 |
if (v instanceof Table)
|
|
120 |
if (v instanceof FeatureTableDocumentPanel)
|
|
121 | 121 |
{ |
122 |
Table t = (Table) v;
|
|
123 |
FeatureStore fs = t.getModel().getModel();
|
|
122 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
|
|
123 |
FeatureStore fs = t.getModel().getStore();
|
|
124 | 124 |
// FJP: |
125 | 125 |
// Si est? linkada, por ahora no dejamos editar |
126 | 126 |
// TODO: Esto evita la edici?n en un sentido, pero no en el otro |
... | ... | |
151 | 151 |
return false; |
152 | 152 |
} |
153 | 153 |
|
154 |
if (v instanceof Table && !((Table) v).isEditing() && ((Table)v).getModel().getAssociatedTable()==null) {
|
|
154 |
if (v instanceof FeatureTableDocumentPanel && !((FeatureTableDocumentPanel) v).getModel().getStore().isEditing() && ((FeatureTableDocumentPanel)v).getModel().getAssociatedLayer()==null) {
|
|
155 | 155 |
return true; |
156 | 156 |
} |
157 | 157 |
|
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/commands/FrameCommandsRecord.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.project.documents.layout.commands; |
2 | 2 |
|
3 |
import org.gvsig.tools.undo.command.AbstractCommandsRecord; |
|
4 |
import org.gvsig.tools.undo.command.Command; |
|
5 | 3 |
import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack; |
6 | 4 |
|
7 | 5 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
... | ... | |
25 | 23 |
public FrameCommandsRecord(FrameManager expansionManager){ |
26 | 24 |
this.expansionManager=expansionManager; |
27 | 25 |
} |
28 |
public void insert(Object obj) { |
|
29 |
Command command=null; |
|
30 |
if (obj instanceof IFFrame){ |
|
31 |
IFFrame frame=(IFFrame)obj; |
|
32 |
command=new InsertFrameCommand(expansionManager, frame); |
|
33 |
}else{ |
|
34 |
throw new RuntimeException("Object not supported by any command"); |
|
35 |
} |
|
26 |
public void insert(IFFrame frame) { |
|
27 |
InsertFrameCommand command=new InsertFrameCommand(expansionManager, frame,frame.getName()); |
|
28 |
add(command); |
|
29 |
command.execute(); |
|
30 |
} |
|
31 |
|
|
32 |
public void delete(IFFrame frame) { |
|
33 |
DeleteFrameCommand command=new DeleteFrameCommand(expansionManager, frame,frame.getName()); |
|
34 |
add(command); |
|
35 |
command.execute(); |
|
36 |
} |
|
37 |
|
|
38 |
public void update(IFFrame frame, IFFrame oldFrame) { |
|
39 |
UpdateFrameCommand command=new UpdateFrameCommand(expansionManager,frame, oldFrame,frame.getName()); |
|
36 | 40 |
add(command); |
37 | 41 |
command.execute(); |
38 | 42 |
} |
39 |
public void delete(Object obj) { |
|
40 |
Command command=null; |
|
41 |
if (obj instanceof IFFrame){ |
|
42 |
IFFrame frame=(IFFrame)obj; |
|
43 |
command=new DeleteFrameCommand(expansionManager,frame); |
|
44 |
}else{ |
|
45 |
throw new RuntimeException("Object not supported by any command"); |
|
46 |
} |
|
47 |
add(command); |
|
48 |
command.execute(); |
|
49 |
} |
|
50 |
public void update(Object obj, Object oldObj) { |
|
51 |
Command command=null; |
|
52 |
if (obj instanceof IFFrame){ |
|
53 |
IFFrame frame=(IFFrame)obj; |
|
54 |
IFFrame oldFrame=(IFFrame)oldObj; |
|
55 |
command=new UpdateFrameCommand(expansionManager,frame, oldFrame); |
|
56 |
}else{ |
|
57 |
throw new RuntimeException("Object not supported by any command"); |
|
58 |
} |
|
59 |
add(command); |
|
60 |
command.execute(); |
|
61 |
} |
|
62 | 43 |
public void clear() { |
63 | 44 |
super.clear(); |
64 | 45 |
expansionManager.clear(); |
branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/ShowTable.java | ||
---|---|---|
151 | 151 |
projectTable.setAssociatedLayer(co); |
152 | 152 |
ext.getProject().addDocument(projectTable); |
153 | 153 |
} |
154 |
projectTable.setModel(fs);
|
|
154 |
projectTable.setStore(fs);
|
|
155 | 155 |
FeatureTableDocumentPanel t = new FeatureTableDocumentPanel(fs); |
156 | 156 |
t.setModel(projectTable); |
157 | 157 |
if (fs.isEditing()) { |
158 |
fs.getCommandsRecord().addObserver(t);
|
|
158 |
fs.addObserver(t); |
|
159 | 159 |
} |
160 | 160 |
t.getModel().setModified(true); |
161 | 161 |
PluginServices.getMDIManager().addWindow(t); |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/project/document/table/FeatureTableDocument.java | ||
---|---|---|
204 | 204 |
this.associatedTable = associatedTable; |
205 | 205 |
} |
206 | 206 |
|
207 |
|
|
208 |
|
|
209 |
|
|
207 |
public void setStore(FeatureStore fs) { |
|
208 |
this.store=fs; |
|
209 |
} |
|
210 | 210 |
} |
Also available in: Unified diff