/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cli_fmw.address;
import cli_fmw.delegate.directory.complex.DirectoryKladrItem;
import javax.swing.table.AbstractTableModel;
/**
*
* @author petr
*/
public class TableModelBlocks extends AbstractTableModel {
DirectoryKladrItem[] blocks;
public TableModelBlocks(DirectoryKladrItem[] blocks) {
this.blocks = blocks;
}
public int getRowCount() {
return blocks.length;
}
public int getColumnCount() {
return 2;
}
@Override
public String getColumnName(int column) {
if (column == 0){
return "Диапазон домов";
}else {
return "Почтовый индекс";
}
}
public Object getValueAt(int rowIndex, int columnIndex) {
DirectoryKladrItem block = blocks[rowIndex];
if (columnIndex == 0){
return block.getTitle();
}else{
return block.getPostIndex();
}
}
}