protected void scaleShape(final S shape, final double width, final double height) { scale(shape, width, height); } }
public ShapeStateDefaultHandler setBackgroundShape(final Supplier<LienzoShapeView<?>> shapeSupplier) { backgroundShapeSupplier = shapeSupplier; /** * TODO: need to fix when resolution of JBPM-7681 is available * @see <a href="https://issues.jboss.org/browse/JBPM-7681">JBPM-7681</a> */ shapeViewDataEncoder.applyShapeViewType(shapeSupplier, ShapeType.BACKGROUND); return this; }
public static final ShapeViewUserDataEncoder get() { return new ShapeViewUserDataEncoder(); }
@Override public void destroy() { super.destroy(); LienzoPictureUtils.tryDestroy(getPicture(), (p) -> Scheduler.get().scheduleFixedDelay(() -> !LienzoPictureUtils.retryDestroy(p), 200)); }
public static void tryDestroy(final Picture picture, final Consumer<Picture> retryCallback) { // Destroy the <img..> related to the Glyph added to the DOM root by Picture's use of ImageLoader. // If the image has not completed loading attempts to remove from the DOM result in an error; therefore // schedule successive attempts until success. if (!retryDestroy(picture)) { retryCallback.accept(picture); } }
@Override public T setUUID(final String uuid) { this.uuid = uuid; ShapeViewUserDataEncoder.get().setShapeViewChildrenIds(uuid, getGroup()); WiresUtils.assertShapeUUID(this.getGroup(), uuid); return cast(); }
public static void scale(final Shape shape, final double width, final double height) { final BoundingBox bb = shape.getBoundingBox(); final double[] scale = getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); shape.setScale(scale[0], scale[1]); }
public void applyShapeViewRenderType(final Supplier<LienzoShapeView<?>> shapeSupplier, ShapeStateDefaultHandler.RenderType renderType) { if (Objects.isNull(renderType)) { return; } applyShapeViewUserData(shapeSupplier, "renderType", renderType.name()); }
@Override public T setDragBounds(final Bounds bounds) { ifLocationBoundsConstraintsSupported(() -> LienzoShapeUtils.translateBounds(bounds)); return cast(); }
ShapeStateDefaultHandler(final ShapeStateAttributeAnimationHandler<LienzoShapeView<?>> handler) { this.handler = handler.onComplete(this::applyShadow); this.shapeViewDataEncoder = ShapeViewUserDataEncoder.get(); setRenderType(RenderType.STROKE); }
public ShapeStateDefaultHandler setRenderType(final RenderType renderType) { handler.getAttributesHandler().useAttributes(renderType.stateAttributesProvider); /** * TODO: need to fix when resolution of JBPM-7681 is available * @see <a href="https://issues.jboss.org/browse/JBPM-7681">JBPM-7681</a> */ shapeViewDataEncoder.applyShapeViewRenderType(borderShapeSupplier, renderType); return this; }
@Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); }
public static String getUUID_At(final LienzoLayer lienzoLayer, final double x, final double y) { int sx = (int) x; int sy = (int) y; final Shape<?> shape = lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(sx, sy); final String viewUUID = getShapeUUID(shape); return viewUUID; }
@SuppressWarnings("unchecked") public T updateFillGradient(final double width, final double height) { if (this.fillGradientType != null && this.fillGradientStartColor != null && this.fillGradientEndColor != null) { final LinearGradient gradient = LienzoShapeUtils.getLinearGradient(fillGradientStartColor, fillGradientEndColor, width, height); getShape().setFillGradient(gradient); } return cast(); }
private static void scaleViewIcon(final SVGShapeView<?> view, final Picture picture) { scale(picture, WID_ICON_WIDTH, WID_ICON_HEIGHT); view.refresh(); }
public ShapeStateDefaultHandler setContainerShape(final Supplier<LienzoShapeView<?>> shapeSupplier) { shapeViewDataEncoder.applyShapeViewType(shapeSupplier, ShapeType.CONTAINER); return this; }
public void applyShapeViewType(final Supplier<LienzoShapeView<?>> shapeSupplier, ShapeStateDefaultHandler.ShapeType shapeType) { if (Objects.isNull(shapeType)) { return; } applyShapeViewUserData(shapeSupplier, "shapeType", shapeType.name()); }
protected void scaleShape(final Image image, final double width, final double height) { final double iWidth = image.getWidth(); final double iHeight = image.getHeight(); if (width != iWidth || height != iHeight) { scale(image, width, height); } } }
public ShapeStateDefaultHandler setBorderShape(final Supplier<LienzoShapeView<?>> shapeSupplier) { handler.getAttributesHandler().setView(shapeSupplier); borderShapeSupplier = shapeSupplier; /** * TODO: need to fix when resolution of JBPM-7681 is available * @see <a href="https://issues.jboss.org/browse/JBPM-7681">JBPM-7681</a> */ shapeViewDataEncoder.applyShapeViewType(shapeSupplier, ShapeType.BORDER); return this; }