Search in sources :

Example 1 with CellDragMode

use of org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode 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 2 with CellDragMode

use of org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode in project nebula.widgets.nattable by eclipse.

the class DefaultHierarchicalTreeLayerConfiguration method configureUiBindings.

@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
    TreeExpandCollapseAction treeExpandCollapseAction = new TreeExpandCollapseAction();
    CellPainterMouseEventMatcher treeImagePainterMouseEventMatcher = new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, TreeImagePainter.class);
    uiBindingRegistry.registerFirstSingleClickBinding(treeImagePainterMouseEventMatcher, treeExpandCollapseAction);
    // Obscure any mouse down bindings for this image painter
    uiBindingRegistry.registerFirstMouseDownBinding(treeImagePainterMouseEventMatcher, new NoOpMouseAction());
    // configure a specialized ColumnReorderDragMode
    uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new AggregateDragMode(new CellDragMode(), new HierarchicalTreeColumnReorderDragMode(this.treeLayer)));
}
Also used : AggregateDragMode(org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode) CellDragMode(org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode) TreeExpandCollapseAction(org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction) CellPainterMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher) HierarchicalTreeColumnReorderDragMode(org.eclipse.nebula.widgets.nattable.hierarchical.action.HierarchicalTreeColumnReorderDragMode) NoOpMouseAction(org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)

Example 3 with CellDragMode

use of org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode 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

AggregateDragMode (org.eclipse.nebula.widgets.nattable.ui.action.AggregateDragMode)3 CellDragMode (org.eclipse.nebula.widgets.nattable.ui.action.CellDragMode)3 ColumnGroupExpandCollapseAction (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupExpandCollapseAction)2 ColumnGroupHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnGroupHeaderReorderDragMode)2 ColumnHeaderReorderDragMode (org.eclipse.nebula.widgets.nattable.group.action.ColumnHeaderReorderDragMode)2 CreateColumnGroupAction (org.eclipse.nebula.widgets.nattable.group.action.CreateColumnGroupAction)2 UngroupColumnsAction (org.eclipse.nebula.widgets.nattable.group.action.UngroupColumnsAction)2 NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)2 KeyEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher)2 ViewportSelectColumnGroupAction (org.eclipse.nebula.widgets.nattable.group.action.ViewportSelectColumnGroupAction)1 HierarchicalTreeColumnReorderDragMode (org.eclipse.nebula.widgets.nattable.hierarchical.action.HierarchicalTreeColumnReorderDragMode)1 TreeExpandCollapseAction (org.eclipse.nebula.widgets.nattable.tree.action.TreeExpandCollapseAction)1 CellPainterMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher)1