Remove TODO file
[remote/remote-gui.git] / src / motedata / ColumnHeaderWrapper.java
blob51ffcd530c784a53cad29bdf7c95125a059d6153
1 package diku.distlab.remote.client.motedata;
3 import diku.distlab.remote.motedata.ColumnHeader;
5 public class ColumnHeaderWrapper implements TableHeader {
7 ColumnHeader[] columnHeaders;
8 Table parentTable;
9 int visibleCount;
11 protected ColumnHeaderWrapper(Table parentTable,ColumnHeader[] columnHeaders) {
12 super();
13 this.columnHeaders = columnHeaders;
14 this.parentTable = parentTable;
15 this.initVisibleCount();
18 public int indexOf(String columnName) throws Exception
20 for (int i = 0; i < columnHeaders.length; i++ )
22 if (columnName.equals(columnHeaders[i].getName()))
24 return i;
27 throw new Exception("Column name not found!");
30 public String getTitle(String columnName) throws Exception {
31 return this.getTitle(this.indexOf(columnName));
34 public String getTitle(int columnIndex) {
35 return this.columnHeaders[columnIndex].getTitle();
38 public String getName(int columnIndex) {
39 return this.columnHeaders[columnIndex].getName();
42 public Class getClass(int columnIndex) throws ClassNotFoundException {
43 return Class.forName(columnHeaders[columnIndex].getValueclass());
46 public Class getClass(String columnName) throws Exception {
47 return this.getClass(this.indexOf(columnName));
50 public Table getTable() {
51 return this.parentTable;
54 public boolean isVisible(String columnName) throws Exception {
55 return this.isVisible(this.indexOf(columnName));
58 public boolean isVisible(int columnIndex) {
59 return this.columnHeaders[columnIndex].isVisible();
62 public int countVisible()
64 return visibleCount;
67 private void initVisibleCount()
69 this.visibleCount = 0;
70 for ( int i = 0; i < this.columnHeaders.length; i++ )
72 if (this.columnHeaders[i].isVisible())
74 this.visibleCount++;