use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method refreshingDecisionTableRetainsExistingLocation.
@Test
public void refreshingDecisionTableRetainsExistingLocation() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
final GuidedDecisionTableView dtView = dtPresenter.getView();
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final Point2D dtLocation = new Point2D(100, 100);
when(dtView.getLocation()).thenReturn(dtLocation);
final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
verify(dtView, times(1)).getLocation();
verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
assertNotNull(afterRemovalCommand);
afterRemovalCommand.execute();
verify(dtView, times(1)).setLocation(eq(dtLocation));
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTreeWidget method setModel.
public void setModel(final GuidedDecisionTree model, final boolean isReadOnly) {
this.uiRoot = null;
this.model = model;
// Clear existing state
super.clear();
clearEvent.fire(new ClearEvent());
// Walk model creating UIModel
final TypeNode root = model.getRoot();
if (root != null) {
final WiresBaseTreeNode uiRoot = typeNodeFactory.getShape(root, isReadOnly);
this.uiRoot = uiRoot;
processChildren(root, uiRoot, isReadOnly);
final Map<WiresBaseShape, Point2D> layout = layoutManager.getLayoutInformation(uiRoot);
final Rectangle2D canvasBounds = WiresLayoutUtilities.alignLayoutInCanvas(layout);
for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {
final Point2D destination = new Point2D(e.getValue().getX(), e.getValue().getY());
e.getKey().setLocation(destination);
}
WiresLayoutUtilities.resizeViewPort(canvasBounds, canvasLayer.getViewport());
}
if (shapesInCanvas.isEmpty()) {
showGettingStartedHint();
}
canvasLayer.batch();
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class BaseGuidedDecisionTreeShape method setupControl.
protected Group setupControl(final ImageResource resource, final Command command) {
final Group controlGroup = new Group();
final Picture p = new Picture(resource, picture1 -> {
final double offsetX = -picture1.getImageData().getWidth() / 2;
final double offsetY = -picture1.getImageData().getHeight() / 2;
picture1.setLocation(new Point2D(offsetX, offsetY));
picture1.addNodeMouseClickHandler(e -> command.execute());
}, ImageSelectionMode.SELECT_BOUNDS);
controlGroup.add(p);
return controlGroup;
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class BaseGuidedDecisionTreeShape method getControlTarget.
@Override
protected Point2D getControlTarget(final Group ctrl) {
final Point2D target = super.getControlTarget(ctrl);
target.setX(circle.getRadius() + 25);
return target;
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class ColumnHeaderPopOverHandlerTest method popOverWhenEventOverDecisionTableHeaderAndColumn.
@Test
public void popOverWhenEventOverDecisionTableHeaderAndColumn() {
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter1);
}
});
when(event.getX()).thenReturn(50);
when(event.getY()).thenReturn(50);
when(dtView1.getLocation()).thenReturn(new Point2D(0, 0));
handler.onNodeMouseMove(event);
verify(columnPopOverPresenter, times(1)).show(any(GuidedDecisionTableModellerView.class), eq(dtPresenter1), eq(0));
}
Aggregations