use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.
the class ColumnHeaderResizeHoverBindings method configureUiBindings.
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// Mouse move - Show resize cursor
uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0), new ColumnResizeCursorAction());
// apply a hover styling on moving the mouse over a NatTable and clear
// the cursor
uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(GridRegion.COLUMN_HEADER), new HoverStylingAction(this.layer));
// clear any hover styling if the mouse is moved out of a NatTable
// region
uiBindingRegistry.registerMouseMoveBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
return ((natTable != null && regionLabels == null) || regionLabels != null && regionLabels.hasLabel(GridRegion.CORNER));
}
}, new ClearHoverStylingAction());
// clear any hover styling if the mouse is moved out of the NatTable
// area
uiBindingRegistry.registerMouseExitBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
// not necessary
return true;
}
}, new ClearHoverStylingAction());
// Column resize
uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new ColumnResizeDragMode());
uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new AutoResizeColumnAction());
uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1), new NoOpMouseAction());
}
use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.
the class RowHeaderResizeHoverBindings method configureUiBindings.
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// Mouse move - Show resize cursor
uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, 0), new RowResizeCursorAction());
// apply a hover styling on moving the mouse over a NatTable and clear
// the cursor
uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(GridRegion.ROW_HEADER), new HoverStylingAction(this.layer));
// clear any hover styling if the mouse is moved out of the region area
// uiBindingRegistry.registerMouseMoveBinding(
// new IMouseEventMatcher() {
// @Override
// public boolean matches(NatTable natTable, MouseEvent event,
// LabelStack regionLabels) {
// return (regionLabels != null &&
// !regionLabels.hasLabel(GridRegion.ROW_HEADER));
// }
//
// }, new ClearHoverStylingAction(layer));
// clear any hover styling if the mouse is moved out of a NatTable
// region
uiBindingRegistry.registerMouseMoveBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
return (natTable != null && regionLabels == null);
}
}, new ClearHoverStylingAction());
// clear any hover styling if the mouse is moved out of the NatTable
// area
uiBindingRegistry.registerMouseExitBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
// not necessary
return true;
}
}, new ClearHoverStylingAction());
// Row resize
uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, 1), new RowResizeDragMode());
uiBindingRegistry.registerDoubleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new AutoResizeRowAction());
uiBindingRegistry.registerSingleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new NoOpMouseAction());
}
use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.
the class SimpleHoverStylingBindings method configureUiBindings.
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// apply a hover styling on moving the mouse over a NatTable
uiBindingRegistry.registerFirstMouseMoveBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
int width = SimpleHoverStylingBindings.this.layer.getPreferredWidth();
int height = SimpleHoverStylingBindings.this.layer.getPreferredHeight();
return ((event.x > 0 && event.x < width) && (event.y > 0 && event.y < height));
}
}, new HoverStylingAction(this.layer));
// clear any hover styling if the mouse is moved out of the region area
uiBindingRegistry.registerMouseMoveBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
int width = SimpleHoverStylingBindings.this.layer.getPreferredWidth();
int height = SimpleHoverStylingBindings.this.layer.getPreferredHeight();
return ((event.x < 0 || event.x > width) || (event.y < 0 || event.y > height));
}
}, new ClearHoverStylingAction());
// clear any hover styling if the mouse is moved out of a NatTable
// region
uiBindingRegistry.registerMouseMoveBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
return (natTable != null && regionLabels == null);
}
}, new ClearHoverStylingAction());
// clear any hover styling if the mouse is moved out of the NatTable
// area
uiBindingRegistry.registerMouseExitBinding(new IMouseEventMatcher() {
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
// not necessary
return true;
}
}, new ClearHoverStylingAction());
}
Aggregations