use of javax.swing.event.TableModelListener in project WorldPainter by Captain-Chaos.
the class CustomLayersTableModel method swap.
/**
* Swap two layers.
*
* @param rowIndex1 The index of the first layer.
* @param rowIndex2 The index of the second layer.
*/
public void swap(int rowIndex1, int rowIndex2) {
if (isHeaderRow(rowIndex1) || isHeaderRow(rowIndex2)) {
throw new IllegalStateException("Cannot swap with header rows");
}
CustomLayer layer = customLayers.get(rowIndex1);
customLayers.set(rowIndex1, customLayers.get(rowIndex2));
customLayers.set(rowIndex2, layer);
orderPristine = false;
TableModelEvent event = new TableModelEvent(this, Math.min(rowIndex1, rowIndex2), Math.max(rowIndex1, rowIndex2));
for (TableModelListener listener : listeners) {
listener.tableChanged(event);
}
}
use of javax.swing.event.TableModelListener in project dna by leifeld.
the class CoderRelationTableModel method clear.
public void clear() {
Dna.data.getCoderRelations().clear();
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 dna by leifeld.
the class StatementTableModel method remove.
public void remove(int index) {
Dna.data.getStatements().remove(index);
TableModelEvent e = new TableModelEvent(this);
for (int j = 0, n = listeners.size(); j < n; j++) {
((TableModelListener) listeners.get(j)).tableChanged(e);
}
}
use of javax.swing.event.TableModelListener in project dna by leifeld.
the class DocumentTableModel method setValueAt.
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
Document document = Dna.data.getDocuments().get(rowIndex);
switch(columnIndex) {
case 0:
document.setId((Integer) aValue);
break;
case 1:
document.setTitle((String) aValue);
break;
case 3:
document.setDate((Date) aValue);
break;
case 4:
document.setDate((Date) aValue);
break;
case 5:
document.setCoder(((Coder) aValue).getId());
break;
case 6:
document.setAuthor((String) aValue);
break;
case 7:
document.setSource((String) aValue);
break;
case 8:
document.setSection((String) aValue);
break;
case 9:
document.setType((String) aValue);
break;
case 10:
document.setNotes((String) aValue);
break;
}
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 CodenameOne by codenameone.
the class MultiImageSVGEditor method setImage.
public void setImage(com.codename1.ui.Image img) {
com.codename1.impl.javase.SVG s = (com.codename1.impl.javase.SVG) img.getSVGDocument();
if (s.getDpis() != null) {
for (int iter = 0; iter < dpiTable.getRowCount(); iter++) {
dpiTable.setValueAt(Boolean.FALSE, iter, 1);
}
for (int iter = 0; iter < s.getDpis().length; iter++) {
int row = getDPIRow(s.getDpis()[iter]);
dpiTable.setValueAt(Boolean.TRUE, row, 1);
dpiTable.setValueAt(s.getWidthForDPI()[iter], row, 2);
dpiTable.setValueAt(s.getHeightForDPI()[iter], row, 3);
}
}
renderer = new CodenameOneImageRenderer(img);
preview.removeAll();
preview.add(BorderLayout.CENTER, renderer);
preview.revalidate();
dpiTable.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
updateSVGImage();
}
});
}
Aggregations