use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class RadarMenuViewImpl method setup.
@PostConstruct
public void setup() {
radarCanvas.add(radarLayer);
radarMenuDropdown.setTitle(translationService.getTranslation(GuidedDecisionTableErraiConstants.RowContextMenuViewImpl_Title));
visibleBounds.setDraggable(true);
visibleBounds.addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent event) {
presenter.onDragVisibleBounds(visibleBounds.getX(), visibleBounds.getY());
}
});
visibleBounds.setFillColor(ColorName.GRAY);
visibleBounds.setAlpha(0.25);
visibleBounds.setLocation(new Point2D((RADAR_WIDTH - visibleBounds.getWidth()) / 2, (RADAR_HEIGHT - visibleBounds.getHeight()) / 2));
radarLayer.add(visibleBounds);
radarCanvas.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (eventTargetsPopup(event.getNativeEvent(), radarMenu)) {
event.stopPropagation();
event.preventDefault();
}
}
private boolean eventTargetsPopup(final NativeEvent event, final Element element) {
final EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return element.isOrHasChild(Element.as(target));
}
return false;
}
});
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenter method refreshDecisionTable.
@Override
public GuidedDecisionTableView.Presenter refreshDecisionTable(final GuidedDecisionTableView.Presenter dtPresenter, final ObservablePath path, final PlaceRequest placeRequest, final GuidedDecisionTableEditorContent content, final boolean isReadOnly) {
// Remove old view from Modeller
final Point2D oldLocation = dtPresenter.getView().getLocation();
view.removeDecisionTable(dtPresenter.getView(), () -> {
// Refresh existing Presenter with new content
dtPresenter.refreshContent(path, placeRequest, content, isReadOnly);
// Add new view to Modeller and ensure selection
dtPresenter.getView().setLocation(oldLocation);
view.addDecisionTable(dtPresenter.getView());
});
return dtPresenter;
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImpl method getTranslation.
private Point2D getTranslation(final GuidedDecisionTableView gridWidget) {
final double boundsPadding = GuidedDecisionTableModellerBoundsHelper.BOUNDS_PADDING;
final Transform t = gridLayer.getViewport().getTransform();
final double requiredTranslateX = boundsPadding - gridWidget.getX();
final double requiredTranslateY = boundsPadding - gridWidget.getY();
final double actualTranslateX = t.getTranslateX();
final double actualTranslateY = t.getTranslateY();
final double dx = requiredTranslateX - actualTranslateX;
final double dy = requiredTranslateY - actualTranslateY;
return new Point2D(dx, dy);
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableRenderer method renderHeaderBodyDivider.
@Override
public RendererCommand renderHeaderBodyDivider(final double width) {
return (RenderHeaderGridLinesCommand) (rc) -> {
if (!rc.isSelectionLayer()) {
final Group g = new Group();
final Line dividerLine1 = theme.getGridHeaderBodyDivider();
final Line dividerLine2 = theme.getGridHeaderBodyDivider();
dividerLine1.setPoints(new Point2DArray(new Point2D(0, getHeaderHeight() - 1.5), new Point2D(width, getHeaderHeight() - 1.5)));
dividerLine2.setPoints(new Point2DArray(new Point2D(0, getHeaderHeight() + 0.5), new Point2D(width, getHeaderHeight() + 0.5)));
g.add(dividerLine1);
g.add(dividerLine2);
rc.getGroup().add(g);
}
};
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method makeDecisionTable.
private GuidedDecisionTableView.Presenter makeDecisionTable(final double x, final double y) {
final GridData uiModel = spy(new BaseGridData());
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
final GridRenderer renderer = mock(GridRenderer.class);
final BaseGridRendererHelper helper = mock(BaseGridRendererHelper.class);
uiModel.appendRow(new BaseGridRow());
when(dtPresenter.getView()).thenReturn(dtView);
when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
when(dtView.getViewport()).thenReturn(viewport);
when(dtView.getLayer()).thenReturn(layer);
when(dtView.getLocation()).thenReturn(new Point2D(x, y));
when(dtView.getAbsoluteX()).thenReturn(x);
when(dtView.getAbsoluteY()).thenReturn(y);
when(dtView.getWidth()).thenReturn(50.0);
when(dtView.getHeight()).thenReturn(52.0);
when(dtView.getModel()).thenReturn(uiModel);
when(dtView.getRenderer()).thenReturn(renderer);
when(renderer.getHeaderHeight()).thenReturn(32.0);
when(dtView.getRendererHelper()).thenReturn(helper);
when(helper.getColumnInformation(any(Double.class))).thenReturn(columnInformation);
return dtPresenter;
}
Aggregations