Search in sources :

Example 1 with GridBodyCellRenderContext

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

the class EditableHeaderUtilitiesTest method testMakeRenderContextNoBlock.

@Test
public void testMakeRenderContextNoBlock() {
    final List<GridColumn<?>> allColumns = new ArrayList<>();
    final GridColumn<?> uiColumn = mockGridColumn(100.0);
    allColumns.add(uiColumn);
    doReturn(allColumns).when(ri).getAllColumns();
    doReturn(uiColumn).when(ci).getColumn();
    doReturn(0.0).when(ci).getOffsetX();
    doReturn(0).when(ci).getUiColumnIndex();
    final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
    assertNotNull(context);
    assertEquals(0.0, context.getAbsoluteCellX(), 0.0);
    assertEquals(100.0, context.getCellWidth(), 0.0);
}
Also used : ArrayList(java.util.ArrayList) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Test(org.junit.Test)

Example 2 with GridBodyCellRenderContext

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

the class EditableHeaderUtilitiesTest method testMakeRenderContextLeadBlockWithExtraLeadNonBlockColumn.

@Test
public void testMakeRenderContextLeadBlockWithExtraLeadNonBlockColumn() {
    final List<GridColumn<?>> allColumns = new ArrayList<>();
    final GridColumn<?> uiColumn1 = mockGridColumn(25.0);
    final GridColumn<?> uiColumn2 = mockGridColumn(50.0);
    final GridColumn<?> uiColumn3 = mockGridColumn(75.0, uiColumn2.getHeaderMetaData());
    allColumns.add(uiColumn1);
    allColumns.add(uiColumn2);
    allColumns.add(uiColumn3);
    doReturn(allColumns).when(ri).getAllColumns();
    doReturn(uiColumn3).when(ci).getColumn();
    doReturn(75.0).when(ci).getOffsetX();
    doReturn(2).when(ci).getUiColumnIndex();
    final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
    assertNotNull(context);
    assertEquals(25.0, context.getAbsoluteCellX(), 0.0);
    assertEquals(125.0, context.getCellWidth(), 0.0);
}
Also used : ArrayList(java.util.ArrayList) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Test(org.junit.Test)

Example 3 with GridBodyCellRenderContext

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

the class EditableHeaderUtilitiesTest method testMakeRenderContextNoBlockMultipleColumns.

@Test
public void testMakeRenderContextNoBlockMultipleColumns() {
    final List<GridColumn<?>> allColumns = new ArrayList<>();
    final GridColumn<?> uiColumn1 = mockGridColumn(25.0);
    final GridColumn<?> uiColumn2 = mockGridColumn(50.0);
    final GridColumn<?> uiColumn3 = mockGridColumn(100.0);
    allColumns.add(uiColumn1);
    allColumns.add(uiColumn2);
    allColumns.add(uiColumn3);
    doReturn(allColumns).when(ri).getAllColumns();
    doReturn(uiColumn2).when(ci).getColumn();
    doReturn(25.0).when(ci).getOffsetX();
    doReturn(1).when(ci).getUiColumnIndex();
    final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
    assertNotNull(context);
    assertEquals(25.0, context.getAbsoluteCellX(), 0.0);
    assertEquals(50.0, context.getCellWidth(), 0.0);
}
Also used : ArrayList(java.util.ArrayList) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Test(org.junit.Test)

Example 4 with GridBodyCellRenderContext

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

the class BaseNameAndDataTypeColumnRendererTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.renderer = getColumnRenderer();
    this.headerContext = new GridHeaderColumnRenderContext(0, Collections.singletonList(uiColumn), Collections.singletonList(uiColumn), 0, uiModel, gridRenderer);
    this.bodyContext = new GridBodyCellRenderContext(0, 0, BLOCK_WIDTH, ROW_HEIGHT, 0, 0, 0, 0, false, transform, gridRenderer);
    when(gridRenderer.getTheme()).thenReturn(gridRendererTheme);
    when(gridRendererTheme.getHeaderText()).thenReturn(text1, text2);
    when(gridRendererTheme.getBodyText()).thenReturn(text1);
    when(gridRendererTheme.getPlaceholderText()).thenReturn(text1);
    when(text1.asNode()).thenReturn(mock(Node.class));
    when(text2.asNode()).thenReturn(mock(Node.class));
}
Also used : GridHeaderColumnRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext) Node(com.ait.lienzo.client.core.shape.Node) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Before(org.junit.Before)

Example 5 with GridBodyCellRenderContext

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

the class RendererUtilsTest method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    text = spy(new Text(""));
    headerContext = new GridHeaderColumnRenderContext(0, Collections.singletonList(uiColumn), Collections.singletonList(uiColumn), 0, uiModel, gridRenderer);
    bodyContext = new GridBodyCellRenderContext(0, 0, BLOCK_WIDTH, ROW_HEIGHT, 0, 0, 0, 0, false, transform, gridRenderer);
    when(cellContext.getRenderer()).thenReturn(gridRenderer);
    when(gridRenderer.getTheme()).thenReturn(gridTheme);
    when(gridTheme.getBodyText()).thenReturn(text);
    when(cellContext.getCellWidth()).thenReturn(WIDTH);
    when(cellContext.getCellHeight()).thenReturn(HEIGHT);
    when(gridTheme.getHeaderText()).thenReturn(headerText1, headerText2);
    when(gridTheme.getPlaceholderText()).thenReturn(placeHolderText);
    when(headerText1.asNode()).thenReturn(mock(Node.class));
    when(headerText2.asNode()).thenReturn(mock(Node.class));
    when(placeHolderText.asNode()).thenReturn(mock(Node.class));
}
Also used : GridHeaderColumnRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext) Node(com.ait.lienzo.client.core.shape.Node) Text(com.ait.lienzo.client.core.shape.Text) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Before(org.junit.Before)

Aggregations

GridBodyCellRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext)12 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)7 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)7 Node (com.ait.lienzo.client.core.shape.Node)2 Text (com.ait.lienzo.client.core.shape.Text)2 Before (org.junit.Before)2 GridHeaderColumnRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext)2 Transform (com.ait.lienzo.client.core.types.Transform)1 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 MouseDownEvent (com.google.gwt.event.dom.client.MouseDownEvent)1 MouseDownHandler (com.google.gwt.event.dom.client.MouseDownHandler)1 EventHandler (com.google.gwt.event.shared.EventHandler)1 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)1 ScenarioGridColumn (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)1