use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper in project drools-wb by kiegroup.
the class GuidedDecisionTableSortGridWidgetMouseEventHandler method handleHeaderCell.
@Override
public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) {
// Get column information
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(relativeLocation.getX());
final GridColumn<?> column = ci.getColumn();
sortConsumer.accept(column);
return true;
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper 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.getComputedLocation()).thenReturn(new Point2D(x, 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;
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper in project drools-wb by kiegroup.
the class ScenarioSimulationUtils method getCellHeight.
public static int getCellHeight(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex) {
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();
final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2;
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate);
final GridBodyCellEditContext context = isHeader ? CellContextUtilities.makeHeaderCellRenderContext(gridWidget, ri, ci, uiRowIndex) : CellContextUtilities.makeCellRenderContext(gridWidget, ri, ci, uiRowIndex);
return (int) context.getCellHeight();
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper in project drools-wb by kiegroup.
the class ColumnHeaderPopOverImpl method getScreenX.
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;
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper in project drools-wb by kiegroup.
the class ScenarioSimulationGridWidgetMouseEventHandler method handleHeaderCell.
@Override
public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) {
// Get column information
final double cx = relativeLocation.getX();
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);
final GridColumn<?> column = ci.getColumn();
if (column == null) {
return false;
}
final ScenarioHeaderMetaData headerMetaData = (ScenarioHeaderMetaData) column.getHeaderMetaData().get(uiHeaderRowIndex);
final GridData gridData = gridWidget.getModel();
if (!gridData.getSelectedHeaderCells().isEmpty() && editSupportedLocal(headerMetaData.getSupportedEditAction(), event)) {
final GridData.SelectedCell firstSelectedHeaderCell = gridData.getSelectedHeaderCells().get(0);
final Optional<GridColumn<?>> firstSelectedColumnOptional = gridData.getColumns().stream().filter(col -> col.getIndex() == firstSelectedHeaderCell.getColumnIndex()).findFirst();
final int firstSelectedColumnPosition = gridData.getColumns().indexOf(firstSelectedColumnOptional.orElseThrow(IllegalStateException::new));
return startEditLocal((ScenarioGrid) gridWidget, firstSelectedColumnPosition, (ScenarioGridColumn) column, uiHeaderRowIndex, true);
}
return true;
}
Aggregations