View Javadoc

1   /*
2    * Created on 06-Apr-2005
3    */
4   package com.webstersmalley.mediacollection.model;
5   
6   import ca.odell.glazedlists.gui.TableFormat;
7   
8   /**
9    */
10  public class SimpleMediaCollectionTableFormat implements TableFormat
11  {
12  	/* (non-Javadoc)
13  	 * @see ca.odell.glazedlists.gui.TableFormat#getColumnCount()
14  	 */
15  	public int getColumnCount()
16  	{
17  		return SimpleMediaCollectionBean.columns.length;
18  	}
19  
20  	/* (non-Javadoc)
21  	 * @see ca.odell.glazedlists.gui.TableFormat#getColumnName(int)
22  	 */
23  	public String getColumnName(int col)
24  	{
25  		return SimpleMediaCollectionBean.columns[col];
26  	}
27  
28  	/* (non-Javadoc)
29  	 * @see ca.odell.glazedlists.gui.TableFormat#getColumnValue(java.lang.Object, int)
30  	 */
31  	public Object getColumnValue(Object obj, int col)
32  	{
33  		if (obj instanceof SimpleMediaCollectionBean)
34  		{
35  			SimpleMediaCollectionBean bean = (SimpleMediaCollectionBean)obj;
36  			return bean.getColumn(col);
37  		}
38  		else
39  		{
40  			throw new RuntimeException("Error: unknown object type (expected SimpleMediaCollectionBean)");
41  		}
42  	}
43  
44  }