Search in sources :

Example 21 with DecisionTableSelectionsChangedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.

the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithSelectionsWithClipboardPopulatedAndItHasEditableColumns.

@Test
public void testOnDecisionTableSelectionsChangedEventWithSelectionsWithClipboardPopulatedAndItHasEditableColumns() {
    model.getMetadataCols().add(new MetadataCol52());
    model.getData().add(makeDTCellValue52());
    uiModel.selectCell(0, 2);
    clipboard.setData(makeClipboardHashSetData());
    builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(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));
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) Test(org.junit.Test)

Example 22 with DecisionTableSelectionsChangedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.

the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithOtherwiseCellSelectedAndItHasEditableColumns.

@Test
public void testOnDecisionTableSelectionsChangedEventWithOtherwiseCellSelectedAndItHasEditableColumns() {
    model.getConditions().add(makePattern52());
    model.getData().add(makeDTCellValue52ListWithOtherwise());
    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(IconType.CHECK));
}
Also used : DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) Test(org.junit.Test)

Example 23 with DecisionTableSelectionsChangedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent in project drools-wb by kiegroup.

the class EditMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithOtherwiseCellSelectedAndItDoesNotHaveEditableColumns.

@Test
public void testOnDecisionTableSelectionsChangedEventWithOtherwiseCellSelectedAndItDoesNotHaveEditableColumns() {
    when(dtPresenter.hasEditableColumns()).thenReturn(false);
    model.getConditions().add(makePattern52());
    model.getData().add(makeDTCellValue52ListWithOtherwise());
    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(IconType.CHECK));
}
Also used : DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) Test(org.junit.Test)

Aggregations

DecisionTableSelectionsChangedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent)23 Test (org.junit.Test)22 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)8 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)5 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)1 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)1 GuidedDecisionTableUiModel (org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel)1 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)1