Package view

Source Code of view.TableModelReceived

package view;

import helper.Loger;

import javax.swing.table.AbstractTableModel;

import model.DTOMessage;
import model.Receive;

public class TableModelReceived extends AbstractTableModel
 
  private final String headers[];
 
  public TableModelReceived(String columnHeaders[]){
      headers = columnHeaders;
  }
 
  public int getRowCount()
  {
    //return Receive.receivedMessage.size();
    return Receive.getReceivedMessage().size();
  }
  public int getColumnCount()
  {
    return 3;
  }
 
  public String getColumnName(int col) {   
    return headers[col];
    }
 
  public void changed(){
    fireTableDataChanged();
  }
 
 
  public Object getValueAt( int row, int col )
  {
    DTOMessage message;   
    //message = Receive.receivedMessage.get(row); 
    message = Receive.getReceivedMessage().get(row);
    switch (col){
      case 0:       
        return message.getDate();
      case 1:
        return message.getComputerName();
      case 2:
        return message.message;
    }
    return null;
       
  }
}
TOP

Related Classes of view.TableModelReceived

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.