Search in sources :

Example 11 with GridCellValueTuple

use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple in project kie-wb-common by kiegroup.

the class FunctionGrid method doSetKind.

void doSetKind(final FunctionDefinition.Kind kind, final FunctionDefinition function, final Optional<Expression> expression, final Optional<BaseExpressionGrid> editor) {
    final GridCellValueTuple gcv = new GridCellValueTuple<>(0, 0, this, new ExpressionCellValue(editor));
    sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetKindCommand(gcv, function, kind, expression, () -> synchroniseViewWhenExpressionEditorChanged(this)));
}
Also used : SetKindCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.SetKindCommand) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple)

Example 12 with GridCellValueTuple

use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple in project kie-wb-common by kiegroup.

the class DecisionTableGridTest method testBodyTextBoxFactoryWhenNested.

@Test
public void testBodyTextBoxFactoryWhenNested() {
    setupGrid(makeHasNameForDecision(), 1);
    final GridCellTuple tupleWithoutValue = new GridCellTuple(0, 3, gridWidget);
    final GridCellValueTuple tupleWithValue = new GridCellValueTuple<>(0, 3, gridWidget, new BaseGridCellValue<>("value"));
    final TextAreaSingletonDOMElementFactory factory = grid.getBodyTextAreaFactory();
    assertThat(factory.getHasNoValueCommand().apply(tupleWithoutValue)).isInstanceOf(DeleteCellValueCommand.class);
    assertThat(factory.getHasValueCommand().apply(tupleWithValue)).isInstanceOf(SetCellValueCommand.class);
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) TextAreaSingletonDOMElementFactory(org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextAreaSingletonDOMElementFactory) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple) Test(org.junit.Test)

Example 13 with GridCellValueTuple

use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple in project kie-wb-common by kiegroup.

the class DecisionTableGridTest method testBodyTextAreaFactoryWhenNested.

@Test
public void testBodyTextAreaFactoryWhenNested() {
    setupGrid(makeHasNameForDecision(), 1);
    final GridCellTuple tupleWithoutValue = new GridCellTuple(0, 1, gridWidget);
    final GridCellValueTuple tupleWithValue = new GridCellValueTuple<>(0, 1, gridWidget, new BaseGridCellValue<>("value"));
    final TextAreaSingletonDOMElementFactory factory = grid.getBodyTextAreaFactory();
    assertThat(factory.getHasNoValueCommand().apply(tupleWithoutValue)).isInstanceOf(DeleteCellValueCommand.class);
    assertThat(factory.getHasValueCommand().apply(tupleWithValue)).isInstanceOf(SetCellValueCommand.class);
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) TextAreaSingletonDOMElementFactory(org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextAreaSingletonDOMElementFactory) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple) Test(org.junit.Test)

Example 14 with GridCellValueTuple

use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple in project kie-wb-common by kiegroup.

the class DecisionTableGridTest method testBodyTextAreaFactoryWhenNotNested.

@Test
public void testBodyTextAreaFactoryWhenNotNested() {
    setupGrid(makeHasNameForDecision(), 0);
    final GridCellTuple tupleWithoutValue = new GridCellTuple(0, 1, gridWidget);
    final GridCellValueTuple tupleWithValue = new GridCellValueTuple<>(0, 1, gridWidget, new BaseGridCellValue<>("value"));
    final TextAreaSingletonDOMElementFactory factory = grid.getBodyTextAreaFactory();
    assertThat(factory.getHasNoValueCommand().apply(tupleWithoutValue)).isInstanceOf(DeleteCellValueCommand.class);
    assertThat(factory.getHasValueCommand().apply(tupleWithValue)).isInstanceOf(SetCellValueCommand.class);
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) TextAreaSingletonDOMElementFactory(org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextAreaSingletonDOMElementFactory) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple) Test(org.junit.Test)

Aggregations

GridCellValueTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple)14 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)11 Test (org.junit.Test)10 TextBoxSingletonDOMElementFactory (org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextBoxSingletonDOMElementFactory)6 TextAreaSingletonDOMElementFactory (org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextAreaSingletonDOMElementFactory)4 List (java.util.List)2 Function (java.util.function.Function)2 LiteralExpressionPMMLDocument (org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocument)2 SetCellValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand)2 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)2 LiteralExpressionPMMLGrid (org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.pmml.LiteralExpressionPMMLGrid)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)2 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)2 CompositeCommand (org.kie.workbench.common.stunner.core.command.impl.CompositeCommand)2 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1 Consumer (java.util.function.Consumer)1 Supplier (java.util.function.Supplier)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Event (javax.enterprise.event.Event)1