Example usage for com.google.gwt.gen2.table.client ScrollTable setColumnWidth

List of usage examples for com.google.gwt.gen2.table.client ScrollTable setColumnWidth

Introduction

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

Prototype

public int setColumnWidth(int column, int width) 

Source Link

Document

Set the width of a column.

Usage

From source file:com.openkm.frontend.client.util.ScrollTableHelper.java

License:Open Source License

/**
 * setColumnWidth/*from  w w  w.  jav  a2 s . co m*/
 */
public static void setColumnWidth(ScrollTable table, int col, int width, int type, boolean isMin,
        boolean isMax) {
    table.setColumnWidth(col, width);
    table.setPreferredColumnWidth(col, width);
    int min = 0;
    int max = 0;
    switch (type) {
    case LOW:
        min = width - 15;
        max = width + 25;
        break;
    case MEDIUM:
        min = width - 35;
        max = width + 70;
        break;
    case GREAT:
        min = width - 150;
        max = width + 250;
        break;
    }
    // Correction to min always >=25 except in fixed case
    if (type == FIXED) {
        min = width;
        max = width;
    } else if (min < 25) {
        min = 25;
    }
    // Set min and max values
    if (isMin) {
        table.setMinimumColumnWidth(col, min);
    }
    if (isMax) {
        table.setMaximumColumnWidth(col, max);
    }
}