use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeCreateHandler method insertSibling.
public List<DataType> insertSibling(final DataType dataType, final DataType reference, final CreationType creationType, final ItemDefinition itemDefinition) {
final Optional<DataType> parentOptional = lookupAbsoluteParent(reference);
if (parentOptional.isPresent()) {
final DataType parent = parentOptional.get();
final List<DataType> siblings = parent.getSubDataTypes();
final DataType updatedDataType = updateDataTypeProperties(dataType, parent.getUUID(), itemDefinition);
final DataType parentReference = findParentReference(reference, siblings);
siblings.add(siblings.indexOf(parentReference) + creationType.getIndexIncrement(), updatedDataType);
recordEngine.doUpdate(dataType, itemDefinition);
return recordEngine.update(parent);
} else {
final DataType updatedDataType = updateDataTypeProperties(dataType, reference.getParentUUID(), itemDefinition);
recordEngine.doUpdate(updatedDataType, itemDefinition);
return new ArrayList<>();
}
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSearchEngine method getStack.
private List<DataType> getStack(final List<DataType> stack, final DataType dataType) {
final DataType parent = parent(dataType);
stack.add(dataType);
if (dataType.isTopLevel() || Objects.isNull(parent)) {
return stack;
}
return getStack(stack, parent);
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeList method createNewDataType.
DataType createNewDataType(final DataObject dataObject) {
final DataType newDataType = dataTypeManager.fromNew().withType(dataTypeManager.structure()).get();
newDataType.setName(dataObject.getClassType());
return newDataType;
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeList method refreshSubItemsFromListItem.
void refreshSubItemsFromListItem(final DataTypeListItem listItem, final List<DataType> subDataTypes) {
final DataType dataType = listItem.getDataType();
final int level = listItem.getLevel();
final List<DataTypeListItem> listItems = new ArrayList<>();
for (final DataType subDataType : subDataTypes) {
listItems.addAll(makeTreeListItems(subDataType, level + 1));
}
final List<HTMLElement> children = listItems.stream().map(e -> e.getDragAndDropElement()).collect(Collectors.toList());
dndListComponent.setInitialPositionY(listItem.getDragAndDropElement(), children);
cleanAndUnIndex(dataType);
addNewSubItems(dataType, listItems);
listItems.forEach(this::reIndexDataTypes);
getItems().addAll(listItems);
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeList method createNewDataType.
DataType createNewDataType(final DataObjectProperty dataProperty) {
final DataType newDataType = dataTypeManager.fromNew().withType(dataProperty.getType()).asList(dataProperty.isList()).get();
newDataType.setName(dataProperty.getProperty());
return newDataType;
}
Aggregations