Search in sources :

Example 1 with IMouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.

the class MouseEventMatcherTest method testFullConstructorEquals.

@Test
public void testFullConstructorEquals() {
    IMouseEventMatcher matcher1 = new MouseEventMatcher(5, "Test_Region", 1);
    IMouseEventMatcher matcher2 = new MouseEventMatcher(5, "Test_Region", 1);
    Assert.assertEquals(matcher1, matcher2);
}
Also used : IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) Test(org.junit.Test)

Example 2 with IMouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.

the class MouseEventMatcherTest method testNotEqual.

@Test
public void testNotEqual() {
    IMouseEventMatcher matcher = new MouseEventMatcher(5, "Test_Region", 1);
    Assert.assertFalse(matcher.equals(new MouseEventMatcher(4, "Test_Region", 1)));
    Assert.assertFalse(matcher.equals(new MouseEventMatcher(5, "X_Region", 1)));
    Assert.assertFalse(matcher.equals(new MouseEventMatcher(5, "Test_Region", 2)));
    Assert.assertFalse(matcher.equals(new MouseEventMatcher(4, "X_Region", 2)));
}
Also used : IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) Test(org.junit.Test)

Example 3 with IMouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.

the class MouseEventMatcherTest method testMap.

@Test
public void testMap() {
    Map<IMouseEventMatcher, String> map = new HashMap<IMouseEventMatcher, String>();
    map.put(new MouseEventMatcher(), "ABC");
    Assert.assertEquals(1, map.size());
    map.remove(new MouseEventMatcher());
    Assert.assertEquals(0, map.size());
}
Also used : IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with IMouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.

the class MouseEventMatcherTest method testDefaultEquals.

@Test
public void testDefaultEquals() {
    IMouseEventMatcher matcher1 = new MouseEventMatcher();
    IMouseEventMatcher matcher2 = new MouseEventMatcher();
    Assert.assertEquals(matcher1, matcher2);
}
Also used : IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) Test(org.junit.Test)

Example 5 with IMouseEventMatcher

use of org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher in project nebula.widgets.nattable by eclipse.

the class BodyHoverStylingBindings 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) {
            return BodyHoverStylingBindings.this.layer.getClientAreaProvider().getClientArea().contains(event.x, event.y);
        }
    }, 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
    // (!layer.getClientAreaProvider().getClientArea().contains(event.x,
    // event.y));
    // }
    // 
    // }, 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());
}
Also used : ClearHoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction) IMouseEventMatcher(org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher) MouseEvent(org.eclipse.swt.events.MouseEvent) LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) ClearHoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction) HoverStylingAction(org.eclipse.nebula.widgets.nattable.hover.action.HoverStylingAction)

Aggregations

IMouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.IMouseEventMatcher)8 MouseEventMatcher (org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher)6 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)4 ClearHoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.ClearHoverStylingAction)4 HoverStylingAction (org.eclipse.nebula.widgets.nattable.hover.action.HoverStylingAction)4 LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Test (org.junit.Test)4 NoOpMouseAction (org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction)2 HashMap (java.util.HashMap)1 AutoResizeColumnAction (org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeColumnAction)1 AutoResizeRowAction (org.eclipse.nebula.widgets.nattable.resize.action.AutoResizeRowAction)1 ColumnResizeCursorAction (org.eclipse.nebula.widgets.nattable.resize.action.ColumnResizeCursorAction)1 RowResizeCursorAction (org.eclipse.nebula.widgets.nattable.resize.action.RowResizeCursorAction)1 ColumnResizeEventMatcher (org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEventMatcher)1 RowResizeEventMatcher (org.eclipse.nebula.widgets.nattable.resize.event.RowResizeEventMatcher)1 ColumnResizeDragMode (org.eclipse.nebula.widgets.nattable.resize.mode.ColumnResizeDragMode)1 RowResizeDragMode (org.eclipse.nebula.widgets.nattable.resize.mode.RowResizeDragMode)1