Configuring the table component through the API

For details of the classes involved in the architecture of the table component, see Filtering rows.
The following example shows how to configure the table view ( IlpTableView) through the API. For details on programming the individual services, see Table component services .

How to configure the table view with the API

IlpTableView view = table.getView();

// Setting the selection mode
view.setSelectionMode(ListSelectionModel.SINGLE_OBJECT_SELECTION);

// Setting the table cell renderer
view.setDefaultRenderer(new MyTableCellRenderer());

// Setting the grid color
view.setGridColor(Color.blue);
The following example shows how to configure the table interactor through the API. For details, see Interacting with the table view.

How to configure the table interactor with the API

// Create the table, and retrieve the view interactor
IlpTable tableComponent = new IlpTable()
IlpViewInteractor viewInteractor = tableComponent.getViewInteractor();
// Create a Swing action
// We assume the MyAction class is defined elsewhere
Action myAction = new MyAction();
// Double-clicking the left mouse button will trigger myAction
viewInteractor.setGestureAction(IlpGesture.BUTTON1_DOUBLE_CLICKED,myAction);
The following example shows how to configure the table adapter through the API. See Table component services for details on programming the individual services.

How to configure the table adapter with the API

IlpListAdapter adapter = table.getAdapter();

// Accepted class
// (it is the same as adapter.setAcceptedClass)
table.setAcceptedClass(IltNetworkElement.GetIlpClass());

// Setting the filter
IlpFilter myFilter = new MyFilter();
// (it is the same as adapter.setFilter(myFilter)
table.setFilter(myFilter);

// Table Row Factory
IlpTableRowFactory myRowFactory = new MyTableRowFactory();
adapter.setRepresentationObjectFactory(myRowFactory);