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

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

Introduction

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

Prototype

public void resetColumnWidths() 

Source Link

Document

Reset the widths of all columns to their preferred sizes.

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();/*  www . ja  va  2  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;
}