@Before public void setup() { doReturn(gridRenderer).when(gridWidget).getRenderer(); doReturn(gridRendererHelper).when(gridWidget).getRendererHelper(); doReturn(ri).when(gridRendererHelper).getRenderingInformation(); doReturn(HEADER_HEIGHT).when(gridRenderer).getHeaderHeight(); doReturn(HEADER_ROW_HEIGHT).when(gridRenderer).getHeaderRowHeight(); doReturn(floatingBlockInformation).when(ri).getFloatingBlockInformation(); doReturn(0.0).when(floatingBlockInformation).getX(); doReturn(0.0).when(floatingBlockInformation).getWidth(); doReturn(mock(Viewport.class)).when(gridWidget).getViewport(); doReturn(new BaseGridData()).when(gridWidget).getModel(); }
@Before public void setup() { doReturn(gridRenderer).when(gridWidget).getRenderer(); doReturn(gridRendererHelper).when(gridWidget).getRendererHelper(); doReturn(ri).when(gridRendererHelper).getRenderingInformation(); doReturn(HEADER_HEIGHT).when(gridRenderer).getHeaderHeight(); doReturn(HEADER_ROW_HEIGHT).when(gridRenderer).getHeaderRowHeight(); doReturn(floatingBlockInformation).when(ri).getFloatingBlockInformation(); doReturn(0.0).when(floatingBlockInformation).getX(); doReturn(0.0).when(floatingBlockInformation).getWidth(); doReturn(mock(Viewport.class)).when(gridWidget).getViewport(); doReturn(new BaseGridData()).when(gridWidget).getModel(); }
private BaseGridRendererHelper.ColumnInformation getBodyColumnInformation(final int uiColumnIndex) { final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); if (!bodyColumns.contains(column)) { return null; } return new BaseGridRendererHelper.ColumnInformation(column, uiColumnIndex, bodyBlockInformation.getX() + rendererHelper.getColumnOffset(bodyColumns, bodyColumns.indexOf(column))); }
final Function<SelectedRange, Double> selectedCellsHeightStrategy) { final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth();
final Function<SelectedRange, Double> selectedCellsHeightStrategy) { final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth();
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final double bodyX = bodyBlockInformation.getX(); final double bodyY = bodyBlockInformation.getBodyY(); final double floatingBodyX = floatingBlockInformation.getX(); final double floatingBodyY = floatingBlockInformation.getBodyY(); bodyBlockInformation.getX(), minVisibleRowIndex, maxVisibleRowIndex, floatingBlockInformation.getX(), minVisibleRowIndex, maxVisibleRowIndex,
final BaseGridRendererHelper.RenderingInformation renderingInformation) { final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth();
final BaseGridRendererHelper.RenderingInformation renderingInformation) { final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth();
@Before public void setup() { super.setup(); doReturn(gridRenderer).when(scenarioGridMock).getRenderer(); doReturn(gridRendererHelper).when(scenarioGridMock).getRendererHelper(); doReturn(ri).when(gridRendererHelper).getRenderingInformation(); doReturn(HEADER_HEIGHT).when(gridRenderer).getHeaderHeight(); doReturn(HEADER_ROW_HEIGHT).when(gridRenderer).getHeaderRowHeight(); doReturn(floatingBlockInformation).when(ri).getFloatingBlockInformation(); doReturn(0.0).when(floatingBlockInformation).getX(); doReturn(0.0).when(floatingBlockInformation).getWidth(); doReturn(mock(Viewport.class)).when(scenarioGridMock).getViewport(); when(scenarioGridMock.getModel()).thenReturn(scenarioGridModelMock); final ScenarioHeaderMetaData clickedScenarioHeaderMetadataMock = mock(ScenarioHeaderMetaData.class); scenarioGridColumnOne = mockGridColumn(100.0, Collections.singletonList(clickedScenarioHeaderMetadataMock), columnOneTitle, columnGroup); scenarioGridColumnTwo = mockGridColumn(100.0, Collections.singletonList(clickedScenarioHeaderMetadataMock), columnTwoTitle, columnGroup); gridColumns.add(scenarioGridColumnOne); gridColumns.add(scenarioGridColumnTwo); }
private boolean isOverRowDragHandleColumn(final GridWidget view, final double cx) { //Gather information on columns final BaseGridRendererHelper rendererHelper = view.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); if (renderingInformation == null) { return false; } final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); final double bodyX = bodyBlockInformation.getX(); final double floatingX = floatingBlockInformation.getX(); //Check floating columns if (findRowDragHandleColumn(floatingColumns, floatingX, cx) != null) { return true; } //Check all other columns return findRowDragHandleColumn(bodyColumns, bodyX, cx) != null; }
private boolean isOverRowDragHandleColumn(final GridWidget view, final double cx) { //Gather information on columns final BaseGridRendererHelper rendererHelper = view.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); if (renderingInformation == null) { return false; } final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); final double bodyX = bodyBlockInformation.getX(); final double floatingX = floatingBlockInformation.getX(); //Check floating columns if (findRowDragHandleColumn(floatingColumns, floatingX, cx) != null) { return true; } //Check all other columns return findRowDragHandleColumn(bodyColumns, bodyX, cx) != null; }
private Bounds getSelectorBounds(final double width, final double height, final BaseGridRendererHelper.RenderingInformation renderingInformation) { final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); double boundsX = 0.0; double boundsY = 0.0; double boundsWidth = width; double boundsHeight = height; if (!floatingBlockInformation.getColumns().isEmpty()) { boundsX = floatingBlockInformation.getX(); boundsWidth = boundsWidth - floatingBlockInformation.getX(); } if (renderingInformation.isFloatingHeader()) { boundsY = bodyBlockInformation.getHeaderY(); boundsHeight = boundsHeight - bodyBlockInformation.getHeaderY(); } return new BaseBounds(boundsX, boundsY, boundsWidth, boundsHeight); }
private int getScreenX(final GuidedDecisionTableModellerView modellerView, final GuidedDecisionTableView.Presenter dtPresenter, final int uiColumnIndex) { final GridWidget gridWidget = dtPresenter.getView(); final GridColumn<?> uiColumn = gridWidget.getModel().getColumns().get(uiColumnIndex); final double gx = gridWidget.getX(); final GridLayer layer = modellerView.getGridLayerView(); final int containerX = layer.getDomElementContainer().getAbsoluteLeft(); final double vx = layer.getVisibleBounds().getX(); final Transform t = layer.getViewport().getTransform(); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation(); final double offsetX = floatingBlockInformation.getColumns().contains(uiColumn) ? floatingBlockInformation.getX() : 0; final int screenX = containerX + (int) ((gx - vx + offsetX + rendererHelper.getColumnOffset(uiColumn) + uiColumn.getWidth() / 2) * t.getScaleX()); return screenX; }
private Bounds getSelectorBounds(final double width, final double height, final BaseGridRendererHelper.RenderingInformation renderingInformation) { final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); double boundsX = 0.0; double boundsY = 0.0; double boundsWidth = width; double boundsHeight = height; if (!floatingBlockInformation.getColumns().isEmpty()) { boundsX = floatingBlockInformation.getX(); boundsWidth = boundsWidth - floatingBlockInformation.getX(); } if (renderingInformation.isFloatingHeader()) { boundsY = bodyBlockInformation.getHeaderY(); boundsHeight = boundsHeight - bodyBlockInformation.getHeaderY(); } return new BaseBounds(boundsX, boundsY, boundsWidth, boundsHeight); }
private int getScreenX(final GuidedDecisionTableModellerView modellerView, final GuidedDecisionTableView.Presenter dtPresenter, final int uiColumnIndex) { final GridWidget gridWidget = dtPresenter.getView(); final GridColumn<?> uiColumn = gridWidget.getModel().getColumns().get(uiColumnIndex); final double gx = gridWidget.getX(); final GridLayer layer = modellerView.getGridLayerView(); final int containerX = layer.getDomElementContainer().getAbsoluteLeft(); final double vx = layer.getVisibleBounds().getX(); final Transform t = layer.getViewport().getTransform(); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation(); final double offsetX = floatingBlockInformation.getColumns().contains(uiColumn) ? floatingBlockInformation.getX() : 0; final int screenX = containerX + (int) ((gx - vx + offsetX + rendererHelper.getColumnOffset(uiColumn) + uiColumn.getWidth() / 2) * t.getScaleX()); return screenX; }
private BaseGridRendererHelper.ColumnInformation getBodyColumnInformation(final int uiColumnIndex) { final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); if (!bodyColumns.contains(column)) { return null; } return new BaseGridRendererHelper.ColumnInformation(column, uiColumnIndex, bodyBlockInformation.getX() + rendererHelper.getColumnOffset(bodyColumns, bodyColumns.indexOf(column))); }
private BaseGridRendererHelper.ColumnInformation getFloatingColumnInformation(final int uiColumnIndex) { final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); if (!floatingColumns.contains(column)) { return null; } return new BaseGridRendererHelper.ColumnInformation(column, uiColumnIndex, floatingBlockInformation.getX() + rendererHelper.getColumnOffset(floatingColumns, floatingColumns.indexOf(column))); }
private BaseGridRendererHelper.ColumnInformation getFloatingColumnInformation(final int uiColumnIndex) { final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation(); final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); if (!floatingColumns.contains(column)) { return null; } return new BaseGridRendererHelper.ColumnInformation(column, uiColumnIndex, floatingBlockInformation.getX() + rendererHelper.getColumnOffset(floatingColumns, floatingColumns.indexOf(column))); }