Revision 10626 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableRowsOperations.java
TableRowsOperations.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig; |
2 | 2 |
|
3 |
import java.io.IOException; |
|
4 | 3 |
import java.sql.Types; |
5 | 4 |
import java.util.BitSet; |
6 | 5 |
|
7 | 6 |
import com.hardcode.driverManager.DriverLoadException; |
8 |
import com.hardcode.gdbms.engine.data.driver.DriverException;
|
|
7 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
|
|
9 | 8 |
import com.iver.andami.PluginServices; |
10 | 9 |
import com.iver.andami.messages.NotificationManager; |
11 | 10 |
import com.iver.andami.plugins.Extension; |
12 | 11 |
import com.iver.andami.ui.mdiManager.IWindow; |
13 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
14 | 12 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
15 | 13 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
16 | 14 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
... | ... | |
53 | 51 |
* @param table |
54 | 52 |
*/ |
55 | 53 |
private void invertSelection(Table table) { |
56 |
SelectableDataSource sds = table.getModel().getModelo().getRecordset(); |
|
57 |
FBitSet selectedRows=sds.getSelection(); |
|
58 | 54 |
try { |
59 |
selectedRows.flip(0, (int)sds.getRowCount()); |
|
60 |
} catch (DriverException e) { |
|
55 |
SelectableDataSource sds = table.getModel().getModelo().getRecordset(); |
|
56 |
FBitSet selectedRows=sds.getSelection(); |
|
57 |
selectedRows.flip(0, (int)sds.getRowCount()); |
|
58 |
sds.setSelection(selectedRows); |
|
59 |
} catch (ReadDriverException e) { |
|
61 | 60 |
e.printStackTrace(); |
62 | 61 |
NotificationManager.addError(e); |
63 | 62 |
} |
64 |
sds.setSelection(selectedRows); |
|
65 |
} |
|
63 |
} |
|
66 | 64 |
|
67 | 65 |
private void showsSelectedRows(Table table) { |
68 | 66 |
long[] mapping=null; |
... | ... | |
84 | 82 |
} |
85 | 83 |
} |
86 | 84 |
table.setOrder(mapping); |
87 |
} catch (DriverIOException e) {
|
|
85 |
} catch (ReadDriverException e) {
|
|
88 | 86 |
e.printStackTrace(); |
89 |
} catch (IOException e) { |
|
90 |
e.printStackTrace(); |
|
91 | 87 |
} |
92 | 88 |
|
93 | 89 |
} |
... | ... | |
106 | 102 |
if (v.getClass() == Table.class) { |
107 | 103 |
Table table = (Table) v; |
108 | 104 |
|
109 |
return table.getModel().getModelo().getSelection().cardinality()>0; |
|
105 |
try { |
|
106 |
return table.getModel().getModelo().getSelection().cardinality()>0; |
|
107 |
} catch (ReadDriverException e) { |
|
108 |
e.printStackTrace(); |
|
109 |
} |
|
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
return false; |
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
protected boolean doIsEnabled(Table table) { |
116 |
try {
|
|
117 |
BitSet indices = table.getSelectedFieldIndices();
|
|
116 |
try {
|
|
117 |
BitSet indices = table.getSelectedFieldIndices();
|
|
118 | 118 |
|
119 |
System.out.println("TableNumericFieldOperations.isEnabled: Tabla: " +
|
|
120 |
table.getModel().getModelo().getRecordset().getName());
|
|
119 |
System.out.println("TableNumericFieldOperations.isEnabled: Tabla: "
|
|
120 |
+ table.getModel().getModelo().getRecordset().getName());
|
|
121 | 121 |
|
122 |
if (indices.cardinality() == 1) { |
|
123 |
try { |
|
124 |
int type = table.getModel().getModelo().getRecordset() |
|
125 |
.getFieldType(indices.nextSetBit(0)); |
|
122 |
if (indices.cardinality() == 1) { |
|
123 |
int type = table.getModel().getModelo().getRecordset() |
|
124 |
.getFieldType(indices.nextSetBit(0)); |
|
125 |
if ((type == Types.BIGINT) || (type == Types.DECIMAL) |
|
126 |
|| (type == Types.DOUBLE) || (type == Types.FLOAT) |
|
127 |
|| (type == Types.INTEGER) || (type == Types.SMALLINT) |
|
128 |
|| (type == Types.TINYINT) || (type == Types.REAL) |
|
129 |
|| (type == Types.NUMERIC)) { |
|
130 |
return true; |
|
131 |
} |
|
126 | 132 |
|
127 |
if ((type == Types.BIGINT) || (type == Types.DECIMAL) || |
|
128 |
(type == Types.DOUBLE) || (type == Types.FLOAT) || |
|
129 |
(type == Types.INTEGER) || |
|
130 |
(type == Types.SMALLINT) || |
|
131 |
(type == Types.TINYINT) || (type == Types.REAL) || |
|
132 |
(type == Types.NUMERIC)) { |
|
133 |
return true; |
|
134 |
} |
|
135 |
} catch (DriverException e) { |
|
136 |
return false; |
|
137 |
} |
|
138 |
} |
|
139 |
} catch (DriverLoadException e1) { |
|
140 |
// TODO Auto-generated catch block |
|
141 |
e1.printStackTrace(); |
|
142 |
} |
|
133 |
} |
|
134 |
} catch (DriverLoadException e1) { |
|
135 |
e1.printStackTrace(); |
|
136 |
} catch (ReadDriverException e) { |
|
137 |
e.printStackTrace(); |
|
138 |
} |
|
143 | 139 |
|
144 |
return false;
|
|
145 |
}
|
|
140 |
return false;
|
|
141 |
}
|
|
146 | 142 |
|
147 | 143 |
/** |
148 |
* DOCUMENT ME!
|
|
149 |
*
|
|
150 |
* @return DOCUMENT ME!
|
|
151 |
*/
|
|
144 |
* DOCUMENT ME!
|
|
145 |
*
|
|
146 |
* @return DOCUMENT ME!
|
|
147 |
*/
|
|
152 | 148 |
public boolean isVisible() { |
153 | 149 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
154 | 150 |
|
Also available in: Unified diff