import javax.swing.table.*;

public class MemberInfoPanel extends javax.swing.JPanel {

    /** Creates new form MemberInfoPanel */
    public MemberInfoPanel() {
        initComponents();

	memberTable.setRowSorter(new TableRowSorter(memberTable.getModel()));
    }

    public void displayHedFile(HedFile2 hedfile) {
	DefaultTableModel model = (DefaultTableModel)memberTable.getModel();
	model.setRowCount(hedfile.mMembers.size());
	for(int i = 0; i < hedfile.mMembers.size(); i++) {
	    HedMember member = hedfile.mMembers.get(i);
	    model.setValueAt(member.mPath1, i, 0);
	    model.setValueAt(member.mPath2, i, 1);
	    model.setValueAt(member.mDatIndex, i, 2);
	    model.setValueAt(member.mFileOffset, i, 3);
	    model.setValueAt(member.mMemberSize, i, 4);
	    model.setValueAt(hedfile.getStatus(member), i, 5);
	}
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        memberTable = new javax.swing.JTable();

        memberTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "path 1", "path 2", "dat index", "offset", "size", "status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        memberTable.getTableHeader().setReorderingAllowed(false);
        DefaultTableColumnModel columnModel
        = (DefaultTableColumnModel)memberTable.getColumnModel();
        columnModel.getColumn(1).setPreferredWidth(200);
        columnModel.getColumn(2).setPreferredWidth(10);
        columnModel.getColumn(3).setPreferredWidth(50);
        columnModel.getColumn(4).setPreferredWidth(50);
        jScrollPane2.setViewportView(memberTable);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 359, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable memberTable;
    // End of variables declaration//GEN-END:variables

}
