Search in sources :

Example 21 with ActionRetractFactCol52

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

the class ActionRetractFactPlugin method newColumn.

ActionRetractFactCol52 newColumn() {
    switch(tableFormat()) {
        case EXTENDED_ENTRY:
            return new ActionRetractFactCol52();
        case LIMITED_ENTRY:
            final LimitedEntryActionRetractFactCol52 col52 = new LimitedEntryActionRetractFactCol52();
            col52.setValue(new DTCellValue52(""));
            return col52;
        default:
            throw new UnsupportedOperationException("Unsupported table format: " + tableFormat());
    }
}
Also used : LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 22 with ActionRetractFactCol52

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

the class PluginHandlerTest method testEditWhenColumnIsAnActionRetractFactCol52.

@Test
public void testEditWhenColumnIsAnActionRetractFactCol52() {
    final ActionRetractFactCol52 originalColumn = mock(ActionRetractFactCol52.class);
    final ActionRetractFactPlugin plugin = spy(new ActionRetractFactPlugin(patternToDeletePage, additionalInfoPage, event, translationService));
    testEditActionColumn(plugin, actionRetractFactPlugin, originalColumn);
}
Also used : ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) ActionRetractFactPlugin(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.ActionRetractFactPlugin) Test(org.junit.Test)

Example 23 with ActionRetractFactCol52

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

the class ColumnManagementViewTest method testRenderColumnActionsNotEditable.

@Test
public void testRenderColumnActionsNotEditable() throws Exception {
    final BRLActionColumn brlActionColumn = mock(BRLActionColumn.class);
    final ActionInsertFactCol52 actionInsertFactColumn = mock(ActionInsertFactCol52.class);
    final ActionRetractFactCol52 retractFactColumn = mock(ActionRetractFactCol52.class);
    final Map<String, List<BaseColumn>> columnGroups = new HashMap<String, List<BaseColumn>>() {

        {
            put(GuidedDecisionTableConstants.INSTANCE.BrlConditions(), Arrays.asList(brlActionColumn, actionInsertFactColumn, retractFactColumn));
        }
    };
    final ColumnLabelWidget columnLabel = mockColumnLabelWidget();
    doReturn(columnLabel).when(view).newColumnLabelWidget(anyString());
    view.renderColumns(columnGroups);
    verify(view).renderColumn(brlActionColumn);
    verify(view).renderColumn(actionInsertFactColumn);
    verify(view).renderColumn(retractFactColumn);
    // There are three action columns
    verify(horizontalPanel, times(3)).add(columnLabel);
    verify(view, times(3)).editAnchor(any(ClickHandler.class));
    verify(view, never()).deleteAnchor(eq("one"), any(Command.class));
    verify(view, never()).deleteAnchor(eq("two"), any(Command.class));
    verify(view, never()).deleteAnchor(eq("three"), any(Command.class));
}
Also used : BRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) HashMap(java.util.HashMap) Command(com.google.gwt.user.client.Command) List(java.util.List) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 24 with ActionRetractFactCol52

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

the class ColumnManagementViewTest method testRenderColumnActionsEditable.

@Test
public void testRenderColumnActionsEditable() throws Exception {
    final BRLActionColumn brlActionColumn = mock(BRLActionColumn.class);
    final ActionInsertFactCol52 actionInsertFactColumn = mock(ActionInsertFactCol52.class);
    final ActionRetractFactCol52 retractFactColumn = mock(ActionRetractFactCol52.class);
    final Map<String, List<BaseColumn>> columnGroups = new HashMap<String, List<BaseColumn>>() {

        {
            put(GuidedDecisionTableConstants.INSTANCE.BrlConditions(), Arrays.asList(brlActionColumn, actionInsertFactColumn, retractFactColumn));
        }
    };
    final ColumnLabelWidget columnLabel = mockColumnLabelWidget();
    doReturn(columnLabel).when(view).newColumnLabelWidget(anyString());
    doReturn(true).when(modellerPresenter).isActiveDecisionTableEditable();
    doReturn("one").when(brlActionColumn).getHeader();
    doReturn("two").when(actionInsertFactColumn).getHeader();
    doReturn("three").when(retractFactColumn).getHeader();
    view.renderColumns(columnGroups);
    verify(view).renderColumn(brlActionColumn);
    verify(view).renderColumn(actionInsertFactColumn);
    verify(view).renderColumn(retractFactColumn);
    // There are three action columns
    verify(horizontalPanel, times(3)).add(columnLabel);
    verify(view, times(3)).editAnchor(clickHandlerCaptor.capture());
    verify(view).deleteAnchor(eq("one"), deleteCommandCaptor.capture());
    verify(view).deleteAnchor(eq("two"), deleteCommandCaptor.capture());
    verify(view).deleteAnchor(eq("three"), deleteCommandCaptor.capture());
    clickHandlerCaptor.getAllValues().get(0).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editAction(eq(brlActionColumn));
    clickHandlerCaptor.getAllValues().get(1).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editAction(eq(actionInsertFactColumn));
    clickHandlerCaptor.getAllValues().get(2).onClick(mock(ClickEvent.class));
    verify(decisionTablePresenter).editAction(eq(retractFactColumn));
    deleteCommandCaptor.getAllValues().get(0).execute();
    verify(decisionTablePresenter).deleteColumn(brlActionColumn);
    deleteCommandCaptor.getAllValues().get(1).execute();
    verify(decisionTablePresenter).deleteColumn(actionInsertFactColumn);
    deleteCommandCaptor.getAllValues().get(2).execute();
    verify(decisionTablePresenter).deleteColumn(retractFactColumn);
}
Also used : BRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) HashMap(java.util.HashMap) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) List(java.util.List) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 25 with ActionRetractFactCol52

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

the class ActionRetractFactColumnSynchronizerTest method testAppend.

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

Aggregations

ActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52)31 Test (org.junit.Test)24 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)11 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)10 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)8 LimitedEntryActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52)7 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)6 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)4 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)4 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)4 LimitedEntryActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52)4 LimitedEntryActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)4 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)4 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)4 BoundFactUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn)4 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)3 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2