Package cli_fmw.address

Source Code of cli_fmw.address.TableModelBlocks

/*
* 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();
        }
    }

}
TOP

Related Classes of cli_fmw.address.TableModelBlocks

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.