@Override public LienzoCanvasView addChild(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.addChild(parentShape, childShape); return this; }
@Override public LienzoCanvasView deleteChild(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.deleteChild(parentShape, childShape); return this; }
@Override public LienzoCanvasView dock(final ShapeView<?> parent, final ShapeView<?> child) { final WiresContainer parentShape = (WiresContainer) parent; final WiresShape childShape = (WiresShape) child; layer.dock(parentShape, childShape); return this; }
@Before public void setup() { this.layer = new Layer(); this.wiresManager = WiresManager.get(layer); when(wiresLayer.getWiresManager()).thenReturn(wiresManager); this.view = new CaseManagementCanvasView(wiresLayer); this.view.init(); }
@Test public void testGetPanelBoundsHeight() throws Exception { final double height = 7788.0; final LienzoBoundsPanel boundsPanel = mock(LienzoBoundsPanel.class); when(boundsPanel.getBounds()).thenReturn(Bounds.build(0.0, 0.0, 100.0, height)); final Widget widget = mock(Widget.class); final Element element = mock(Element.class); final Style style = mock(Style.class); when(widget.getElement()).thenReturn(element); when(element.getStyle()).thenReturn(style); final Layer toplayer = mock(Layer.class); when(wiresLayer.getTopLayer()).thenReturn(toplayer); final LienzoPanel lienzoPanel = mock(LienzoPanel.class); when(lienzoPanel.getView()).thenReturn(boundsPanel); when(lienzoPanel.asWidget()).thenReturn(widget); view.initialize(lienzoPanel, new CanvasSettings(false)); final OptionalDouble result = view.getPanelBoundsHeight(); assertTrue(result.isPresent()); assertEquals(height, result.getAsDouble(), 0.00001); } }
@Override public LienzoCanvasView undock(final ShapeView<?> childParent, final ShapeView<?> child) { final WiresShape childShape = (WiresShape) child; layer.undock(childShape); return this; }
public void use(final WiresManager wiresManager) { layer.use(wiresManager); }
@Override public AbstractCanvas<WiresCanvasView> initialize(final CanvasPanel panel, final CanvasSettings settings) { super.initialize(panel, settings); final WiresLayer layer = getView().getLayer(); wiresManager = wiresManagerFactory.newWiresManager(layer.getLienzoLayer()); wiresManager.setSpliceEnabled(false); // Set the default NONE acceptors for wires capabilities. // Each of these ones is being handled by each of the canvas controls associated wiresManager.setLocationAcceptor(ILocationAcceptor.NONE); wiresManager.setContainmentAcceptor(IContainmentAcceptor.NONE); wiresManager.setDockingAcceptor(IDockingAcceptor.NONE); wiresManager.setConnectionAcceptor(IConnectionAcceptor.NONE); wiresManager.setControlPointsAcceptor(IControlPointsAcceptor.NONE); view.use(wiresManager); return this; }
@Override public WiresCanvasView add(final ShapeView<?> shapeView) { if (WiresUtils.isWiresShape(shapeView)) { WiresShape wiresShape = (WiresShape) shapeView; getLayer().getWiresManager().register(wiresShape, false); WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID); } else if (WiresUtils.isWiresConnector(shapeView)) { //Don't render connectors } else { super.add(shapeView); } return this; }
protected V init(final ActionsToolbox toolbox, final WiresCanvas canvas, final WiresShape shape) { this.canvas = canvas; final Layer topLayer = canvas.getView().getLayer().getTopLayer(); this.toolboxView = toolboxFactory .forWiresShape(shape) .attachTo(topLayer); configure(toolbox); tooltip = createTooltip(toolbox); return cast(); }
public LienzoCanvasView deleteRoot(final ShapeView<?> shape) { if (WiresUtils.isWiresShape(shape)) { layer.delete(((WiresShape) shape).getGroup()); } else if (WiresUtils.isWiresConnector(shape)) { layer.delete(((WiresConnector) shape).getGroup()); } else { return super.delete(shape); } return this; }