本文整理汇总了Java中com.ait.lienzo.client.core.event.NodeMouseClickHandler类的典型用法代码示例。如果您正苦于以下问题:Java NodeMouseClickHandler类的具体用法?Java NodeMouseClickHandler怎么用?Java NodeMouseClickHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeMouseClickHandler类属于com.ait.lienzo.client.core.event包,在下文中一共展示了NodeMouseClickHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
public TemplateShape build(final String templateName,
final NodeMouseClickHandler clickHandler) {
final TemplateShape templateShape = new TemplateShape();
final Shape shape = drawShape();
final Rectangle bounding = drawBoundingBox();
final Text description = drawDescription(templateName);
//Attach handles for drag operation
shape.addNodeMouseClickHandler(clickHandler);
bounding.addNodeMouseClickHandler(clickHandler);
description.addNodeMouseClickHandler(clickHandler);
//Build Template Shape
templateShape.setBounding(bounding);
templateShape.setShape(shape);
templateShape.setDescription(description);
return templateShape;
}
示例2: WiresBaseShape
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
public WiresBaseShape() {
id = UUID.uuid();
setDraggable(true);
//Clicking the Group selects the Shape
addNodeMouseClickHandler(new NodeMouseClickHandler() {
@Override
public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) {
selectionManager.selectShape(WiresBaseShape.this);
}
});
//Update Control positions when Shape is dragged
addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {
updateControlLocations();
}
});
}
示例3: setup
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
super.init();
when(buttonsFactory.dropRight(any(Group.class))).thenReturn(buttonGridItem);
when(decoratorsFactory.button()).thenReturn(buttonDecorator);
when(buttonDecorator.configure(any(Consumer.class))).thenReturn(buttonDecorator);
when(buttonDecorator.setBoundingBox(any(BoundingBox.class))).thenReturn(buttonDecorator);
when(buttonDecorator.setPadding(anyDouble())).thenReturn(buttonDecorator);
when(buttonDecorator.copy()).thenReturn(buttonDecorator);
when(buttonGridItem.tooltip(any(TooltipItem.class))).thenReturn(buttonGridItem);
when(buttonGridItem.grid(any(Point2DGrid.class))).thenReturn(buttonGridItem);
when(buttonGridItem.decorate(any(DecoratorItem.class))).thenReturn(buttonGridItem);
when(buttonGridItem.decorateGrid(any(DecoratorItem.class))).thenReturn(buttonGridItem);
when(buttonGridItem.onMouseEnter(any(NodeMouseEnterHandler.class))).thenReturn(buttonGridItem);
when(buttonGridItem.onMouseExit(any(NodeMouseExitHandler.class))).thenReturn(buttonGridItem);
when(buttonGridItem.onClick(any(NodeMouseClickHandler.class))).thenReturn(buttonGridItem);
this.tested = new MorphActionsToolboxView(glyphRenderers,
toolboxFactory);
when(toolbox.getView()).thenReturn(tested);
}
示例4: testClick
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@Test
public void testClick() {
NodeMouseClickHandler handler = mock(NodeMouseClickHandler.class);
final ButtonItemImpl cascade = tested.onClick(handler);
assertEquals(tested,
cascade);
;
verify(groupItemPrim,
times(1)).setListening(eq(true));
verify(groupItemPrim,
times(1)).addNodeMouseClickHandler(eq(handler));
verify(registrations,
times(1)).register(eq(clickReg));
tested.destroy();
verify(clickReg,
times(1)).removeHandler();
}
示例5: getTemplateClickHandler
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
private NodeMouseClickHandler getTemplateClickHandler(final String templateName) {
return new NodeMouseClickHandler() {
@Override
public void onNodeMouseClick(final NodeMouseClickEvent event) {
bayesianEvent.fire(new BayesianTemplateSelectedEvent(templateName));
}
};
}
示例6: getClearCanvasClickHandler
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
private NodeMouseClickHandler getClearCanvasClickHandler() {
return new NodeMouseClickHandler() {
@Override
public void onNodeMouseClick(final NodeMouseClickEvent event) {
if (Window.confirm("Are you sure to clean the canvas?")) {
clearEvent.fire(new ClearEvent());
}
}
};
}
示例7: build
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
public ActionShape build(final NodeMouseClickHandler clickHandler,
final ImageResource img) {
final Rectangle bounding = getBoundingImage(clickHandler);
final ActionShape shape = new ActionShape();
shape.setBounding(bounding);
new Picture(img,
shape::setPicture,
WIDTH_PICTURE,
HEIGHT_PICTURE,
false);
return shape;
}
示例8: build
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
public LayerShape build(final WiresBaseShape shape,
final ShapeFactory factory) {
final LayerShape layerShape = new LayerShape();
final Rectangle bounding = drawBoundingBox();
final ShapeGlyph glyph = factory.getGlyph();
//Get display name to show in Panel
final String name = (shape instanceof OverridesFactoryDescription) ? ((OverridesFactoryDescription) shape).getDescription() : factory.getShapeDescription();
final Text description = drawDescription(name);
//Clicking on the Shape selects it - Lienzo doesn't support bubbling click events down through
//overlapping items as it uses a bitmap SelectionLayer to detect mouse-clicks. Therefore we need
//to attach the handler to all elements
final NodeMouseClickHandler handler = new NodeMouseClickHandler() {
@Override
public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) {
shapeSelectedEvent.fire(new ShapeSelectedEvent(shape));
}
};
layerShape.addNodeMouseClickHandler(handler);
//Build Layer Shape
layerShape.setBounding(bounding);
layerShape.setDescription(description);
layerShape.setGroup(scaleGlyph(glyph));
return layerShape;
}
示例9: testAddButton
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void testAddButton(final Consumer<MouseClickEvent> clickEventConsumer) {
// Verify tootlip.
verify(toolboxTooltip,
times(1)).createItem(eq("title1"));
verify(buttonItem,
times(1)).tooltip(any(TooltipItem.class));
// Verify mouse enter.
final ArgumentCaptor<NodeMouseEnterHandler> enterHandlerArgumentCaptor =
ArgumentCaptor.forClass(NodeMouseEnterHandler.class);
verify(buttonItem,
times(1)).onMouseEnter(enterHandlerArgumentCaptor.capture());
final NodeMouseEnterHandler enterHandler = enterHandlerArgumentCaptor.getValue();
final NodeMouseEnterEvent mouseEnterEvent = mock(NodeMouseEnterEvent.class);
enterHandler.onNodeMouseEnter(mouseEnterEvent);
verify(canvasView,
times(1)).setCursor(eq(AbstractCanvas.Cursors.POINTER));
// Verify mouse exit.
final ArgumentCaptor<NodeMouseExitHandler> exitHandlerArgumentCaptor =
ArgumentCaptor.forClass(NodeMouseExitHandler.class);
verify(buttonItem,
times(1)).onMouseExit(exitHandlerArgumentCaptor.capture());
final NodeMouseExitHandler exitHandler = exitHandlerArgumentCaptor.getValue();
final NodeMouseExitEvent mouseExitEvent = mock(NodeMouseExitEvent.class);
exitHandler.onNodeMouseExit(mouseExitEvent);
verify(canvasView,
times(1)).setCursor(eq(AbstractCanvas.Cursors.AUTO));
// Verify mouse click.
final ArgumentCaptor<NodeMouseClickHandler> clickHandlerArgumentCaptor =
ArgumentCaptor.forClass(NodeMouseClickHandler.class);
verify(buttonItem,
times(1)).onClick(clickHandlerArgumentCaptor.capture());
final NodeMouseClickHandler clickHandler = clickHandlerArgumentCaptor.getValue();
final NodeMouseClickEvent mouseClickEvent = mock(NodeMouseClickEvent.class);
when(mouseClickEvent.getMouseEvent()).thenReturn(mock(MouseEvent.class));
clickHandler.onNodeMouseClick(mouseClickEvent);
verify(clickEventConsumer,
times(1)).accept(any(MouseClickEvent.class));
}
示例10: onClick
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@Override
public ButtonItemImpl onClick(final NodeMouseClickHandler handler) {
assert null != handler;
removeClickHandlerRegistration();
clickHandlerRegistration = item
.getPrimitive()
.setListening(true)
.addNodeMouseClickHandler(handler);
item.registrations().register(clickHandlerRegistration);
return this;
}
示例11: testClick
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@Test
public void testClick() {
NodeMouseClickHandler handler = mock(NodeMouseClickHandler.class);
tested.onClick(handler);
verify(button,
times(1)).onClick(eq(handler));
}
示例12: setUp
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() {
when(groupItem.registrations()).thenReturn(registrations);
when(groupItem.getPrimitive()).thenReturn(groupItemPrim);
when(groupItemPrim.setListening(anyBoolean())).thenReturn(groupItemPrim);
when(groupItemPrim.setDraggable(anyBoolean())).thenReturn(groupItemPrim);
when(groupItemPrim.addNodeMouseClickHandler(any(NodeMouseClickHandler.class))).thenReturn(clickReg);
when(groupItemPrim.addNodeDragStartHandler(any(NodeDragStartHandler.class))).thenReturn(dragStartReg);
when(groupItemPrim.addNodeDragMoveHandler(any(NodeDragMoveHandler.class))).thenReturn(dragMoveReg);
when(groupItemPrim.addNodeDragEndHandler(any(NodeDragEndHandler.class))).thenReturn(dragEndReg);
when(groupItem.asPrimitive()).thenReturn(groupItemGroup);
when(boundingPoints.getBoundingBox()).thenReturn(boundingBox);
when(groupItem.getBoundingBox()).thenReturn(() -> boundingBox);
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return groupItem;
}).when(groupItem).show(any(Command.class),
any(Command.class));
doAnswer(invocationOnMock -> {
((Command) invocationOnMock.getArguments()[0]).execute();
((Command) invocationOnMock.getArguments()[1]).execute();
return groupItem;
}).when(groupItem).hide(any(Command.class),
any(Command.class));
tested =
new ButtonItemImpl(groupItem)
.useHideExecutor(hideExecutor)
.useShowExecutor(showExecutor);
}
示例13: getGridMouseClickHandler
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
protected NodeMouseClickHandler getGridMouseClickHandler(final GridSelectionManager selectionManager) {
return new BaseGridWidgetMouseClickHandler(this,
selectionManager,
renderer);
}
示例14: getGridMouseCellSelectorClickHandler
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
protected NodeMouseClickHandler getGridMouseCellSelectorClickHandler(final GridSelectionManager selectionManager) {
return new GridCellSelectorMouseClickHandler(this,
selectionManager,
renderer);
}
示例15: getBoundingImage
import com.ait.lienzo.client.core.event.NodeMouseClickHandler; //导入依赖的package包/类
private Rectangle getBoundingImage(final NodeMouseClickHandler clickHandler) {
final Rectangle bounding = new Rectangle(WIDTH_BOUNDING,
HEIGHT_BOUNDING).setX(0).setY(0).setStrokeColor(ColorName.WHITE.getValue());
bounding.addNodeMouseClickHandler(clickHandler);
return bounding;
}