Example usage for com.google.gwt.gen2.table.client DefaultTableDefinition addColumnDefinition

List of usage examples for com.google.gwt.gen2.table.client DefaultTableDefinition addColumnDefinition

Introduction

In this page you can find the example usage for com.google.gwt.gen2.table.client DefaultTableDefinition addColumnDefinition.

Prototype

public void addColumnDefinition(int index, ColumnDefinition<RowType, ?> columnDef) 

Source Link

Document

Insert a ColumnDefinition at a specific index.

Usage

From source file:org.apache.hupa.client.widgets.DragRefetchPagingScrollTable.java

License:Apache License

public void setDragHandler(int newCellIndex, int cellWidth, DragHandlerFactory factory) {
    this.factory = factory;

    if (newCellIndex < 0) {
        throw new IllegalArgumentException("cellIndex needs to be higher then 0");
    }//www. ja v a  2s. c  o  m

    DefaultTableDefinition<RowType> tableDef = (DefaultTableDefinition<RowType>) getTableDefinition();

    // remove old definition 
    if (cellIndex != -1) {
        tableDef.removeColumnDefinition(tableDef.getColumnDefinition(cellIndex));
    }

    this.cellIndex = newCellIndex;

    // Create new ghost definition which will get used later to add the drag widget
    DragColumnDefinition def = new DragColumnDefinition();
    def.setColumnSortable(false);
    def.setColumnTruncatable(false);
    def.setMaximumColumnWidth(cellWidth);
    def.setPreferredColumnWidth(cellWidth);
    def.setMinimumColumnWidth(cellWidth);
    tableDef.addColumnDefinition(cellIndex, def);
}