Example usage for com.vaadin.client.widgets Grid setWidth

List of usage examples for com.vaadin.client.widgets Grid setWidth

Introduction

In this page you can find the example usage for com.vaadin.client.widgets Grid setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:lh.api.showcase.client.BasicAbstractFormResultView.java

License:Apache License

public BasicAbstractFormResultView(String title, final Grid<T> grid, boolean fullWidth) {
    super();//from   w w w.j a va2s.c  o m
    this.grid = grid;
    Panel main = new VerticalPanel();
    main.setWidth("100%");
    if (title != null) {
        main.add(new HTML("<h1>" + title + "</h1>"));
    }
    ((HasHorizontalAlignment) main).setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    backLink.setStyleDependentName("page", true);

    busyIndicatorPanel.getElement().getStyle().setPadding(10.0, Unit.PX);
    busyIndicatorPanel.add(new Image("images/busy.gif"));
    busyIndicatorPanel.setVisible(false);

    main.add(formPanel);
    main.add(messagePanel);
    main.add(busyIndicatorPanel);
    main.add(resultPanel);
    main.add(bottomNavigationPanel);

    initWidget(main);

    if (grid != null) {

        if (fullWidth) {
            grid.setWidth("100%");
            setResizeHandler();
        }
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
                if (grid.getOffsetWidth() > Window.getClientWidth()) {
                    grid.setWidth("100%");
                    setResizeHandler();
                }
            }
        });
    }
}