@Override public void onClick(final ClickEvent event) { event.preventDefault(); onNodeMouseClick(new NodeMouseClickEvent(event)); } });
if (ViewEventHandlerManager.this.isEnabled()) { restoreClickHandler(); final int x = nodeMouseClickEvent.getX(); final int y = nodeMouseClickEvent.getY(); final int clientX = nodeMouseClickEvent.getMouseEvent().getClientX(); final int clientY = nodeMouseClickEvent.getMouseEvent().getClientY(); final boolean isShiftKeyDown = nodeMouseClickEvent.isShiftKeyDown(); final boolean isAltKeyDown = nodeMouseClickEvent.isAltKeyDown(); final boolean isMetaKeyDown = nodeMouseClickEvent.isMetaKeyDown(); final boolean isButtonLeft = nodeMouseClickEvent.isButtonLeft(); final boolean isButtonMiddle = nodeMouseClickEvent.isButtonMiddle(); final boolean isButtonRight = nodeMouseClickEvent.isButtonRight(); timer.run(() -> { if (fireClickHandler) {
@Override public HandlerRegistration addNodeMouseClickHandler(final NodeMouseClickHandler handler) { return addEnsureHandler(NodeMouseClickEvent.getType(), handler); }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { m_control.onMouseClick(new MouseEvent(event.getX(), event.getY(), event.isShiftKeyDown(), event.isAltKeyDown(), event.isControlKeyDown())); }
private void registerClickHandler() { HandlerRegistration registration = text.addNodeMouseClickHandler(event -> { if (null != textClickEventViewHandler) { eventHandlerManager.get().skipClickHandler(); final TextClickEvent e = new TextClickEvent(event.getX(), event.getY(), event.getMouseEvent().getClientX(), event.getMouseEvent().getClientY()); textClickEventViewHandler.handle(e); eventHandlerManager.get().restoreClickHandler(); } }); eventHandlerManager.get().addHandlersRegistration(ViewEventType.TEXT_CLICK, registration); }
@Test public void checkHeaderSelectionDelegation() { when(gridWidget.selectHeaderCell(eq(relativeLocation), anyBoolean(), anyBoolean())).thenReturn(true); when(gridWidget.isSelected()).thenReturn(false); when(gridWidget.isVisible()).thenReturn(true); when(event.getX()).thenReturn(100); when(event.getY()).thenReturn(200); handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.of(0), Optional.of(1), Optional.empty(), Optional.empty(), event); verify(handler, times(1)).handleHeaderCell(eq(gridWidget), eq(relativeLocation), eq(0), eq(1), eq(event)); verify(gridWidget, times(1)).selectHeaderCell(eq(relativeLocation), eq(false), eq(false)); verify(layer).batch(); verify(selectionManager).select(eq(gridWidget)); }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { // temporarily remove the rect, use findAt to find the underlying shape and trigger the click event if (event.isButtonLeft()) { m_selectionManager.getSelectionShape().removeFromParent(); m_selectionManager.m_layer.draw(); Node<?> node = m_selectionManager.m_layer.getViewport().findShapeAtPoint(event.getX(), event.getY()); m_selectionManager.m_layer.add(m_selectionManager.getSelectionShape()); m_selectionManager.m_layer.draw(); while (node != null) { if (node.isEventHandled(event.getAssociatedType())) { node.fireEvent(event); break; } node = node.getParent(); } } }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { if (event.isButtonLeft()) { clearIfSelection(); } }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { if (m_wiresManager.getSelectionManager() != null) { m_wiresManager.getSelectionManager().selected(m_connector, event.isShiftKeyDown()); } }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { m_control.onMouseClick(new MouseEvent(event.getX(), event.getY(), event.isShiftKeyDown(), event.isAltKeyDown(), event.isControlKeyDown())); }
@Test public void checkHeaderSelectionDelegation() { when(gridWidget.selectHeaderCell(eq(relativeLocation), anyBoolean(), anyBoolean())).thenReturn(true); when(gridWidget.isSelected()).thenReturn(false); when(gridWidget.isVisible()).thenReturn(true); when(event.getX()).thenReturn(100); when(event.getY()).thenReturn(200); handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.of(0), Optional.of(1), Optional.empty(), Optional.empty(), event); verify(handler, times(1)).handleHeaderCell(eq(gridWidget), eq(relativeLocation), eq(0), eq(1), eq(event)); verify(gridWidget, times(1)).selectHeaderCell(eq(relativeLocation), eq(false), eq(false)); verify(layer).batch(); verify(selectionManager).select(eq(gridWidget)); }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { // temporarily remove the rect, use findAt to find the underlying shape and trigger the click event if (event.isButtonLeft()) { m_selectionManager.getSelectionShape().removeFromParent(); m_selectionManager.m_layer.draw(); Node<?> node = m_selectionManager.m_layer.getViewport().findShapeAtPoint(event.getX(), event.getY()); m_selectionManager.m_layer.add(m_selectionManager.getSelectionShape()); m_selectionManager.m_layer.draw(); while (node != null) { if (node.isEventHandled(event.getAssociatedType())) { node.fireEvent(event); break; } node = node.getParent(); } } }
@Override public V addButton(Glyph glyph, String title, Consumer<MouseClickEvent> clickEventConsumer) { final ButtonItem button = toolboxFactory.buttons() .button(renderGlyph(glyph, getGlyphSize())) .decorate(createDecorator()) .tooltip(tooltip.createItem(title)) .onMouseEnter(event -> onMouseEnter()) .onMouseExit(event -> onMouseExit()) .onClick(event -> clickEventConsumer.accept(new MouseClickEvent(event.getX(), event.getY(), event.getMouseEvent() .getClientX(), event.getMouseEvent() .getClientY()))); addButton(button); return cast(); }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { if (event.isButtonLeft()) { clearIfSelection(); } }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { if (m_wiresManager.getSelectionManager() != null) { m_wiresManager.getSelectionManager().selected(m_connector, event.isShiftKeyDown()); } }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { m_control.onMouseClick(new MouseEvent(event.getX(), event.getY(), event.isShiftKeyDown(), event.isAltKeyDown(), event.isControlKeyDown())); }
@Override public void onNodeMouseClick(final NodeMouseClickEvent event) { // temporarily remove the rect, use findAt to find the underlying shape and trigger the click event if (event.isButtonLeft()) { m_selectionManager.getSelectionShape().removeFromParent(); m_selectionManager.m_layer.draw(); Node<?> node = m_selectionManager.m_layer.getViewport().findShapeAtPoint(event.getX(), event.getY()); m_selectionManager.m_layer.add(m_selectionManager.getSelectionShape()); m_selectionManager.m_layer.draw(); while (node != null) { if (node.isEventHandled(event.getAssociatedType())) { node.fireEvent(event); break; } node = node.getParent(); } } }
@Before @SuppressWarnings("unchecked") public void setup() { super.setUp(); this.clickEvent = new NodeMouseClickEvent(nativeClickEvent); this.doubleClickEvent = new NodeMouseDoubleClickEvent(nativeDoubleClickEvent); when(scenarioGridMock.getRendererHelper()).thenReturn(rendererHelper); when(scenarioGridMock.getViewport()).thenReturn(viewportMock); when(scenarioGridMock.getComputedLocation()).thenReturn(computedLocation); when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation); when(rendererHelper.getColumnInformation(anyDouble())).thenReturn(columnInformation); when(columnInformation.getColumn()).thenReturn((GridColumn) gridColumnMock); when(renderingInformation.getBodyBlockInformation()).thenReturn(renderingBlockInformation); when(renderingInformation.getFloatingBlockInformation()).thenReturn(renderingBlockInformation); when(informationHeaderMetaDataMock.getSupportedEditAction()).thenReturn(GridCellEditAction.SINGLE_CLICK); this.handler = spy(new ScenarioSimulationGridWidgetMouseEventHandler()); }
@Override public HandlerRegistration addNodeMouseClickHandler(final NodeMouseClickHandler handler) { return addEnsureHandler(NodeMouseClickEvent.getType(), handler); }