本文介绍了NatTable中可调整大小的行/列标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有列和行标题的NatTable,并为其使用CornerLayer.如何使行和列标题可调整为与其他任何列或行一样的大小?

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?

推荐答案

您需要注册对标头区域的必要绑定

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());
    }
});

这篇关于NatTable中可调整大小的行/列标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-05 14:01