Search in sources :

Example 16 with ActionWorkItemSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldColumnSynchronizerTest method testUpdate.

@Test
public void testUpdate() throws VetoException {
    final ActionWorkItemSetFieldCol52 column = spy(new ActionWorkItemSetFieldCol52());
    column.setWorkItemName(WORK_ITEM_NAME);
    column.setHeader("col1");
    modelSynchronizer.appendColumn(column);
    final ActionWorkItemSetFieldCol52 edited = new ActionWorkItemSetFieldCol52();
    edited.setWorkItemName(WORK_ITEM_NAME);
    edited.setWidth(column.getWidth());
    edited.setHideColumn(true);
    edited.setHeader("updated");
    List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
    assertEquals(2, diffs.size());
    verify(column).diff(edited);
    assertEquals(2, model.getActionCols().size());
    assertEquals(5, uiModel.getColumns().size());
    assertTrue(uiModel.getColumns().get(4) instanceof BooleanUiColumn);
    assertEquals("updated", uiModel.getColumns().get(4).getHeaderMetaData().get(1).getTitle());
    assertEquals(false, uiModel.getColumns().get(4).isVisible());
}
Also used : BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 17 with ActionWorkItemSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldColumnSynchronizerTest method testAppend.

@Test
public void testAppend() throws VetoException {
    final ActionWorkItemSetFieldCol52 column = new ActionWorkItemSetFieldCol52();
    column.setWorkItemName(WORK_ITEM_NAME);
    column.setHeader("col1");
    modelSynchronizer.appendColumn(column);
    assertEquals(2, model.getActionCols().size());
    assertEquals(5, uiModel.getColumns().size());
    assertTrue(uiModel.getColumns().get(4) instanceof BooleanUiColumn);
    assertEquals(true, ((BaseMultipleDOMElementUiColumn) uiModel.getColumns().get(4)).isEditable());
}
Also used : ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 18 with ActionWorkItemSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldColumnSynchronizerTest method testMoveColumnTo_MoveLeft.

