1 21 package org.jacorb.imr.util; 22 23 import javax.swing.table.*; 24 import org.jacorb.imr.*; 25 import javax.swing.event.*; 26 63 64 public class ImRPOATableModel extends AbstractTableModel { 65 private static final String [] m_columns = new String [] {"Name", "Host", "Port", "active"}; 66 67 private POAInfo[] m_poas = null; 68 69 75 public void setPOAs(POAInfo[] poas){ 76 if (m_poas != poas){ 77 m_poas = poas; 78 fireTableChanged(new TableModelEvent(this)); 79 } 80 } 81 82 87 public int getRowCount(){ 88 if (m_poas == null) 89 return 0; 90 else 91 return m_poas.length; 92 } 93 94 99 public int getColumnCount(){ 100 return m_columns.length; 101 } 102 103 109 public String getColumnName(int column){ 110 return m_columns[column]; 111 } 112 113 119 public Class getColumnClass(int index){ 120 if (index == 0 || index == 1) 121 return String .class; 122 123 else if (index == 2) 124 return Integer .class; 125 126 else if (index == 3) 127 return Boolean .class; 128 129 else 130 return Object .class; 131 } 132 133 140 public Object getValueAt(int row, int column){ 141 if (column == 0) 142 return m_poas[row].name; 143 144 else if (column == 1) 145 return m_poas[row].host; 146 147 else if (column == 2) 148 return new Integer (m_poas[row].port); 149 150 else if (column == 3) 151 return new Boolean (m_poas[row].active); 152 153 return new Object (); 154 } 155 156 161 public String getServerName(){ 162 if (m_poas == null || m_poas.length == 0) 163 return null; 164 else 165 return m_poas[0].server; 167 } 168 } 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | Popular Tags |