Revision 12514 trunk/libraries/libUIComponent/src/org/gvsig/gui/beans/table/TableContainer.java
TableContainer.java | ||
---|---|---|
38 | 38 |
private static final int INTERNAL_MARGIN = 10; |
39 | 39 |
private int PHEIGHT = 120; |
40 | 40 |
|
41 |
private Table pTable = null;
|
|
41 |
private Table table = null;
|
|
42 | 42 |
private TableControlerPanel pTableControl = null; |
43 | 43 |
private String[] columnNames = null; |
44 | 44 |
private int[] columnWidths = null; |
... | ... | |
78 | 78 |
this.setPreferredSize(new java.awt.Dimension(0, PHEIGHT)); |
79 | 79 |
this.setLayout(new BorderLayout(5, 5)); |
80 | 80 |
this.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
81 |
this.add(getPTable(), BorderLayout.CENTER);
|
|
81 |
this.add(getTable(), BorderLayout.CENTER); |
|
82 | 82 |
this.add(getPTableControl(), BorderLayout.SOUTH); |
83 | 83 |
} |
84 | 84 |
|
... | ... | |
87 | 87 |
* |
88 | 88 |
* @return javax.swing.JPanel |
89 | 89 |
*/ |
90 |
public Table getPTable() {
|
|
91 |
if (pTable == null) {
|
|
92 |
pTable = new Table(columnNames, columnWidths, tableModelClass);
|
|
93 |
pTable.setTableContainer(this);
|
|
90 |
public Table getTable() { |
|
91 |
if (table == null) {
|
|
92 |
table = new Table(columnNames, columnWidths, tableModelClass);
|
|
93 |
table.setTableContainer(this);
|
|
94 | 94 |
} |
95 |
return pTable;
|
|
95 |
return table;
|
|
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
/** |
... | ... | |
126 | 126 |
throw new NotInitializeException(); |
127 | 127 |
|
128 | 128 |
TableListener.comboEventEnable = false; |
129 |
((Table)pTable).addRow(list);
|
|
130 |
pTableControl.addPointToTable(((Table)pTable).getTable().getRowCount());
|
|
129 |
getTable().addRow(list);
|
|
130 |
pTableControl.addPointToTable((getTable()).getJTable().getRowCount());
|
|
131 | 131 |
setSelectedIndex(getRowCount() - 1); |
132 | 132 |
TableListener.comboEventEnable = true; |
133 | 133 |
} |
... | ... | |
148 | 148 |
setSelectedIndex(getSelectedIndex() + 1); |
149 | 149 |
}catch(ArrayIndexOutOfBoundsException exc){} |
150 | 150 |
} |
151 |
((Table)pTable).delRow(i);
|
|
151 |
getTable().delRow(i);
|
|
152 | 152 |
pTableControl.setNItems(getRowCount()); |
153 | 153 |
TableListener.comboEventEnable = true; |
154 | 154 |
} |
... | ... | |
161 | 161 |
throw new NotInitializeException(); |
162 | 162 |
|
163 | 163 |
TableListener.comboEventEnable = false; |
164 |
((Table)pTable).removeAllRows();
|
|
164 |
getTable().removeAllRows();
|
|
165 | 165 |
pTableControl.setNItems(0); |
166 | 166 |
TableListener.comboEventEnable = true; |
167 | 167 |
} |
... | ... | |
174 | 174 |
if(!initTable) |
175 | 175 |
throw new NotInitializeException(); |
176 | 176 |
|
177 |
return ((Table)pTable).getTable().getRowCount();
|
|
177 |
return getTable().getJTable().getRowCount();
|
|
178 | 178 |
} |
179 | 179 |
|
180 | 180 |
/** |
... | ... | |
188 | 188 |
TableListener.comboEventEnable = false; |
189 | 189 |
try{ |
190 | 190 |
pTableControl.setSelectedIndex(i); |
191 |
((Table)pTable).getTable().setRowSelectionInterval(i, i);
|
|
191 |
getTable().getJTable().setRowSelectionInterval(i, i);
|
|
192 | 192 |
}catch(IllegalArgumentException ex){ |
193 | 193 |
|
194 | 194 |
} |
... | ... | |
203 | 203 |
if(!initTable) |
204 | 204 |
throw new NotInitializeException(); |
205 | 205 |
|
206 |
return ((Table)pTable).getTable().getSelectedRow();
|
|
206 |
return getTable().getJTable().getSelectedRow();
|
|
207 | 207 |
} |
208 | 208 |
|
209 | 209 |
/** |
... | ... | |
216 | 216 |
if(!initTable) |
217 | 217 |
throw new NotInitializeException(); |
218 | 218 |
|
219 |
((Table)pTable).getTable().setValueAt(value, row, col);
|
|
219 |
getTable().getJTable().setValueAt(value, row, col);
|
|
220 | 220 |
} |
221 | 221 |
|
222 | 222 |
/** |
... | ... | |
229 | 229 |
throw new NotInitializeException(); |
230 | 230 |
|
231 | 231 |
if(!editable) |
232 |
((Table)pTable).getTable().setBackground(this.getBackground());
|
|
232 |
getTable().getJTable().setBackground(this.getBackground());
|
|
233 | 233 |
else |
234 |
((Table)pTable).getTable().setBackground(Color.white);
|
|
234 |
getTable().getJTable().setBackground(Color.white);
|
|
235 | 235 |
|
236 |
((Table)pTable).getTable().setEnabled(editable);
|
|
236 |
getTable().getJTable().setEnabled(editable);
|
|
237 | 237 |
} |
238 | 238 |
|
239 | 239 |
/** |
... | ... | |
249 | 249 |
* @return |
250 | 250 |
*/ |
251 | 251 |
public DefaultTableModel getModel(){ |
252 |
return (DefaultTableModel)((Table)pTable).getTable().getModel();
|
|
252 |
return (DefaultTableModel) getTable().getJTable().getModel();
|
|
253 | 253 |
} |
254 | 254 |
|
255 | 255 |
/** |
... | ... | |
281 | 281 |
* Activar o desactivar los componentes del panel |
282 | 282 |
*/ |
283 | 283 |
public void setEnabled(boolean enabled){ |
284 |
getPTable().getTable().setEnabled(enabled);
|
|
284 |
getTable().getJTable().setEnabled(enabled);
|
|
285 | 285 |
if(!enabled) |
286 | 286 |
getPTableControl().disableAllControls(); |
287 | 287 |
else |
Also available in: Unified diff