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

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

Introduction

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

Prototype

public void setScrollPolicy(ScrollPolicy scrollPolicy) 

Source Link

Document

Set the scroll policy of the table.

Usage

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.setup.ScrollPolicyOption.java

License:Apache License

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

    // Add the policy
    scrollPolicyBox = new ListBox();
    scrollPolicyBox.addItem("both");
    scrollPolicyBox.addItem("horizontal");
    scrollPolicyBox.addItem("disabled");
    form.addLabeledWidget("Scroll Policy:", scrollPolicyBox);
    refreshPolicy();/* w w w . j  ava 2s . c om*/

    // Add button to change status
    {
        Button button = new Button("Set Scroll Policy", new ClickHandler() {
            public void onClick(ClickEvent event) {
                AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
                switch (scrollPolicyBox.getSelectedIndex()) {
                case 0:
                    scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.BOTH);
                    break;
                case 1:
                    scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.HORIZONTAL);
                    break;
                case 2:
                    scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.DISABLED);
                    break;
                }
            }
        });
        form.addButton(button);
    }

    return form;
}