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);
}
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));
}
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());
}
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));
}
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();
}
Aggregations