Search in sources :

Example 26 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ImportsWidgetViewImpl method setup.

private void setup() {
    // Setup table
    table.setStriped(true);
    table.setCondensed(true);
    table.setBordered(true);
    table.setEmptyTableWidget(new Label(ImportConstants.INSTANCE.noImportsDefined()));
    // Columns
    final TextColumn<Import> importTypeColumn = new TextColumn<Import>() {

        @Override
        public String getValue(final Import importType) {
            return importType.getType();
        }
    };
    deleteImportColumn.setFieldUpdater((index, importType, value) -> {
        if (isReadOnly) {
            return;
        }
        final YesNoCancelPopup confirm = YesNoCancelPopup.newYesNoCancelPopup(ImportConstants.INSTANCE.remove(), ImportConstants.INSTANCE.promptForRemovalOfImport0(importType.getType()), () -> getRemoveImportCommand().execute(importType), () -> {
        /*Nothing*/
        }, null);
        confirm.show();
    });
    table.addColumn(importTypeColumn, new TextHeader(ImportConstants.INSTANCE.importType()));
    table.addColumn(deleteImportColumn, ImportConstants.INSTANCE.remove());
    // Link data
    getDataProvider().addDataDisplay(table);
    getDataProvider().setList(importTypes);
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Label(org.gwtbootstrap3.client.ui.Label) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup) TextHeader(com.google.gwt.user.cellview.client.TextHeader) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 27 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ImportsWidgetPresenterTest method isInternalImportExternalImportType.

@Test
public void isInternalImportExternalImportType() {
    final Imports imports = new Imports();
    final Import importType = new Import("External1");
    imports.addImport(importType);
    presenter.setContent(dmo, imports, false);
    assertFalse(presenter.isInternalImport(importType));
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Imports(org.kie.soup.project.datamodel.imports.Imports) Test(org.junit.Test)

Example 28 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ImportsWidgetPresenterTest method testOnImportRemoved.

@Test
public void testOnImportRemoved() {
    final Imports imports = new Imports();
    imports.addImport(new Import("Internal1"));
    presenter.setContent(dmo, imports, false);
    presenter.onRemoveImport(new Import("Internal1"));
    verify(view, times(2)).updateRenderedColumns();
    assertEquals(0, imports.getImports().size());
    verify(dmo).filter();
    verify(importRemovedEvent, times(1)).fire(importRemovedEventCaptor.capture());
    assertEquals("Internal1", importRemovedEventCaptor.getValue().getImport().getType());
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Imports(org.kie.soup.project.datamodel.imports.Imports) Test(org.junit.Test)

Example 29 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ImportsWidgetPresenterTest method isInternalImportInternalImportType.

@Test
public void isInternalImportInternalImportType() {
    final Imports imports = new Imports();
    final Import importType = new Import("Internal1");
    imports.addImport(importType);
    presenter.setContent(dmo, imports, false);
    assertTrue(presenter.isInternalImport(importType));
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Imports(org.kie.soup.project.datamodel.imports.Imports) Test(org.junit.Test)

Example 30 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ImportsWidgetPresenterTest method testOnImportAddedExternal.

@Test
public void testOnImportAddedExternal() {
    final Imports imports = new Imports();
    presenter.setContent(dmo, imports, false);
    presenter.onAddImport(new Import("org.pkg1.External1"));
    verify(view, times(2)).updateRenderedColumns();
    assertEquals(1, imports.getImports().size());
    assertContains("org.pkg1.External1", imports.getImports());
    assertNotContains("org.pkg1.External1", presenter.getExternalFactTypes());
    verify(dmo).filter();
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Imports(org.kie.soup.project.datamodel.imports.Imports) Test(org.junit.Test)

Aggregations

Import (org.kie.soup.project.datamodel.imports.Import)103 Test (org.junit.Test)79 Imports (org.kie.soup.project.datamodel.imports.Imports)26 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)25 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)14 ArrayList (java.util.ArrayList)12 Path (org.uberfire.java.nio.file.Path)12 Query (org.apache.lucene.search.Query)11 FactData (org.drools.workbench.models.testscenarios.shared.FactData)11 VerifyFact (org.drools.workbench.models.testscenarios.shared.VerifyFact)11 BaseIndexingTest (org.kie.workbench.common.services.refactoring.backend.server.BaseIndexingTest)11 SingleTermQueryBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder)11 VerifyField (org.drools.workbench.models.testscenarios.shared.VerifyField)10 FieldData (org.drools.workbench.models.testscenarios.shared.FieldData)9 KieSession (org.kie.api.runtime.KieSession)9 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)9 ValueReferenceIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm)9 Path (org.uberfire.backend.vfs.Path)9 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)8 Analyzer (org.drools.verifier.core.main.Analyzer)7