Search in sources :

Example 11 with GridBodyCellEditContext

use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext in project kie-wb-common by kiegroup.

the class EditablePopupHeaderMetaDataTest method testEditWithNoRelationLocation.

@Test
public void testEditWithNoRelationLocation() {
    final GridBodyCellEditContext context = new GridBodyCellEditContext(ABSOLUTE_CELL_X, ABSOLUTE_CELL_Y, CELL_WIDTH, CELL_HEIGHT, CLIP_MIN_Y, CLIP_MIN_X, ROW_INDEX, COLUMN_INDEX, IS_FLOATING, transform, renderer, Optional.empty());
    header.edit(context);
    verify(editor).bind(eq(gridWidget), eq(ROW_INDEX), eq(COLUMN_INDEX));
    verify(cellEditorControls).show(eq(editor), eq((int) (ABSOLUTE_CELL_X + CELL_WIDTH / 2)), eq((int) (ABSOLUTE_CELL_Y + CELL_HEIGHT / 2)));
}
Also used : GridBodyCellEditContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext) Test(org.junit.Test)

Example 12 with GridBodyCellEditContext

use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext in project drools-wb by kiegroup.

the class ScenarioSimulationUtils method getMiddleXYCell.

/**
 * Returns an array where the 0-element is middle x of given cell and 1-element is middle y
 * @param gridWidget
 * @param column
 * @param isHeader
 * @param uiRowIndex
 * @param gridLayer
 * @return
 */
public static Point2D getMiddleXYCell(final GridWidget gridWidget, final GridColumn<?> column, boolean isHeader, final int uiRowIndex, final GridLayer gridLayer) {
    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);
    final int cellXMiddle = (int) (context.getAbsoluteCellX() + context.getCellWidth() / 2 + gridLayer.getDomElementContainer().getAbsoluteLeft());
    final int cellYMiddle = (int) (context.getAbsoluteCellY() + context.getCellHeight() / 2 + gridLayer.getDomElementContainer().getAbsoluteTop());
    return new Point2D(cellXMiddle, cellYMiddle);
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) GridBodyCellEditContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)

Aggregations

GridBodyCellEditContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext)12 Point2D (com.ait.lienzo.client.core.types.Point2D)5 BaseGridRendererHelper (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)5 Test (org.junit.Test)4 Group (com.ait.lienzo.client.core.shape.Group)2 Consumer (java.util.function.Consumer)2 List (java.util.List)1 HasName (org.kie.workbench.common.dmn.api.definition.HasName)1 DMNModelInstrumentedBase (org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase)1 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)1 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)1 InformationItemCell (org.kie.workbench.common.dmn.client.editors.expressions.types.context.InformationItemCell)1 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)1 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)1 ColumnInformation (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.ColumnInformation)1 RenderingInformation (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation)1