当前位置: 首页>>代码示例>>Java>>正文


Java Viewport类代码示例

本文整理汇总了Java中com.ait.lienzo.client.core.shape.Viewport的典型用法代码示例。如果您正苦于以下问题:Java Viewport类的具体用法?Java Viewport怎么用?Java Viewport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Viewport类属于com.ait.lienzo.client.core.shape包,在下文中一共展示了Viewport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adjustViewportTransform

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
private void adjustViewportTransform(final Viewport vp,
                                     final Point2D delta) {
    final Transform transform = vp.getTransform();
    final Transform t = transform.copy().getInverse();
    final Point2D translation = new Point2D(t.getTranslateX(),
                                            t.getTranslateY()).mul(-1.0);

    final double scaleX = transform.getScaleX();
    final double scaleY = transform.getScaleY();
    transform.reset();

    final Point2D frameLocation = translation.add(delta);
    transform.scale(scaleX,
                    scaleY).translate(frameLocation.getX(),
                                      frameLocation.getY());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:BaseKeyboardOperation.java

示例2: testSetupMouseDragSynchronization

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetupMouseDragSynchronization() {

    final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);
    final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);

    doReturn(mediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();
    doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();
    doReturn(viewport).when(lienzoPanel).getViewport();
    doReturn(mediators).when(viewport).getMediators();

    gridLienzoScrollHandler.setupMouseDragSynchronization();

    verify(mediators).push(mediator);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:GridLienzoScrollHandlerTest.java

示例3: testMakeRestrictedMousePanMediator

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testMakeRestrictedMousePanMediator() {

    final Viewport viewport = viewportMock();
    final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class);
    final RestrictedMousePanMediator restrictedMousePanMediator = spy(gridLienzoScrollHandler.makeRestrictedMousePanMediator());

    doNothing().when(gridLienzoScrollHandler).refreshScrollPosition();
    doReturn(viewport).when(restrictedMousePanMediator).getViewport();
    doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();
    doReturn(viewport).when(defaultGridLayer).getViewport();

    restrictedMousePanMediator.handleEvent(mouseDownEventMock());
    restrictedMousePanMediator.handleEvent(mouseMoveEventMock());

    verify(gridLienzoScrollHandler).refreshScrollPosition();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:GridLienzoScrollHandlerTest.java

示例4: testGetMousePanMediator

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testGetMousePanMediator() {

    final RestrictedMousePanMediator expectedMediator = mock(RestrictedMousePanMediator.class);
    final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);

    doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();
    doReturn(viewport).when(lienzoPanel).getViewport();
    doReturn(mediators).when(viewport).getMediators();
    doReturn(expectedMediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();

    gridLienzoScrollHandler.setupMouseDragSynchronization();

    final RestrictedMousePanMediator actualMediator = gridLienzoScrollHandler.getMousePanMediator();

    assertEquals(expectedMediator,
                 actualMediator);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:GridLienzoScrollHandlerTest.java

示例5: testSetCursor

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetCursor() {

    final Viewport viewport = mock(Viewport.class);
    final DivElement divElement = mock(DivElement.class);
    final Style.Cursor cursor = mock(Style.Cursor.class);
    final Style style = mock(Style.class);

    doReturn(style).when(divElement).getStyle();
    doReturn(divElement).when(viewport).getElement();
    doReturn(viewport).when(mediator).getLayerViewport();

    mediator.setCursor(cursor);

    verify(style).setCursor(cursor);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:RestrictedMousePanMediatorTest.java

示例6: testHandleEventMouseMoveDragging

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseMoveDragging() throws Exception {
    final NodeMouseMoveEvent moveEvent = mock(NodeMouseMoveEvent.class);
    final Viewport viewport = mock(Viewport.class);
    final Transform transform = mock(Transform.class);
    final Transform inverseTransform = mock(Transform.class);
    final Scene scene = mock(Scene.class);

    doReturn(transform).when(transform).copy();

    doReturn(NodeMouseMoveEvent.getType()).when(moveEvent).getAssociatedType();

    doReturn(transform).when(viewport).getTransform();
    doReturn(scene).when(viewport).getScene();

    doReturn(viewport).when(mediator).getViewport();
    doReturn(true).when(mediator).isDragging();
    doReturn(inverseTransform).when(mediator).inverseTransform();

    mediator.handleEvent(moveEvent);

    verify(mediator).onMouseMove(eq(moveEvent));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:24,代码来源:RestrictedMousePanMediatorTest.java

示例7: testHandleEventMouseDownDisabledFilter

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownDisabledFilter() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(false).when(iEventFilter).isEnabled();

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator).onMouseDown(eq(downEvent));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:RestrictedMousePanMediatorTest.java

示例8: testHandleEventMouseDownEnabledFilterTestPassed

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownEnabledFilterTestPassed() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(true).when(iEventFilter).isEnabled();
    doReturn(true).when(iEventFilter).test(any());

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator).onMouseDown(eq(downEvent));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:RestrictedMousePanMediatorTest.java

示例9: testHandleEventMouseDownEnabledFilterTestNotPassed

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownEnabledFilterTestNotPassed() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(true).when(iEventFilter).isEnabled();
    doReturn(false).when(iEventFilter).test(any());

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator,
           never()).onMouseDown(any(NodeMouseDownEvent.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:RestrictedMousePanMediatorTest.java

示例10: testHandleEventMouseUpDragging

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseUpDragging() throws Exception {
    final NodeMouseUpEvent upEvent = mock(NodeMouseUpEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);

    doReturn(NodeMouseUpEvent.getType()).when(upEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(true).when(mediator).isDragging();

    mediator.handleEvent(upEvent);

    verify(mediator).onMouseUp(eq(upEvent));
    verify(mediator).cancel();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:RestrictedMousePanMediatorTest.java

示例11: testSetup

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetup() throws Exception {
    final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);
    final Element element = mock(Element.class);

    doReturn(transform).when(transform).scale(anyDouble());

    doReturn(transform).when(view).newTransform();

    doReturn(mediators).when(viewport).getMediators();

    doReturn(element).when(mockGridPanel).getElement();
    doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
    doReturn(viewport).when(mockGridPanel).getViewport();

    view.setup();

    verify(view).setupGridPanel();
    verify(mediators).push(restrictedMousePanMediator);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:24,代码来源:GuidedDecisionTableModellerViewImplTest.java

示例12: makeRestrictedMousePanMediator

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
RestrictedMousePanMediator makeRestrictedMousePanMediator() {
    return new RestrictedMousePanMediator() {
        @Override
        protected void onMouseMove(final NodeMouseMoveEvent event) {
            refreshScrollPosition();
        }

        @Override
        protected Viewport getLayerViewport() {
            return getViewport();
        }
    };
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:GridLienzoScrollHandler.java

示例13: flipToGridWidget

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Override
public void flipToGridWidget(final GridWidget gridWidget) {
    if (!isGridPinned()) {
        return;
    }
    for (GridWidget gw : gridWidgets) {
        gw.setAlpha(gw.equals(gridWidget) ? 1.0 : 0.0);
        gw.setVisible(gw.equals(gridWidget));
    }

    final Point2D translation = new Point2D(gridWidget.getX(),
                                            gridWidget.getY()).mul(-1.0);
    final Viewport vp = gridWidget.getViewport();
    final Transform transform = vp.getTransform();
    transform.reset();
    transform.translate(translation.getX(),
                        translation.getY());

    updatePinnedContext(gridWidget);

    batch(new GridLayerRedrawManager.PrioritizedCommand(0) {
        @Override
        public void execute() {
            select(gridWidget);
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:28,代码来源:DefaultGridLayer.java

示例14: updateVisibleBounds

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
private void updateVisibleBounds() {
    final Viewport viewport = getViewport();
    Transform transform = viewport.getTransform();
    if (transform == null) {
        viewport.setTransform(transform = new Transform());
    }
    final double x = (PADDING - transform.getTranslateX()) / transform.getScaleX();
    final double y = (PADDING - transform.getTranslateY()) / transform.getScaleY();
    bounds.setX(x);
    bounds.setY(y);
    bounds.setHeight(Math.max(0,
                              (viewport.getHeight() - PADDING * 2) / transform.getScaleX()));
    bounds.setWidth(Math.max(0,
                             (viewport.getWidth() - PADDING * 2) / transform.getScaleY()));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:DefaultGridLayer.java

示例15: testConvertDOMToGridCoordinateWithParentWithoutTransform

import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testConvertDOMToGridCoordinateWithParentWithoutTransform() throws Exception {
    point = new Point2D(15D, 20D);
    view = spy(new BaseGridWidget(gridData, gridSelectionManager, gridPinnedModeManager, gridRenderer));
    when(view.getViewport()).thenReturn(mock(Viewport.class));
    convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);
    Assertions.assertThat(convertedPoint).isNotNull();
    Assertions.assertThat(convertedPoint.getX()).isEqualTo(15D);
    Assertions.assertThat(convertedPoint.getY()).isEqualTo(20D);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:11,代码来源:CoordinateUtilitiesTest.java


注:本文中的com.ait.lienzo.client.core.shape.Viewport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。