use of org.uberfire.ext.wires.core.api.events.ShapeDeletedEvent in project drools-wb by kiegroup.
the class GuidedDecisionTreeWidget method deleteShape.
@Override
public void deleteShape(final WiresBaseShape shape) {
if (confirmShapeDeletion()) {
if (uiRoot != null && uiRoot.equals(shape)) {
uiRoot = null;
model.setRoot(null);
shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));
} else if (shape instanceof BaseGuidedDecisionTreeShape) {
final BaseGuidedDecisionTreeShape uiChild = (BaseGuidedDecisionTreeShape) shape;
if (uiChild.getParentNode() instanceof BaseGuidedDecisionTreeShape) {
final BaseGuidedDecisionTreeShape uiParent = (BaseGuidedDecisionTreeShape) uiChild.getParentNode();
uiParent.getModelNode().removeChild(uiChild.getModelNode());
}
shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));
layout();
}
}
}
use of org.uberfire.ext.wires.core.api.events.ShapeDeletedEvent in project drools-wb by kiegroup.
the class GuidedDecisionTreeWidgetTest method testDeleteShapeNotConfirmed.
@Test
public void testDeleteShapeNotConfirmed() {
doReturn(false).when(widget).confirmShapeDeletion();
final BaseGuidedDecisionTreeShape shapeToDelete = uiRootShape;
widget.deleteShape(shapeToDelete);
verify(shapeDeletedEvent, never()).fire(any(ShapeDeletedEvent.class));
verify(widget, never()).layout();
assertEquals(uiRootNode, uiModel.getRoot());
}
Aggregations