use of org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings in project kie-wb-common by kiegroup.
the class AbstractDiagramViewer method open.
@Override
public void open(final D diagram, final int width, final int height, final DiagramViewerCallback<D> callback) {
final StunnerDiagramEditorPreferences editorPreferences = getPreferences(diagram);
final boolean isHiDPIEnabled = null != editorPreferences && editorPreferences.isHiDPIEnabled();
final CanvasSettings settings = new CanvasSettings(width, height, isHiDPIEnabled);
this.open(diagram, settings, callback);
}
use of org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings in project kie-wb-common by kiegroup.
the class LienzoCanvasTest method testEventHandling.
@Test
public void testEventHandling() {
CanvasPanel panel = mock(CanvasPanel.class);
CanvasSettings settings = mock(CanvasSettings.class);
ViewEventHandlerManager eventHandler = mock(ViewEventHandlerManager.class);
tested.initialize(panel, settings, eventHandler);
tested.supports(ViewEventType.DRAG);
verify(eventHandler, times(1)).supports(eq(ViewEventType.DRAG));
tested.enableHandlers();
verify(eventHandler, times(1)).enable();
tested.disableHandlers();
verify(eventHandler, times(1)).disable();
DragHandler dragHandler = mock(DragHandler.class);
tested.addHandler(ViewEventType.DRAG, dragHandler);
verify(eventHandler, times(1)).addHandler(eq(ViewEventType.DRAG), eq(dragHandler));
tested.removeHandler(dragHandler);
verify(eventHandler, times(1)).removeHandler(eq(dragHandler));
}
use of org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings in project kie-wb-common by kiegroup.
the class WiresCanvasTest method testInitialize.
@Test
public void testInitialize() {
CanvasPanel panel = mock(CanvasPanel.class);
CanvasSettings settings = mock(CanvasSettings.class);
assertEquals(tested, tested.initialize(panel, settings));
verify(wiresManager, times(1)).setSpliceEnabled(eq(false));
verify(wiresManager, times(1)).setLocationAcceptor(eq(ILocationAcceptor.NONE));
verify(wiresManager, times(1)).setContainmentAcceptor(eq(IContainmentAcceptor.NONE));
verify(wiresManager, times(1)).setDockingAcceptor(eq(IDockingAcceptor.NONE));
verify(wiresManager, times(1)).setConnectionAcceptor(eq(IConnectionAcceptor.NONE));
verify(wiresManager, times(1)).setControlPointsAcceptor(eq(IControlPointsAcceptor.NONE));
verify(view, times(1)).use(eq(wiresManager));
verify(view, times(1)).initialize(eq(panel), eq(settings));
assertEquals(wiresManager, tested.getWiresManager());
}
use of org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings in project kie-wb-common by kiegroup.
the class AbstractDiagramViewer method open.
@Override
@SuppressWarnings("unchecked")
public void open(final D diagram, final DiagramViewer.DiagramViewerCallback<D> callback) {
final StunnerDiagramEditorPreferences editorPreferences = getPreferences(diagram);
final boolean isHiDPIEnabled = null != editorPreferences && editorPreferences.isHiDPIEnabled();
final CanvasSettings settings = new CanvasSettings(isHiDPIEnabled);
this.open(diagram, settings, callback);
}
use of org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings in project kie-wb-common by kiegroup.
the class LienzoCanvasTest method testInitialize.
@Test
public void testInitialize() {
CanvasPanel panel = mock(CanvasPanel.class);
CanvasSettings settings = mock(CanvasSettings.class);
when(settings.isHiDPIEnabled()).thenReturn(true);
assertEquals(tested, tested.initialize(panel, settings));
assertTrue(LienzoCore.get().isHidpiEnabled());
assertNotNull(tested.getEventHandlerManager());
verify(view, times(1)).initialize(eq(panel), eq(settings));
}
Aggregations