Search in sources :

Example 36 with GridColumn

use of org.uberfire.ext.wires.core.grids.client.model.GridColumn in project kie-wb-common by kiegroup.

the class LiteralExpressionGrid method initialiseUiColumns.

@Override
protected void initialiseUiColumns() {
    final List<GridColumn.HeaderMetaData> headerMetaData = new ArrayList<>();
    if (nesting == 0) {
        headerMetaData.add(new LiteralExpressionColumnHeaderMetaData(hasExpression, hasName, clearValueConsumer(true, new Name()), setValueConsumer(true), setTypeRefConsumer(), translationService, cellEditorControls, headerEditor));
    }
    final GridColumn literalExpressionColumn = new LiteralExpressionColumn(headerMetaData, getAutocompleteTextareaFactory(), getAndSetInitialWidth(0, LITERAL_EXPRESSION_DEFAULT_WIDTH), this);
    model.appendColumn(literalExpressionColumn);
}
Also used : ArrayList(java.util.ArrayList) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName)

Example 37 with GridColumn

use of org.uberfire.ext.wires.core.grids.client.model.GridColumn in project kie-wb-common by kiegroup.

the class RelationGrid method initialiseUiColumns.

@Override
public void initialiseUiColumns() {
    int uiColumnIndex = 0;
    final RowNumberColumn rowNumberColumn = new RowNumberColumn();
    rowNumberColumn.setWidth(getAndSetInitialWidth(uiColumnIndex++, rowNumberColumn.getWidth()));
    if (getExpression().get().isPresent()) {
        model.appendColumn(rowNumberColumn);
        final Relation e = getExpression().get().get();
        for (int index = 0; index < e.getColumn().size(); index++) {
            final GridColumn relationColumn = makeRelationColumn(uiColumnIndex++, e.getColumn().get(index));
            model.appendColumn(relationColumn);
        }
    }
    getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> true);
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) DMNGridColumn(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridColumn)

Example 38 with GridColumn

use of org.uberfire.ext.wires.core.grids.client.model.GridColumn in project kie-wb-common by kiegroup.

the class LiteralExpressionPMMLGrid method initialiseUiColumns.

@Override
protected void initialiseUiColumns() {
    final GridColumn literalExpressionColumn = new LiteralExpressionPMMLColumn(getBodyListBoxFactory(), getAndSetInitialWidth(0, DMNGridColumn.DEFAULT_WIDTH), this);
    model.appendColumn(literalExpressionColumn);
}
Also used : GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) DMNGridColumn(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridColumn)

Example 39 with GridColumn

use of org.uberfire.ext.wires.core.grids.client.model.GridColumn in project kie-wb-common by kiegroup.

the class DMNGridWidgetDnDMouseUpHandler method onNodeMouseUp.

@Override
public void onNodeMouseUp(final NodeMouseUpEvent event) {
    if (state.getOperation() == GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_RESIZE) {
        final GridWidget gridWidget = state.getActiveGridWidget();
        final List<GridColumn<?>> gridColumns = state.getActiveGridColumns();
        if (isBaseGrid(gridWidget) && isSingleDMNColumn(gridColumns)) {
            final BaseGrid uiGridWidget = (BaseGrid) gridWidget;
            final DMNGridColumn uiColumn = (DMNGridColumn) gridColumns.get(0);
            uiGridWidget.registerColumnResizeCompleted(uiColumn, state.getEventInitialColumnWidth());
        }
    }
    super.onNodeMouseUp(event);
}
Also used : DMNGridColumn(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridColumn) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) DMNGridColumn(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) BaseGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid)

Example 40 with GridColumn

use of org.uberfire.ext.wires.core.grids.client.model.GridColumn in project kie-wb-common by kiegroup.

the class DeleteRuleAnnotationClauseCommandTest method testNewCanvasCommandExecute.

@Test
public void testNewCanvasCommandExecute() {
    final DeleteRuleAnnotationClauseCommand command = mock(DeleteRuleAnnotationClauseCommand.class);
    final AbstractCanvasHandler handler = mock(AbstractCanvasHandler.class);
    final int uiColumnIndex = 7;
    final List columns = mock(List.class);
    final GridData uiModel = mock(GridData.class);
    final org.uberfire.mvp.Command executeCanvasOperation = mock(org.uberfire.mvp.Command.class);
    final GridColumn gridColumn = mock(GridColumn.class);
    doCallRealMethod().when(command).newCanvasCommand(handler);
    when(command.getUiModel()).thenReturn(uiModel);
    when(uiModel.getColumns()).thenReturn(columns);
    when(command.getUiColumnIndex()).thenReturn(uiColumnIndex);
    when(command.getExecuteCanvasOperation()).thenReturn(executeCanvasOperation);
    when(columns.get(uiColumnIndex)).thenReturn(gridColumn);
    final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(handler);
    final CommandResult<CanvasViolation> result = canvasCommand.execute(handler);
    verify(uiModel).deleteColumn(gridColumn);
    verify(command).updateParentInformation();
    verify(executeCanvasOperation).execute();
    assertEquals(CanvasCommandResultBuilder.SUCCESS, result);
}
Also used : CanvasViolation(org.kie.workbench.common.stunner.core.client.command.CanvasViolation) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) List(java.util.List) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Test(org.junit.Test)

Aggregations

GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)62 Test (org.junit.Test)42 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)15 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)12 ArrayList (java.util.ArrayList)11 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)10 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)8 DMNGridColumn (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridColumn)8 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)7 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)7 GridBodyCellRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext)7 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)6 List (java.util.List)5 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)5 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)5 GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)5 Optional (java.util.Optional)4 ScenarioHeaderMetaData (org.drools.workbench.screens.scenariosimulation.client.metadata.ScenarioHeaderMetaData)4 ScenarioGridColumn (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)4 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)4