public FocusableLienzoPanel(final int width, final int height) { super(width, height); //Basic support to loose focus on other Widgets when a WiresCanvas is clicked addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(final MouseDownEvent event) { broadcastBlurEvent(); } }); addMouseWheelHandler(new MouseWheelHandler() { @Override public void onMouseWheel(final MouseWheelEvent event) { broadcastBlurEvent(); } }); }
@Override public void onMouseWheel(final MouseWheelEvent event) { broadcastBlurEvent(); } });
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapeFactoryUtil.HEIGHT_PANEL); super.initWidget(panel); layer = new Layer(); panel.getScene().add(layer); }
@PostConstruct public void init() { panel = new FocusableLienzoPanel(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); initWidget(panel); //Grid... Line line1 = new Line(0, 0, 0, 0).setStrokeColor(ColorName.BLUE).setAlpha(0.5); // primary lines Line line2 = new Line(0, 0, 0, 0).setStrokeColor(ColorName.GREEN).setAlpha(0.5); // secondary dashed-lines line2.setDashArray(2, 2); GridLayer gridLayer = new GridLayer(100, line1, 25, line2); panel.setBackgroundLayer(gridLayer); panel.getScene().add(canvasLayer); }
public void clear() { //Detach Shapes in Containers; as destroying a Container automatically destroys it's contained Shapes //This sounds as though we need not worry about those, however "shapesInCanvas" this means we cannot //simply iterate over "shapesInCanvas" as it's content changes as Shapes are destroyed. for (WiresShape shape : shapesInCanvas) { if (shape instanceof WiresContainer) { final WiresContainer wc = (WiresContainer) shape; for (WiresBaseShape bc : wc.getContainedShapes()) { wc.detachShape(bc); } } } //Now it's safe to destroy all Shapes for (WiresShape shape : shapesInCanvas) { shape.destroy(); canvasLayer.remove((IPrimitive<?>) shape); } clearSelection(); shapesInCanvas.clear(); panel.getViewport().setPixelSize(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); panel.getViewport().draw(); }
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapeFactoryUtil.HEIGHT_PANEL); super.initWidget(panel); layer = new Layer(); panel.getScene().add(layer); }
@PostConstruct public void init() { panel = new FocusableLienzoPanel(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); initWidget(panel); //Grid... Line line1 = new Line(0, 0, 0, 0).setStrokeColor(ColorName.BLUE).setAlpha(0.5); // primary lines Line line2 = new Line(0, 0, 0, 0).setStrokeColor(ColorName.GREEN).setAlpha(0.5); // secondary dashed-lines line2.setDashArray(2, 2); GridLayer gridLayer = new GridLayer(100, line1, 25, line2); panel.setBackgroundLayer(gridLayer); panel.getScene().add(canvasLayer); }
public void clear() { //Detach Shapes in Containers; as destroying a Container automatically destroys it's contained Shapes //This sounds as though we need not worry about those, however "shapesInCanvas" this means we cannot //simply iterate over "shapesInCanvas" as it's content changes as Shapes are destroyed. for (WiresShape shape : shapesInCanvas) { if (shape instanceof WiresContainer) { final WiresContainer wc = (WiresContainer) shape; for (WiresBaseShape bc : wc.getContainedShapes()) { wc.detachShape(bc); } } } //Now it's safe to destroy all Shapes for (WiresShape shape : shapesInCanvas) { shape.destroy(); canvasLayer.remove((IPrimitive<?>) shape); } clearSelection(); shapesInCanvas.clear(); panel.getViewport().setPixelSize(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); panel.getViewport().draw(); }
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapesUtils.calculateHeight(1)); layer = new Layer(); panel.getScene().add(layer); initWidget(panel); drawActions(); }
public FocusableLienzoPanel(final int width, final int height) { super(width, height); //Basic support to loose focus on other Widgets when a WiresCanvas is clicked addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(final MouseDownEvent event) { broadcastBlurEvent(); } }); addMouseWheelHandler(new MouseWheelHandler() { @Override public void onMouseWheel(final MouseWheelEvent event) { broadcastBlurEvent(); } }); }
@Override public void onMouseWheel(final MouseWheelEvent event) { broadcastBlurEvent(); } });
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapesUtils.calculateHeight(1)); layer = new Layer(); panel.getScene().add(layer); initWidget(panel); drawActions(); }
@Override public void onMouseDown(final MouseDownEvent event) { broadcastBlurEvent(); } });
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapesUtils.calculateHeight(ShapesUtils.getNumberOfShapesInCategory(getCategory(), factoriesCache.getShapeFactories()))); layer = new Layer(); panel.getScene().add(layer); initWidget(panel); drawStencils(); }
@Override public void onMouseDown(final MouseDownEvent event) { broadcastBlurEvent(); } });
@PostConstruct public void init() { panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL, ShapesUtils.calculateHeight(ShapesUtils.getNumberOfShapesInCategory(getCategory(), factoriesCache.getShapeFactories()))); layer = new Layer(); panel.getScene().add(layer); initWidget(panel); drawStencils(); }
public void addStencil( final ShapeFactory factory, final GuidedDecisionTreeStencilPaletteBuilder stencilBuilder, final FactoryHelper helper, final boolean isReadOnly ) { final LienzoPanel panel = new FocusableLienzoPanel( GuidedDecisionTreeStencilPaletteBuilder.STENCIL_WIDTH, GuidedDecisionTreeStencilPaletteBuilder.STENCIL_HEIGHT + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING ); final Layer layer = new Layer(); panel.getScene().add( layer ); //Create a new PaletteShape from the given factory final PaletteShape shape = stencilBuilder.build( panel, helper, factory, isReadOnly ); layer.add( shape ); layer.batch(); add( panel ); }
public void addStencil( final ShapeFactory factory, final GuidedDecisionTreeStencilPaletteBuilder stencilBuilder, final FactoryHelper helper, final boolean isReadOnly ) { final LienzoPanel panel = new FocusableLienzoPanel( GuidedDecisionTreeStencilPaletteBuilder.STENCIL_WIDTH, GuidedDecisionTreeStencilPaletteBuilder.STENCIL_HEIGHT + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING ); final Layer layer = new Layer(); panel.getScene().add( layer ); //Create a new PaletteShape from the given factory final PaletteShape shape = stencilBuilder.build( panel, helper, factory, isReadOnly ); layer.add( shape ); layer.batch(); add( panel ); }