@Override public void applyElementMutation(final Shape shape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { wrapped.applyElementMutation(shape, candidate, applyPosition, applyProperties, mutationContext); }
@Override public void clearCanvas() { wrapped.clearCanvas(); }
@Override @SuppressWarnings("unchecked") public void draw(final D diagram, final ParameterizedCommand<CommandResult> loadCallback) { if (null == this.canvas) { throw new IllegalStateException("No handled canvas instance."); } this.diagram = diagram; // Initialize the graph handler that provides processing and querying operations over the graph. buildGraphIndex(() -> loadRuleSet(() -> draw(loadCallback))); }
protected void applyElementMutation(final Shape shape, final Element candidate) { beforeDraw(candidate, shape); beforeElementUpdated(candidate, shape); afterDraw(candidate, shape); notifyCanvasElementUpdated(candidate); afterElementUpdated(candidate, shape); }
@Override public void register(final Shape shape, final Element<View<?>> candidate, final boolean fireEvents) { // Add the shapes on canvas and fire events. addShape(shape); if (fireEvents) { // Fire listeners. notifyCanvasElementAdded(candidate); // Fire updates. afterElementAdded(candidate, shape); } }
@Override @SuppressWarnings("unchecked") public void undock(final Element target, final Element child) { final String targetUUID = target.getUUID(); final String childUUID = child.getUUID(); if (!isCanvasRoot(targetUUID)) { final Shape targetShape = getCanvas().getShape(targetUUID); final Shape childShape = getCanvas().getShape(childUUID); if (Objects.nonNull(targetShape) && Objects.nonNull(childShape)) { getCanvas().undock(targetShape, childShape); } } }
@Override public void deregister(final Shape shape, final Element element, final boolean fireEvents) { if (fireEvents) { // Fire listeners. notifyCanvasElementRemoved(element); // Fire events. beforeElementDeleted(element, shape); } removeShape(shape); if (fireEvents) { afterElementDeleted(element, shape); } }
protected void loadRuleSet(final Command callback) { final String id = getDiagram().getMetadata().getDefinitionSetId(); final Object defSet = getDefinitionManager().definitionSets().getDefinitionSetById(id); this.ruleSet = definitionManager.adapters().forRules().getRuleSet(defSet); callback.execute(); }
@Override public C getCanvas() { return wrapped.getCanvas(); }
@Override public void draw(final D diagram, final ParameterizedCommand<CommandResult> loadCallback) { wrapped.draw(diagram, loadCallback); }
@Override public D getDiagram() { return wrapped.getDiagram(); }
@Override public DefinitionManager getDefinitionManager() { return wrapped.getDefinitionManager(); }
@SuppressWarnings("unchecked") protected void applyElementMutation(final ElementShape graphShape, final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) { if (applyPosition) { graphShape.applyPosition(candidate, mutationContext); } if (applyProperties) { applyElementTitle(graphShape, candidate, mutationContext); graphShape.applyProperties(candidate, mutationContext); } this.applyElementMutation(graphShape, candidate); }
@Override @SuppressWarnings("unchecked") public Optional<Element> getElementAt(final double x, final double y) { final Optional<Shape> shape = getCanvas().getShapeAt(x, y); return shape.flatMap(s -> Optional.of(getGraphExecutionContext().getGraphIndex().getNode(s.getUUID()))); }
@Override public void notifyCanvasElementUpdated(final Element candidate) { wrapped.notifyCanvasElementUpdated(candidate); }
@Override public void notifyCanvasElementRemoved(final Element candidate) { wrapped.notifyCanvasElementRemoved(candidate); }
@Override public boolean isCanvasRoot(final Element parent) { return wrapped.isCanvasRoot(parent); }
@Override public void notifyCanvasElementAdded(final Element candidate) { wrapped.notifyCanvasElementAdded(candidate); }
@Override @SuppressWarnings("unchecked") public void addChild(final Element parent, final Element child) { final Shape childShape = getCanvas().getShape(child.getUUID()); if (!isCanvasRoot(parent)) { final Shape parentShape = getCanvas().getShape(parent.getUUID()); getCanvas().addChild(parentShape, childShape); } else { // -- Special case when parent is the canvas root -- // Ensure the shape is added into the layer, but no need to register it again and generate new // handlers ( f.i. using canvas#addShape() method ). getCanvas().addChild(childShape); } }
public void removeShape(final Shape shape) { getCanvas().deleteShape(shape); }