companydatatablemodel.java

来自「CRMS客户关系管理系统(JAVA版),这是一个客户关系管理系统。」· Java 代码 · 共 116 行

JAVA
116 行
字号
    /* CRMS, customer relationship management system    Copyright (C) 2003  Service To Youth Council    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    For further information contact the SYC ICT department on GPL@syc.net.au    98 Kermode Street    North Adelaide    South Australia    SA 5006     +61 (0)8 8367 0755    *//* * CompanyViewTableModel.java * * Created on 23 April 2003, 16:30 */package crms.applet.company;import java.awt.*;import java.util.*;import javax.swing.table.*;import javax.swing.event.*;import crms.vo.*;/** * * @author  dmurphy */public class CompanyDataTableModel extends AbstractTableModel {                ArrayList listeners = new ArrayList();        ArrayList companies = new ArrayList();        String headings[] = {            "Name",             "Industry",             "Profile"        };                public void setValueAt(Object aValue, int rowIndex, int columnIndex) {            // Read Only        }                public void removeTableModelListener(TableModelListener l) {            listeners.remove(l);        }        public boolean isCellEditable(int rowIndex, int columnIndex) {            return false;        }                public Object getValueAt(int rowIndex, int columnIndex) {            Company company = (Company) companies.get(rowIndex);                        switch(columnIndex) {                case 0:                    return company.getCompanyName();                case 1:                    return company.getCompanyType() != null ? company.getCompanyType().getName() : "Not set";                case 2:                    return company.getNotes();                default:                    //Nasty            }            return null;        }                public int getRowCount() {            return companies.size();        }                public String getColumnName(int columnIndex) {            return headings[columnIndex];        }                public int getColumnCount() {            return headings.length;        }                public Class getColumnClass(int columnIndex) {            return java.lang.String.class;        }                public void addTableModelListener(TableModelListener l) {            listeners.add(l);        }                public void addCompany(Company company) {            companies.add(company);        }                public void clear() {            companies= new ArrayList();        }                public Company get(int i) {            return (Company) companies.get(i);        }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?