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;
}
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");
}
});
}
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);
}
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);
}
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;
}
Aggregations