@Test
public void testMoveColumnTo_MoveLeft() throws VetoException {
    // Add a Pattern to be updated
    final Pattern52 pattern = new Pattern52();
    pattern.setBoundName("$a");
    pattern.setFactType("Applicant");
    final ConditionCol52 condition = new ConditionCol52();
    condition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    condition.setHeader("col1");
    condition.setFactField("age");
    condition.setOperator("==");
    modelSynchronizer.appendColumn(pattern, condition);
    final ActionWorkItemSetFieldCol52 column1 = new ActionWorkItemSetFieldCol52();
    column1.setWorkItemName(WORK_ITEM_NAME);
    column1.setBoundName("$a");
    column1.setFactField("age");
    column1.setHeader("wid1");
    final ActionWorkItemSetFieldCol52 column2 = new ActionWorkItemSetFieldCol52();
    column2.setWorkItemName(WORK_ITEM_NAME);
    column2.setBoundName("$a");
    column2.setFactField("name");
    column2.setHeader("wid2");
    modelSynchronizer.appendColumn(column1);
    modelSynchronizer.appendColumn(column2);
    modelSynchronizer.appendRow();
    uiModel.setCellValue(0, 5, new BaseGridCellValue<Boolean>(true));
    uiModel.setCellValue(0, 6, new BaseGridCellValue<Boolean>(false));
    assertEquals(3, model.getActionCols().size());
    assertEquals(column1, model.getActionCols().get(1));
    assertEquals(column2, model.getActionCols().get(2));
    assertEquals(true, model.getData().get(0).get(5).getBooleanValue());
    assertEquals(false, model.getData().get(0).get(6).getBooleanValue());
    assertEquals(7, uiModel.getColumns().size());
    final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(5);
    final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(6);
    assertEquals("wid1", uiModelColumn1_1.getHeaderMetaData().get(1).getTitle());
    assertEquals("wid2", uiModelColumn2_1.getHeaderMetaData().get(1).getTitle());
    assertTrue(uiModelColumn1_1 instanceof BooleanUiColumn);
    assertTrue(uiModelColumn2_1 instanceof BooleanUiColumn);
    assertEquals(5, uiModelColumn1_1.getIndex());
    assertEquals(6, uiModelColumn2_1.getIndex());
    assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
    assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
    uiModel.moveColumnTo(5, uiModelColumn2_1);
    assertEquals(3, model.getActionCols().size());
    assertEquals(column2, model.getActionCols().get(1));
    assertEquals(column1, model.getActionCols().get(2));
    assertEquals(false, model.getData().get(0).get(5).getBooleanValue());
    assertEquals(true, model.getData().get(0).get(6).getBooleanValue());
    assertEquals(7, uiModel.getColumns().size());
    final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(5);
    final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(6);
    assertEquals("wid2", uiModelColumn1_2.getHeaderMetaData().get(1).getTitle());
    assertEquals("wid1", uiModelColumn2_2.getHeaderMetaData().get(1).getTitle());
    assertTrue(uiModelColumn1_2 instanceof BooleanUiColumn);
    assertTrue(uiModelColumn2_2 instanceof BooleanUiColumn);
    assertEquals(6, uiModelColumn1_2.getIndex());
    assertEquals(5, uiModelColumn2_2.getIndex());
    assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
    assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 19 with ActionWorkItemSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.

the class ActionWorkItemSetFieldColumnSynchronizerTest method testDelete.

@Test
public void testDelete() throws VetoException {
    final ActionWorkItemSetFieldCol52 column = new ActionWorkItemSetFieldCol52();
    column.setWorkItemName(WORK_ITEM_NAME);
    column.setHeader("col1");
    modelSynchronizer.appendColumn(column);
    assertEquals(2, model.getActionCols().size());
    assertEquals(5, uiModel.getColumns().size());
    modelSynchronizer.deleteColumn(column);
    assertEquals(1, model.getActionCols().size());
    assertEquals(4, uiModel.getColumns().size());
}
Also used : ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) Test(org.junit.Test)

Example 20 with ActionWorkItemSetFieldCol52

use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.

the class AuditLogEntryCellHelperTest method getSafeHtml_ActionWorkItemSetField.

@Test
public void getSafeHtml_ActionWorkItemSetField() {
    ActionWorkItemSetFieldCol52 originalColumn = new ActionWorkItemSetFieldCol52();
    originalColumn.setParameterClassName("ParamClass1");
    originalColumn.setWorkItemName("WI1");
    originalColumn.setWorkItemResultParameterName("param1");
    originalColumn.setBoundName("bind1");
    originalColumn.setFactField("field1");
    originalColumn.setUpdate(false);
    originalColumn.setHeader("action1");
    originalColumn.setHideColumn(false);
    ActionWorkItemSetFieldCol52 newColumn = new ActionWorkItemSetFieldCol52();
    newColumn.setParameterClassName("ParamClass2");
    newColumn.setWorkItemName("WI2");
    newColumn.setWorkItemResultParameterName("param2");
    newColumn.setBoundName("bind2");
    newColumn.setFactField("field2");
    newColumn.setUpdate(true);
    newColumn.setHeader("action2");
    newColumn.setHideColumn(true);
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getActionHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Also used : UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52) Test(org.junit.Test)

Aggregations

ActionWorkItemSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52)22 Test (org.junit.Test)15 BooleanUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn)6 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)5 ArrayList (java.util.ArrayList)4 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)4 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)4 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)3 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)3 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)3 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)3 ActionExecuteWorkItem (org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem)2 ActionFieldValue (org.drools.workbench.models.datamodel.rule.ActionFieldValue)2 ActionSetField (org.drools.workbench.models.datamodel.rule.ActionSetField)2 ActionWorkItemFieldValue (org.drools.workbench.models.datamodel.rule.ActionWorkItemFieldValue)2 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)2 PortableBooleanParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition)2 PortableFloatParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)2 PortableWorkDefinition (org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)2 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)2