use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class RowContextMenuTest method testOnDecisionTableSelectedEventWithSelectionsWithClipboardPopulated.
@Test
public void testOnDecisionTableSelectedEventWithSelectionsWithClipboardPopulated() {
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);
clipboard.setData(new HashSet<Clipboard.ClipboardData>() {
{
add(new DefaultClipboard.ClipboardDataImpl(0, 2, model.getData().get(0).get(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(true));
verify(view, times(1)).enableInsertRowAboveMenuItem(eq(true));
verify(view, times(1)).enableInsertRowBelowMenuItem(eq(true));
verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class RowContextMenuTest method testOnDecisionTableSelectedEventWithSelections.
@Test
public void testOnDecisionTableSelectedEventWithSelections() {
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.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(true));
verify(view, times(1)).enableInsertRowBelowMenuItem(eq(true));
verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectedEventWithNonOtherwiseColumnSelectedAndItHasEditableColumnsAndItDoesNotHaveEditableColumns.
@Test
public void testOnDecisionTableSelectedEventWithNonOtherwiseColumnSelectedAndItHasEditableColumnsAndItDoesNotHaveEditableColumns() {
when(dtPresenter.hasEditableColumns()).thenReturn(false);
model.getMetadataCols().add(new MetadataCol52());
model.getData().add(makeDTCellValue52());
uiModel.selectCell(0, 2);
builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(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());
assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
verify(builder.miOtherwiseCell.getMenuItemView(), times(1)).setIconType(eq(null));
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithNonOtherwiseColumnSelectedAndItHasEditableColumns.
@Test
public void testOnDecisionTableSelectionsChangedEventWithNonOtherwiseColumnSelectedAndItHasEditableColumns() {
model.getMetadataCols().add(new MetadataCol52());
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());
assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
verify(builder.miOtherwiseCell.getMenuItemView(), times(1)).setIconType(eq(null));
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class EditMenuBuilderTest method testOnDecisionTableSelectedEventWithSelectionsWithClipboardPopulated.
@Test
public void testOnDecisionTableSelectedEventWithSelectionsWithClipboardPopulated() {
model.getMetadataCols().add(new MetadataCol52());
model.getData().add(makeDTCellValue52());
uiModel.selectCell(0, 2);
clipboard.setData(makeClipboardHashSetData());
builder.onDecisionTableSelectedEvent(new DecisionTableSelectedEvent(dtPresenter));
assertTrue(builder.miCut.getMenuItem().isEnabled());
assertTrue(builder.miCopy.getMenuItem().isEnabled());
assertTrue(builder.miPaste.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedCells.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedColumns.getMenuItem().isEnabled());
assertTrue(builder.miDeleteSelectedRows.getMenuItem().isEnabled());
assertFalse(builder.miOtherwiseCell.getMenuItem().isEnabled());
verify(builder.miOtherwiseCell.getMenuItemView(), times(1)).setIconType(eq(null));
}
Aggregations