use of javax.swing.event.TableModelListener in project dna by leifeld.
the class DocumentTableModel method addDocument.
public void addDocument(Document document) {
int id = document.getId();
Dna.data.getDocuments().add(document);
sort();
int index = getModelIndexById(id);
// notify all listeners
TableModelEvent e = new TableModelEvent(this, index, index, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT);
for (int i = 0, n = listeners.size(); i < n; i++) {
((TableModelListener) listeners.get(i)).tableChanged(e);
}
}
use of javax.swing.event.TableModelListener in project dna by leifeld.
the class DocumentTableModel method remove.
public void remove(int index, boolean alsoStatements) {
if (alsoStatements == true) {
int id = Dna.data.getDocuments().get(index).getId();
for (int i = Dna.data.getStatements().size() - 1; i > -1; i--) {
if (Dna.data.getStatements().get(i).getDocumentId() == id) {
Dna.data.getStatements().remove(i);
}
}
Dna.dna.gui.rightPanel.statementPanel.statementTable.updateUI();
}
Dna.data.getDocuments().remove(index);
TableModelEvent e = new TableModelEvent(this);
for (int i = 0, n = listeners.size(); i < n; i++) {
((TableModelListener) listeners.get(i)).tableChanged(e);
}
}
use of javax.swing.event.TableModelListener in project WorldPainter by Captain-Chaos.
the class CombinedLayerTableModel method addRow.
void addRow(Row row) {
rows.add(row);
TableModelEvent event = new TableModelEvent(this, rows.size() - 1, rows.size() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT);
for (TableModelListener listener : listeners) {
listener.tableChanged(event);
}
}
use of javax.swing.event.TableModelListener in project WorldPainter by Captain-Chaos.
the class CombinedLayerTableModel method deleteRow.
void deleteRow(int rowIndex) {
rows.remove(rowIndex);
TableModelEvent event = new TableModelEvent(this, rowIndex, rowIndex, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE);
for (TableModelListener listener : listeners) {
listener.tableChanged(event);
}
}
use of javax.swing.event.TableModelListener in project WorldPainter by Captain-Chaos.
the class TunnelFloorLayersTableModel method addLayer.
public void addLayer(Layer layer) {
if (!layers.contains(layer)) {
layers.add(layer);
settings.put(layer, new TunnelLayer.LayerSettings());
int row = layers.size() - 1;
TableModelEvent event = new TableModelEvent(this, row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT);
for (TableModelListener listener : listeners) {
listener.tableChanged(event);
}
}
}
Aggregations