Search in sources :

Example 1 with ColumnHeaderReorderDragMode

use of org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode in project nebula.widgets.nattable by eclipse.

the class ColumnHeaderReoderDragModeTest method setup.

@Before
public void setup() {
    this.model = new ColumnGroupModelFixture();
    this.model.addColumnsIndexesToGroup("G4", 18, 19, 20);
    this.model.getColumnGroupByIndex(0).setUnbreakable(true);
    this.model.getColumnGroupByIndex(10).setUnbreakable(true);
    this.testLayer = new DataLayerFixture(20, 10, 100, 20);
    this.dragMode = new ColumnHeaderReorderDragMode(this.model);
}
Also used : ColumnHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode) ColumnGroupModelFixture(org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Before(org.junit.Before)

Example 2 with ColumnHeaderReorderDragMode

use of org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode in project nebula.widgets.nattable by eclipse.

the class DefaultColumnGroupHeaderLayerConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Column Group Header is a part of the Group Header.
    // Register the 'column group header matcher' first so that it gets
    // picked up before the more general 'column header matcher'.
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new ColumnGroupHeaderReorderDragMode(this.columnGroupModel)));
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new ColumnHeaderReorderDragMode(this.columnGroupModel)));
    // added NoOpMouseAction on single click because of Bug 428901
    if (!this.enableColumnGroupSelectionHandling) {
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD2), new NoOpMouseAction());
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1 | SWT.MOD2), new NoOpMouseAction());
    } else {
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new ViewportSelectColumnGroupAction(false, false));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1), new ViewportSelectColumnGroupAction(false, true));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD2), new ViewportSelectColumnGroupAction(true, false));
        uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.MOD1 | SWT.MOD2), new ViewportSelectColumnGroupAction(true, true));
    }
    uiBindingRegistry.registerDoubleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new ColumnGroupExpandCollapseAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'g'), new CreateColumnGroupAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'u'), new UngroupColumnsAction());
}
Also used : ViewportSelectColumnGroupAction(org.eclipse.nebula.widgets.nattable.group.action.ViewportSelectColumnGroupAction) ColumnGroupHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode) KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) AggregateDragMode(org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode) ColumnHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode) CellDragMode(org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode) UngroupColumnsAction(org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction) ColumnGroupExpandCollapseAction(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction) CreateColumnGroupAction(org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)

Example 3 with ColumnHeaderReorderDragMode

use of org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode in project nebula.widgets.nattable by eclipse.

the class ColumnGroupConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    // Column Group Header is a part of the Group Header.
    // Register the 'column group header matcher' first so that it gets
    // picked up before the more general 'column header matcher'.
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new ColumnGroupHeaderReorderDragMode(this.columnGroupModel)));
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new ColumnHeaderReorderDragMode(this.columnGroupModel));
    uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), new ColumnGroupExpandCollapseAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'g'), new CreateColumnGroupAction());
    uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1, 'u'), new UngroupColumnsAction());
}
Also used : ColumnGroupHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode) KeyEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher) AggregateDragMode(org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode) ColumnHeaderReorderDragMode(org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode) CellDragMode(org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode) UngroupColumnsAction(org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction) ColumnGroupExpandCollapseAction(org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction) CreateColumnGroupAction(org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)

Aggregations

ColumnHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode)3 ColumnGroupExpandCollapseAction (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction)2 ColumnGroupHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode)2 CreateColumnGroupAction (org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)2 UngroupColumnsAction (org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction)2 AggregateDragMode (org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode)2 CellDragMode (org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode)2 KeyEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher)2 ViewportSelectColumnGroupAction (org.eclipse.nebula.widgets.nattable.group.action.ViewportSelectColumnGroupAction)1 ColumnGroupModelFixture (org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture)1 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)1 NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)1 Before (org.junit.Before)1