public CanvasHighlight unhighLight() { if (!uuids.isEmpty()) { uuids.forEach(uuid -> { final Shape shape = getShape(uuid); if (null != shape) { shape.applyState(ShapeState.NONE); } }); uuids.clear(); } setValidCursor(); return this; }
private void animate(final int index, final Command callback) { if (index < shapes.size()) { final Shape shape = shapes.get(index); shape.applyState(ShapeState.HIGHLIGHT); final Timer t = new Timer() { @Override public void run() { animate(index + 1, callback); } }; t.schedule(TIMER_DELAY); } else { callback.execute(); } }
@SuppressWarnings("unchecked") private void updateViewShapesState(Collection<String> uuids) { uuids.stream() .map(uuid -> getCanvas().getShape(uuid)) .filter(Objects::nonNull) .forEach(shape -> { final boolean isSelected = isSelected(shape.getUUID()); if (isSelected && isReadonly()) { shape.applyState(ShapeState.HIGHLIGHT); } else if (isSelected) { shape.applyState(ShapeState.SELECTED); } else { shape.applyState(ShapeState.NONE); } }); getCanvas().focus(); }
private boolean applyViolation(final H canvasHandler, final RuleViolation violation) { if (hasViolations(violation)) { final Shape shape = getShape(canvasHandler, violation.getUUID()); if (null != shape) { shape.applyState(ShapeState.INVALID); } return true; } return false; }
private void applyStateToShape(final String uuid, final ShapeState state) { final Shape shape = getShape(uuid); if (null != shape) { uuids.add(uuid); shape.applyState(state); } if (ShapeState.INVALID.equals(state)) { setInvalidCursor(); } else { setValidCursor(); } }