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());
}
}
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);
}
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));
}
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);
}
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());
}
Aggregations