Example usage for com.google.gwt.user.cellview.client DataGrid setLoadingIndicator

List of usage examples for com.google.gwt.user.cellview.client DataGrid setLoadingIndicator

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client DataGrid setLoadingIndicator.

Prototype

@Override
    public void setLoadingIndicator(Widget widget) 

Source Link

Usage

From source file:stroom.data.grid.client.DataGridViewImpl.java

License:Apache License

private DataGrid<R> createDataGrid(final boolean supportsSelection, final int size) {
    final DataGrid<R> dataGrid = new DataGrid<R>(size, resources) {
        @Override//from w w w .j  a va 2 s. c  o  m
        protected void onBrowserEvent2(final Event event) {
            final int eventType = event.getTypeInt();
            if (Event.ONMOUSEMOVE == eventType) {
                final Heading heading = getHeading(event);
                if (heading != null) {
                    if (handlerRegistration == null) {
                        // Show the resize handle immediately before
                        // attaching the native event preview handler.
                        final ResizeHandle<R> resizeHandle = getResizeHandle();
                        if (!isBusy() && resizeHandle.update(event, heading)) {
                            resizeHandle.show();
                        }

                        handlerRegistration = Event.addNativePreviewHandler(DataGridViewImpl.this);
                    }
                }
            }
            super.onBrowserEvent2(event);
        }
    };

    dataGrid.setWidth("100%");

    // Set the message to display when the table is empty.
    dataGrid.setEmptyTableWidget(emptyTableWidget);
    dataGrid.setLoadingIndicator(loadingTableWidget);

    // Remove min height on header.
    final Node header = dataGrid.getElement().getChild(0);
    final Element e = (Element) header;
    e.addClassName(resources.dataGridStyle().dataGridHeaderBackground());
    e.getStyle().setPropertyPx("minHeight", 5);

    if (supportsSelection) {
        final MultiSelectionModelImpl<R> multiSelectionModel = new MultiSelectionModelImpl<R>() {
            @Override
            public HandlerRegistration addSelectionHandler(final MultiSelectEvent.Handler handler) {
                return dataGrid.addHandler(handler, MultiSelectEvent.getType());
            }

            @Override
            protected void fireChange() {
                MultiSelectEvent.fire(dataGrid,
                        new SelectionType(false, false, allowMultiSelect, false, false));
            }
        };

        dataGrid.setSelectionModel(multiSelectionModel, new MySelectionEventManager(dataGrid));
        selectionModel = multiSelectionModel;
        dataGrid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

        dataGrid.getRowContainer().getStyle().setCursor(Cursor.POINTER);
    } else {
        selectionModel = null;
        dataGrid.getRowContainer().getStyle().setCursor(Cursor.DEFAULT);
    }

    return dataGrid;
}