Resizable row/column headers in NatTable

2019-09-19 02:46发布

I have NatTable with column and row headers, and use CornerLayer for it. How to make row and column headers resizable like any other column or row?

1条回答
做个烂人
2楼-- · 2019-09-19 03:23

You need to register the necessary bindings to the header regions

gridLayer.addConfiguration(new AbstractUiBindingConfiguration() {

    @Override
    public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
        uiBindingRegistry.registerFirstMouseMoveBinding(
                new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0),
                new ColumnResizeCursorAction());

        uiBindingRegistry.registerFirstMouseDragMode(
                new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1),
                new ColumnResizeDragMode());

        uiBindingRegistry.registerFirstMouseMoveBinding(
                new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0),
                new RowResizeCursorAction());

        uiBindingRegistry.registerFirstMouseDragMode(
                new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1),
                new RowResizeDragMode());
    }
});
查看更多
登录 后发表回答