use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.
the class InsertMenuBuilderTest method testOnDecisionTableSelectedEventReadOnly.
@Test
public void testOnDecisionTableSelectedEventReadOnly() {
dtPresenter.getAccess().setReadOnly(true);
builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
assertFalse(builder.miAppendRow.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.
the class InsertMenuBuilderTest method testOnDecisionTableSelectedEventWithMultipleRowsSelectedAndItHasEditableColumns.
@Test
public void testOnDecisionTableSelectedEventWithMultipleRowsSelectedAndItHasEditableColumns() {
model.getConditions().add(makePattern52());
model.getData().add(makeDTCellValue52List());
model.getData().add(makeDTCellValue52List());
uiModel.selectCells(0, 2, 1, 2);
builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.
the class RowContextMenuTest method testOnDecisionTableSelectedEventReadOnly.
@Test
public void testOnDecisionTableSelectedEventReadOnly() {
dtPresenter.getAccess().setReadOnly(true);
menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
verify(view, times(1)).enableCutMenuItem(eq(false));
verify(view, times(1)).enableCopyMenuItem(eq(false));
verify(view, times(1)).enablePasteMenuItem(eq(false));
verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
verify(view, times(1)).enableDeleteRowMenuItem(eq(false));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.
the class RowContextMenuTest method testOnDecisionTableSelectedEventWithMultipleRowsSelected.
@Test
public void testOnDecisionTableSelectedEventWithMultipleRowsSelected() {
model.getData().add(new ArrayList<DTCellValue52>() {
{
add(new DTCellValue52(1));
add(new DTCellValue52("descr"));
add(new DTCellValue52("md"));
}
});
model.getData().add(new ArrayList<DTCellValue52>() {
{
add(new DTCellValue52(1));
add(new DTCellValue52("descr"));
add(new DTCellValue52("md"));
}
});
uiModel.selectCells(0, 2, 1, 2);
menu.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
verify(view, times(1)).enableCutMenuItem(eq(true));
verify(view, times(1)).enableCopyMenuItem(eq(true));
verify(view, times(1)).enablePasteMenuItem(eq(false));
verify(view, times(1)).enableInsertRowAboveMenuItem(eq(false));
verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkRefreshDocument.
@Test
public void checkRefreshDocument() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
presenter.onStartup(path, placeRequest);
verify(view, times(1)).showLoading();
verify(dtService, times(1)).loadContent(eq(path));
verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
verify(view, times(1)).hideBusyIndicator();
final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
assertNotNull(dtSelectedEvent);
assertTrue(dtSelectedEvent.getPresenter().isPresent());
assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
when(dtPresenter.getCurrentPath()).thenReturn(path);
when(presenter.getKieEditorWrapperMultiPage()).thenReturn(pageEditor);
presenter.refreshDocument(dtPresenter);
verify(view, times(2)).showLoading();
verify(dtService, times(2)).loadContent(eq(path));
verify(modeller, times(1)).refreshDecisionTable(eq(dtPresenter), eq(path), eq(placeRequest), eq(content), any(Boolean.class));
verify(presenter, times(1)).activateDocument(eq(dtPresenter));
verify(view, times(2)).hideBusyIndicator();
}
Aggregations