Search in sources :

Example 26 with GridData

use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method linkTables.

@SuppressWarnings("unchecked")
private void linkTables() {
    final GridData uiModel1 = spy(new BaseGridData());
    final GridData uiModel2 = spy(new BaseGridData());
    final GridData uiModel3 = spy(new BaseGridData());
    final GuidedDecisionTableView dtView2 = mock(GuidedDecisionTableView.class);
    final GuidedDecisionTableView dtView3 = mock(GuidedDecisionTableView.class);
    final GuidedDecisionTableView.Presenter dtPresenter2 = setupPresenter();
    final GuidedDecisionTableView.Presenter dtPresenter3 = setupPresenter();
    final Set<GuidedDecisionTableView.Presenter> dtPresenters = new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
            add(dtPresenter2);
            add(dtPresenter3);
        }
    };
    when(dtPresenter.getModel()).thenReturn(model1);
    when(dtPresenter2.getModel()).thenReturn(model2);
    when(dtPresenter3.getModel()).thenReturn(model3);
    when(dtPresenter2.getView()).thenReturn(dtView2);
    when(dtPresenter3.getView()).thenReturn(dtView3);
    when(view.getModel()).thenReturn(uiModel1);
    when(dtView2.getModel()).thenReturn(uiModel2);
    when(dtView3.getModel()).thenReturn(uiModel3);
    when(uiModel1.getColumns()).thenReturn(uiModel1Columns);
    when(uiModel2.getColumns()).thenReturn(uiModel2Columns);
    when(uiModel3.getColumns()).thenReturn(uiModel3Columns);
    when(uiModel1Columns.get(anyInt())).thenReturn(uiModel1MockColumn);
    when(uiModel2Columns.get(anyInt())).thenReturn(uiModel2MockColumn);
    when(uiModel3Columns.get(anyInt())).thenReturn(uiModel3MockColumn);
    dtPresenter.link(dtPresenters);
    dtPresenter2.link(dtPresenters);
    dtPresenter3.link(dtPresenters);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) HashSet(java.util.HashSet)

Example 27 with GridData

use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method onOtherwiseCellMultipleCellsSelected.

@Test
public void onOtherwiseCellMultipleCellsSelected() throws VetoException {
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 0);
    uiModel.selectCell(1, 0);
    dtPresenter.onOtherwiseCell();
    verify(synchronizer, never()).setCellOtherwiseState(any(Integer.class), any(Integer.class));
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 28 with GridData

use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.

the class DeleteCell method clearCells.

@Override
protected void clearCells(final GridWidget gridWidget) {
    final GridData gridModel = gridWidget.getModel();
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return;
    }
    if (!(gridWidget instanceof GuidedDecisionTableView)) {
        return;
    }
    final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
    final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
    dtPresenter.onDeleteSelectedCells();
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 29 with GridData

use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.

the class GotoBeginningOfRow method selectLeftMostCell.

protected boolean selectLeftMostCell(final GridWidget gridWidget) {
    final GridData gridModel = gridWidget.getModel();
    final int rowCount = gridModel.getRowCount();
    final int columnCount = gridModel.getColumnCount();
    if (rowCount == 0 || columnCount == 0) {
        return false;
    }
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    return gridWidget.selectCell(origin.getRowIndex(), 0, false, false);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData)

Example 30 with GridData

use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.

the class SelectionCopy method perform.

@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
    final GridData gridModel = gridWidget.getModel();
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    if (!(gridWidget instanceof GuidedDecisionTableView)) {
        return false;
    }
    final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
    final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
    dtPresenter.onCopy();
    return false;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Aggregations

GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)30 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)22 Test (org.junit.Test)19 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)8 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)8 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)8 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)6 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)5 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)3 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)2 GridColumnRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer)2 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)2 Point2D (com.ait.lienzo.client.core.types.Point2D)1 HashSet (java.util.HashSet)1 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)1 BaseGridRendererHelper (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)1