Search in sources :

Example 6 with BaseGridRow

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

the class GuidedDecisionTableRendererTest method setup.

@Before
public void setup() {
    this.uiModel = new GuidedDecisionTableUiModel(synchronizer);
    this.uiColumn = new RowNumberColumn();
    this.uiModel.appendColumn(uiColumn);
    this.uiModel.appendRow(new BaseGridRow());
    this.renderer = new GuidedDecisionTableRenderer(uiModel, new GuidedDecisionTable52());
    doReturn(new ArrayList<Double>() {

        {
            add(20.0);
        }
    }).when(renderingInformation).getVisibleRowOffsets();
    doReturn(new ArrayList<GridColumn<?>>() {

        {
            add(uiColumn);
        }
    }).when(context).getBlockColumns();
    doReturn(bodyBlockInformation).when(renderingInformation).getBodyBlockInformation();
    doReturn(new ArrayList<GridColumn<?>>() {

        {
            add(uiColumn);
        }
    }).when(bodyBlockInformation).getColumns();
    doReturn(floatingBlockInformation).when(renderingInformation).getFloatingBlockInformation();
    doReturn(Collections.emptyList()).when(floatingBlockInformation).getColumns();
    doReturn(renderer).when(context).getRenderer();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Before(org.junit.Before)

Example 7 with BaseGridRow

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

the class InsertMenuBuilderTest method setup.

@Before
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    final MenuItemFactory menuItemFactory = new MenuItemFactory(menuItemViewProducer);
    when(dtPresenter.hasEditableColumns()).thenReturn(true);
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    when(translationService.getTranslation(any(String.class))).thenReturn("i18n");
    when(menuItemViewProducer.select(any(Annotation.class))).thenReturn(menuItemViewProducer);
    when(menuItemViewProducer.get()).thenReturn(mock(MenuItemWithIconView.class));
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendRow(new BaseGridRow());
    uiModel.appendRow(new BaseGridRow());
    builder = spy(new InsertMenuBuilder(translationService, menuItemFactory, wizardManagedInstance));
    builder.setup();
    builder.setModeller(modeller);
}
Also used : MenuItemWithIconView(org.uberfire.ext.widgets.common.client.menu.MenuItemWithIconView) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) MenuItemFactory(org.uberfire.ext.widgets.common.client.menu.MenuItemFactory) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) Annotation(java.lang.annotation.Annotation) Before(org.junit.Before)

Example 8 with BaseGridRow

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

the class EditMenuBuilderTest method setup.

@Before
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    clipboard = new DefaultClipboard();
    final MenuItemFactory menuItemFactory = new MenuItemFactory(menuItemViewProducer);
    when(dtPresenter.hasEditableColumns()).thenReturn(true);
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    when(ts.getTranslation(any(String.class))).thenReturn("i18n");
    when(menuItemViewProducer.select(any(Annotation.class))).thenReturn(menuItemViewProducer);
    when(menuItemViewProducer.get()).thenReturn(menuItemWithIconView);
    when(menuItemWithIconView.getElement()).thenReturn(menuItemHTMLElement);
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendColumn(new BaseGridColumn<>(headerMetaData, gridColumnRenderer, 100));
    uiModel.appendRow(new BaseGridRow());
    builder = spy(new EditMenuBuilder(clipboard, ts, menuItemFactory, popoverUtils));
    builder.setup();
}
Also used : DefaultClipboard(org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) MenuItemFactory(org.uberfire.ext.widgets.common.client.menu.MenuItemFactory) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) Matchers.anyString(org.mockito.Matchers.anyString) Annotation(java.lang.annotation.Annotation) Before(org.junit.Before)

Example 9 with BaseGridRow

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

the class RowContextMenuTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    clipboard = new DefaultClipboard();
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendRow(new BaseGridRow());
    menu = spy(new RowContextMenu(view, clipboard));
    menu.setup();
}
Also used : DefaultClipboard(org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Before(org.junit.Before)

Example 10 with BaseGridRow

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

the class RowSynchronizer method insert.

@Override
public void insert(final RowMetaData metaData) throws VetoException {
    if (!handlesAppend(metaData)) {
        return;
    }
    final int rowIndex = metaData.getRowIndex();
    final List<DTCellValue52> modelRow = new ArrayList<DTCellValue52>();
    model.getData().add(rowIndex, modelRow);
    final GridRow uiModelRow = new BaseGridRow(GuidedDecisionTableView.ROW_HEIGHT);
    uiModel.insertRow(rowIndex, uiModelRow);
    initialiseRowData(rowIndex);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) ArrayList(java.util.ArrayList) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow)

Aggregations

BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)11 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)6 Before (org.junit.Before)6 GuidedDecisionTableUiModel (org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel)5 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)4 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)3 DefaultClipboard (org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard)3 GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)3 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)3 Annotation (java.lang.annotation.Annotation)2 ArrayList (java.util.ArrayList)2 MenuItemFactory (org.uberfire.ext.widgets.common.client.menu.MenuItemFactory)2 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)2 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)2 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)2 Point2D (com.ait.lienzo.client.core.types.Point2D)1 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)1 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)1 Test (org.junit.Test)1