181 |
*/ |
*/ |
182 |
public void setDataVector(Vector data, Vector columnNames) |
public void setDataVector(Vector data, Vector columnNames) |
183 |
{ |
{ |
184 |
dataVector = data; |
if (data == null) |
185 |
columnIdentifiers = columnNames; |
dataVector = new Vector(); |
186 |
for (int r = 0; r < data.size(); r++) { |
else |
187 |
((Vector) dataVector.get(r)).setSize(columnNames.size()); |
dataVector = data; |
188 |
} |
setColumnIdentifiers(columnNames); |
|
fireTableStructureChanged(); |
|
189 |
} |
} |
190 |
|
|
191 |
/** |
/** |
319 |
} |
} |
320 |
if (columnIdentifiers != null) |
if (columnIdentifiers != null) |
321 |
columnIdentifiers.setSize(columnCount); |
columnIdentifiers.setSize(columnCount); |
322 |
fireTableDataChanged(); |
fireTableStructureChanged(); |
323 |
} |
} |
324 |
|
|
325 |
/** |
/** |
385 |
((Vector) dataVector.get(i)).add(columnData == null ? null : columnData[i]); |
((Vector) dataVector.get(i)).add(columnData == null ? null : columnData[i]); |
386 |
} |
} |
387 |
columnIdentifiers.add(columnName); |
columnIdentifiers.add(columnName); |
388 |
fireTableDataChanged(); |
fireTableStructureChanged(); |
389 |
} |
} |
390 |
|
|
391 |
/** |
/** |
395 |
* @param rowData the row data (<code>null</code> permitted). |
* @param rowData the row data (<code>null</code> permitted). |
396 |
*/ |
*/ |
397 |
public void addRow(Vector rowData) { |
public void addRow(Vector rowData) { |
398 |
|
int rowIndex = dataVector.size(); |
399 |
dataVector.add(rowData); |
dataVector.add(rowData); |
400 |
newRowsAdded(new TableModelEvent( |
newRowsAdded(new TableModelEvent( |
401 |
this, dataVector.size(), dataVector.size(), -1, TableModelEvent.INSERT) |
this, rowIndex, rowIndex, -1, TableModelEvent.INSERT) |
402 |
); |
); |
403 |
} |
} |
404 |
|
|
451 |
{ |
{ |
452 |
dataVector.insertElementAt(removed.get(i), toIndex); |
dataVector.insertElementAt(removed.get(i), toIndex); |
453 |
} |
} |
454 |
fireTableDataChanged(); |
int firstRow = Math.min(startIndex, toIndex); |
455 |
|
int lastRow = Math.max(endIndex, toIndex + (endIndex - startIndex)); |
456 |
|
fireTableRowsUpdated(firstRow, lastRow); |
457 |
} |
} |
458 |
|
|
459 |
/** |
/** |
505 |
else |
else |
506 |
result = super.getColumnName(column); |
result = super.getColumnName(column); |
507 |
} |
} |
508 |
|
else |
509 |
|
result = super.getColumnName(column); |
510 |
} |
} |
511 |
return result; |
return result; |
512 |
} |
} |