use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationPropertyConverter method dmnFromWB.
public static org.kie.dmn.model.v1_1.Relation dmnFromWB(final Relation wb) {
org.kie.dmn.model.v1_1.Relation result = new org.kie.dmn.model.v1_1.Relation();
result.setId(wb.getId().getValue());
result.setDescription(wb.getDescription().getValue());
QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
for (InformationItem iitem : wb.getColumn()) {
org.kie.dmn.model.v1_1.InformationItem iitemConverted = InformationItemPropertyConverter.dmnFromWB(iitem);
result.getColumn().add(iitemConverted);
}
for (org.kie.workbench.common.dmn.api.definition.v1_1.List list : wb.getRow()) {
org.kie.dmn.model.v1_1.List listConverted = ListPropertyConverter.dmnFromWB(list);
result.getRow().add(listConverted);
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationGridTest method testDeleteColumn.
@Test
public void testDeleteColumn() throws Exception {
relation.getColumn().add(new InformationItem());
setupGrid(0);
// Cannot delete column 0 since it is the RowNumber column. The first Relation column is 1.
grid.deleteColumn(RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
verify(sessionCommandManager).execute(eq(canvasHandler), deleteColumnCommand.capture());
deleteColumnCommand.getValue().execute(canvasHandler);
verify(parent).proposeContainingColumnWidth(grid.getWidth() + grid.getPadding() * 2);
verify(parentGridColumn).setWidth(grid.getWidth() + grid.getPadding() * 2);
verify(gridLayer).batch(any(GridLayerRedrawManager.PrioritizedCommand.class));
verify(gridPanel).refreshScrollPosition();
verify(gridPanel).updatePanelSize();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationGridTest method testOnItemSelectedDeleteColumn.
@Test
public void testOnItemSelectedDeleteColumn() {
relation.getColumn().add(new InformationItem());
setupGrid(0);
// Cannot delete column 0 since it is the RowNumber column. The first Relation column is 1.
final java.util.List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
final HasListSelectorControl.ListSelectorTextItem ti = (HasListSelectorControl.ListSelectorTextItem) items.get(DELETE_COLUMN);
grid.onItemSelected(ti);
verify(cellEditorControls).hide();
verify(grid).deleteColumn(eq(1));
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationUIModelMapperHelperTest method testGetSectionInformationItemColumnIndexEqualToColumnCount.
@Test(expected = IllegalArgumentException.class)
public void testGetSectionInformationItemColumnIndexEqualToColumnCount() {
relation.getColumn().add(new InformationItem());
assertEquals(RelationSection.INFORMATION_ITEM, getInformationItemIndex(relation, relation.getColumn().size() + 1));
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationUIModelMapperHelperTest method testGetSectionInformationItemColumnNegativeIndex.
@Test(expected = IllegalArgumentException.class)
public void testGetSectionInformationItemColumnNegativeIndex() {
relation.getColumn().add(new InformationItem());
assertEquals(RelationSection.INFORMATION_ITEM, getInformationItemIndex(relation, -1));
}
Aggregations