Example usage for com.google.gwt.gen2.table.client AbstractScrollTable setColumnResizePolicy

List of usage examples for com.google.gwt.gen2.table.client AbstractScrollTable setColumnResizePolicy

Introduction

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

Prototype

public void setColumnResizePolicy(ColumnResizePolicy columnResizePolicy) 

Source Link

Document

Set the resize policy applied to user actions that resize columns.

Usage

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.column.ColumnResizePolicyOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Add the current policy
    policyBox = new ListBox();
    policyBox.addItem("Disabled");
    policyBox.addItem("Single Cell");
    policyBox.addItem("Multi Cell");
    form.addLabeledWidget("Column Resize Policy:", policyBox);
    refreshPolicy();//w  w  w  . j  av  a2  s. c  o m

    // Add button to change status
    {
        Button button = new Button("Set Resize Policy", new ClickHandler() {
            public void onClick(ClickEvent event) {
                AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
                switch (policyBox.getSelectedIndex()) {
                case 0:
                    scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.DISABLED);
                    break;
                case 1:
                    scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.SINGLE_CELL);
                    break;
                case 2:
                    scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.MULTI_CELL);
                    break;
                }
            }
        });
        form.addButton(button);
    }

    // Add button to reset column widths
    {
        Button button = new Button("Reset Column Widths", new ClickHandler() {
            public void onClick(ClickEvent event) {
                AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
                scrollTable.resetColumnWidths();
            }
        });
        form.addButton(button);
    }

    return form;
}