Search in sources :

Example 1 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 testHeaderTextBoxFactoryWhenNotNested.

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

Example 2 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 testHeaderHasNameTextBoxFactoryWhenNotNested.

@Test
public void testHeaderHasNameTextBoxFactoryWhenNotNested() {
    setupGrid(makeHasNameForDecision(), 0);
    final GridCellTuple tupleWithoutValue = new GridCellTuple(0, 2, gridWidget);
    final GridCellValueTuple tupleWithValue = new GridCellValueTuple<>(0, 2, gridWidget, new BaseGridCellValue<>("value"));
    final TextBoxSingletonDOMElementFactory factory = grid.getHeaderHasNameTextBoxFactory();
    assertCommands(factory.getHasNoValueCommand().apply(tupleWithoutValue), DeleteHeaderValueCommand.class, UpdateElementPropertyCommand.class);
    assertCommands(factory.getHasValueCommand().apply(tupleWithValue), SetHeaderValueCommand.class, UpdateElementPropertyCommand.class);
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) TextBoxSingletonDOMElementFactory(org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextBoxSingletonDOMElementFactory) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple) Test(org.junit.Test)

Example 3 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 testHeaderTextAreaFactoryWhenNotNested.

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

Example 4 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 testBodyTextBoxFactoryWhenNotNested.

@Test
public void testBodyTextBoxFactoryWhenNotNested() {
    setupGrid(makeHasNameForDecision(), 0);
    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 5 with GridCellValueTuple

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

the class SetKindCommandTest method setupCommand.

private void setupCommand() {
    final GridCellValueTuple gcv = new GridCellValueTuple<>(0, 0, gridWidget, new ExpressionCellValue(Optional.of(newEditor)));
    this.command = new SetKindCommand(gcv, function, newKind, Optional.of(newExpression), executeCanvasOperation, undoCanvasOperation, () -> Optional.of(newEditor));
}
Also used : ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple)

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