Search in sources :

Example 1 with GridLayer

use of org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer 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;
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) Transform(com.ait.lienzo.client.core.types.Transform) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)

Example 2 with GridLayer

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

the class BaseSynchronizerTest method setup.

@Before
public void setup() {
    // Setup model related classes
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(modelSynchronizer);
    incrementalDataModelServiceCaller = new CallerMock<>(incrementalDataModelService);
    final BRLRuleModel rm = new BRLRuleModel(model);
    final CellUtilities cellUtilities = new CellUtilities();
    final ColumnUtilities columnUtilities = new ColumnUtilities(model, oracle);
    final DependentEnumsUtilities enumsUtilities = new DependentEnumsUtilities(model, oracle);
    final GridWidgetCellFactory gridWidgetCellFactory = new GridWidgetCellFactoryImpl();
    // Setup mocks
    final GuidedDecisionTableModellerView.Presenter modellerPresenter = mock(GuidedDecisionTableModellerView.Presenter.class);
    final GuidedDecisionTableModellerView modellerView = mock(GuidedDecisionTableModellerView.class);
    final GridLayer gridLayer = mock(GridLayer.class);
    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final GuidedDecisionTableView.Presenter dtablePresenter = mock(GuidedDecisionTableView.Presenter.class);
    final EventBus eventBus = mock(EventBus.class);
    when(dtablePresenter.getModellerPresenter()).thenReturn(modellerPresenter);
    when(modellerPresenter.getView()).thenReturn(modellerView);
    when(modellerView.getGridLayerView()).thenReturn(gridLayer);
    when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer);
    when(domElementContainer.iterator()).thenReturn(mock(Iterator.class));
    // Setup column converters
    final List<BaseColumnConverter> converters = getConverters();
    gridWidgetColumnFactory.setConverters(converters);
    gridWidgetColumnFactory.initialise(model, oracle, columnUtilities, dtablePresenter);
    // Setup synchronizers
    final List<Synchronizer<? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData>> synchronizers = getSynchronizers();
    modelSynchronizer.setSynchronizers(synchronizers);
    modelSynchronizer.initialise(model, uiModel, cellUtilities, columnUtilities, enumsUtilities, gridWidgetCellFactory, gridWidgetColumnFactory, view, rm, eventBus, editable);
    // Dummy columns for Row number and Description
    uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RowNumberCol52(), readOnly, view));
    uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new DescriptionCol52(), readOnly, view));
    ApplicationPreferences.setUp(new HashMap<String, String>() {

        {
            put(ApplicationPreferences.DATE_FORMAT, "dd-MM-yyyy");
        }
    });
}
Also used : ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) EventBus(com.google.gwt.event.shared.EventBus) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) GridWidgetCellFactoryImpl(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.impl.GridWidgetCellFactoryImpl) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) MetaData(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer.MetaData) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) Iterator(java.util.Iterator) BaseColumnConverter(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter) Synchronizer(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer) BRLRuleModel(org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel) DependentEnumsUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.DependentEnumsUtilities) CellUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.CellUtilities) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) GridWidgetCellFactory(org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.GridWidgetCellFactory) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) Before(org.junit.Before)

Example 3 with GridLayer

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

the class GuidedDecisionTableModellerPresenterTest method testAddOnEnterPinnedModeCommand.

@Test
public void testAddOnEnterPinnedModeCommand() {
    final Command command = mock(Command.class);
    final GridLayer gridLayer = mock(GridLayer.class);
    doReturn(gridLayer).when(view).getGridLayerView();
    presenter.addOnEnterPinnedModeCommand(command);
    verify(gridLayer).addOnEnterPinnedModeCommand(command);
}
Also used : Command(com.google.gwt.user.client.Command) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) Test(org.junit.Test)

Example 4 with GridLayer

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

the class GuidedDecisionTableModellerPresenterTest method testAddOnExitPinnedModeCommand.

@Test
public void testAddOnExitPinnedModeCommand() {
    final Command command = mock(Command.class);
    final GridLayer gridLayer = mock(GridLayer.class);
    doReturn(gridLayer).when(view).getGridLayerView();
    presenter.addOnExitPinnedModeCommand(command);
    verify(gridLayer).addOnExitPinnedModeCommand(command);
}
Also used : Command(com.google.gwt.user.client.Command) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) Test(org.junit.Test)

Example 5 with GridLayer

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

the class ColumnHeaderPopOverImpl method getScreenY.

private int getScreenY(final GuidedDecisionTableModellerView modellerView, final GuidedDecisionTableView.Presenter dtPresenter) {
    final GridWidget gridWidget = dtPresenter.getView();
    final double gy = gridWidget.getY();
    final GridLayer layer = modellerView.getGridLayerView();
    final int containerY = layer.getDomElementContainer().getAbsoluteTop();
    final double vy = layer.getVisibleBounds().getY();
    final Transform t = layer.getViewport().getTransform();
    final Group header = gridWidget.getHeader();
    final double headerHeight = gridWidget.getRenderer().getHeaderHeight();
    final double headerRowHeight = gridWidget.getRenderer().getHeaderRowHeight();
    final double offsetY = header == null ? 0 : header.getY();
    final int screenY = containerY + (int) ((gy - vy + offsetY + headerHeight - headerRowHeight / 2) * t.getScaleX());
    return screenY;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) Transform(com.ait.lienzo.client.core.types.Transform)

Aggregations

GridLayer (org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer)5 Transform (com.ait.lienzo.client.core.types.Transform)2 Command (com.google.gwt.user.client.Command)2 Test (org.junit.Test)2 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)2 Group (com.ait.lienzo.client.core.shape.Group)1 EventBus (com.google.gwt.event.shared.EventBus)1 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)1 Iterator (java.util.Iterator)1 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)1 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)1 GuidedDecisionTableModellerView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView)1 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)1 GuidedDecisionTableUiModel (org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel)1 GridWidgetCellFactory (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.GridWidgetCellFactory)1 GridWidgetCellFactoryImpl (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.cell.impl.GridWidgetCellFactoryImpl)1 BaseColumnConverter (org.drools.workbench.screens.guided.dtable.client.widget.table.model.converters.column.BaseColumnConverter)1 Synchronizer (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer)1