간단히 말해서 CellTable을 확장하는 데 방해가되는 것은 없습니다. 다른 Java 클래스와 마찬가지로 확장 될 수 있습니다. 당신이 당신의 세포를 사용할 수 있으며, CellTable을 확장함으로써
public class MyCellTable extends CellTable<Contact>{
public MyCellTable(String col1, String col2){
TextColumn<Contact> nameColumn = new TextColumn<Contact>() { /* ... */ };
table.addColumn(nameColumn, col1);
TextColumn<Contact> addressColumn = new TextColumn<Contact>() { /* ... */ };
table.addColumn(addressColumn, col2);
}
}
:
CellTable<Contact> table = new CellTable<Contact>();
TextColumn<Contact> nameColumn = new TextColumn<Contact>() { /* ... */ };
table.addColumn(nameColumn, "Name");
TextColumn<Contact> addressColumn = new TextColumn<Contact>() { /* ... */ };
table.addColumn(addressColumn, "Address");
table.setRowData(/* ... */);
당신은 다음처럼 자신의 클래스에 압축을 풉니 수 :
예를 들어, 우리는의 CellTable를 사용하자 다른 테이블처럼.
MyCellTable table = new MyCellTable("Name", "Address");
table.setRowData(/* ... */);