use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithOtherwiseColumnSelectedAndItHasEditableColumns.
@Test
public void testOnDecisionTableSelectionsChangedEventWithOtherwiseColumnSelectedAndItHasEditableColumns() {
model.getConditions().add(makePattern52());
model.getData().add(makeDTCellValue52());
uiModel.selectCell(0, 2);
builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
assertTrue(builder.miCut.getMenuItem().isEnabled());
assertTrue(builder.miCopy.getMenuItem().isEnabled());
assertFalse(builder.miPaste.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
assertTrue(builder.miOtherwiseCell.getMenuItem().isEnabled());
verify(builder.miOtherwiseCell.getMenuItemView(), times(1)).setIconType(eq(null));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithNoSelections.
@Test
public void testOnDecisionTableSelectionsChangedEventWithNoSelections() {
builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
assertFalse(builder.miCut.getMenuItem().isEnabled());
assertFalse(builder.miCopy.getMenuItem().isEnabled());
assertFalse(builder.miPaste.getMenuItem().isEnabled());
assertFalse(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
assertFalse(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
assertFalse(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithOtherwiseColumnSelectedAndItDoesNotHaveEditableColumns.
@Test
public void testOnDecisionTableSelectionsChangedEventWithOtherwiseColumnSelectedAndItDoesNotHaveEditableColumns() {
when(dtPresenter.hasEditableColumns()).thenReturn(false);
model.getConditions().add(makePattern52());
model.getData().add(makeDTCellValue52());
uiModel.selectCell(0, 2);
builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
assertTrue(builder.miCut.getMenuItem().isEnabled());
assertTrue(builder.miCopy.getMenuItem().isEnabled());
assertFalse(builder.miPaste.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
assertFalse(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
assertTrue(builder.miOtherwiseCell.getMenuItem().isEnabled());
verify(builder.miOtherwiseCell.getMenuItemView(), times(1)).setIconType(eq(null));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.
the class CellContextMenuTest method testOnDecisionTableSelectionsChangedEventWithSelections.
@Test
public void testOnDecisionTableSelectionsChangedEventWithSelections() {
model.getMetadataCols().add(new MetadataCol52());
model.getData().add(new ArrayList<DTCellValue52>() {
{
add(new DTCellValue52(1));
add(new DTCellValue52("descr"));
add(new DTCellValue52("md"));
}
});
uiModel.selectCell(0, 2);
menu.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(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)).enableDeleteCellMenuItem(eq(true));
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.
the class InsertMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithNoSelectionsAndItDoesNotHaveEditableColumns.
@Test
public void testOnDecisionTableSelectionsChangedEventWithNoSelectionsAndItDoesNotHaveEditableColumns() {
when(dtPresenter.hasEditableColumns()).thenReturn(false);
builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowAbove.getMenuItem().isEnabled());
assertFalse(builder.miInsertRowBelow.getMenuItem().isEnabled());
assertFalse(builder.miInsertColumn.getMenuItem().isEnabled());
}
Aggregations