Search in sources :

Example 6 with DecisionTableSelectionsChangedEvent

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

the class InsertMenuBuilderTest method testOnDecisionTableSelectionsChangedEventWithSingleRowSelectedAndItHasEditableColumns.

@Test
public void testOnDecisionTableSelectionsChangedEventWithSingleRowSelectedAndItHasEditableColumns() {
    model.getConditions().add(makePattern52());
    model.getData().add(makeDTCellValue52List());
    uiModel.selectCell(0, 2);
    builder.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(dtPresenter));
    assertTrue(builder.miAppendRow.getMenuItem().isEnabled());
    assertTrue(builder.miInsertRowAbove.getMenuItem().isEnabled());
    assertTrue(builder.miInsertRowBelow.getMenuItem().isEnabled());
    assertTrue(builder.miInsertColumn.getMenuItem().isEnabled());
}
Also used : DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) Test(org.junit.Test)

Example 7 with DecisionTableSelectionsChangedEvent

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

the class RowContextMenuTest method testOnDecisionTableSelectionsChangedEventWithMultipleRowsSelected.

@Test
public void testOnDecisionTableSelectionsChangedEventWithMultipleRowsSelected() {
    model.getConditions().add(new Pattern52() {

        {
            setFactType("Fact");
            getChildColumns().add(new ConditionCol52() {

                {
                    setFactType("Fact");
                    setFactField("field1");
                    setFieldType(DataType.TYPE_STRING);
                    setOperator("==");
                }
            });
        }
    });
    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.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)).enableInsertRowAboveMenuItem(eq(false));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(false));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 8 with DecisionTableSelectionsChangedEvent

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

the class RowContextMenuTest method testOnDecisionTableSelectionsChangedEventWithNoSelections.

@Test
public void testOnDecisionTableSelectionsChangedEventWithNoSelections() {
    menu.onDecisionTableSelectionsChangedEvent(new DecisionTableSelectionsChangedEvent(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));
}
Also used : DecisionTableSelectionsChangedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent) Test(org.junit.Test)

Example 9 with DecisionTableSelectionsChangedEvent

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

the class RowContextMenuTest 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)).enableInsertRowAboveMenuItem(eq(true));
    verify(view, times(1)).enableInsertRowBelowMenuItem(eq(true));
    verify(view, times(1)).enableDeleteRowMenuItem(eq(true));
}
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) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 10 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 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));
}
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)

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