Search in sources :

Example 6 with DataType

use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.

the class DataTypeList method makeTreeListItems.

List<DataTypeListItem> makeTreeListItems(final DataType dataType, final int level) {
    final DataTypeListItem listItem = makeListItem();
    final List<DataType> subDataTypes = dataType.getSubDataTypes();
    final List<DataTypeListItem> gridItems = new ArrayList<>();
    listItem.setupDataType(dataType, level);
    gridItems.add(listItem);
    for (final DataType subDataType : subDataTypes) {
        gridItems.addAll(makeTreeListItems(subDataType, level + 1));
    }
    return gridItems;
}
Also used : ArrayList(java.util.ArrayList) DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType)

Example 7 with DataType

use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.

the class DataTypeList method importDataObjects.

public void importDataObjects(final List<DataObject> selectedDataObjects) {
    removeFullQualifiedNames(selectedDataObjects);
    for (final DataObject dataObject : selectedDataObjects) {
        final DataType newDataType = createNewDataType(dataObject);
        final Optional<DataType> existing = findDataTypeByName(dataObject.getClassType());
        if (existing.isPresent()) {
            replace(existing.get(), newDataType);
        } else {
            insert(newDataType);
        }
        insertProperties(dataObject);
    }
}
Also used : DataObject(org.kie.workbench.common.dmn.api.editors.types.DataObject) DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType)

Example 8 with DataType

use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.

the class DataTypeList method refreshItemsByUpdatedDataTypes.

void refreshItemsByUpdatedDataTypes(final List<DataType> updateDataTypes) {
    for (final DataType dataType : updateDataTypes) {
        findItem(dataType).ifPresent(listItem -> {
            listItem.refresh();
            refreshSubItemsFromListItem(listItem, dataType.getSubDataTypes());
        });
    }
    refreshDragAndDropList();
    refreshSearchBar();
}
Also used : DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType)

Example 9 with DataType

use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.

the class DataTypeListItem method insertFieldBelow.

public void insertFieldBelow() {
    closeEditMode();
    final DataType newDataType = newDataType();
    final String referenceDataTypeHash = insertFieldBelow(newDataType);
    enableEditModeAndUpdateCallbacks(getNewDataTypeHash(newDataType, referenceDataTypeHash));
}
Also used : DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType)

Example 10 with DataType

use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.

the class DataTypeListItem method insertFieldAbove.

public void insertFieldAbove() {
    closeEditMode();
    final DataType newDataType = newDataType();
    final String referenceDataTypeHash = insertFieldAbove(newDataType);
    enableEditModeAndUpdateCallbacks(getNewDataTypeHash(newDataType, referenceDataTypeHash));
}
Also used : DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType)

Aggregations

DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)274 Test (org.junit.Test)245 HTMLElement (elemental2.dom.HTMLElement)44 ItemDefinition (org.kie.workbench.common.dmn.api.definition.model.ItemDefinition)39 Element (elemental2.dom.Element)30 ArrayList (java.util.ArrayList)26 DOMTokenList (elemental2.dom.DOMTokenList)24 DataTypeListItem (org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItem)14 HTMLDivElement (elemental2.dom.HTMLDivElement)13 HTMLButtonElement (elemental2.dom.HTMLButtonElement)12 Command (org.uberfire.mvp.Command)12 FlashMessage (org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage)9 DataTypeManager (org.kie.workbench.common.dmn.client.editors.types.common.DataTypeManager)9 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)8 DNDListComponent (org.kie.workbench.common.dmn.client.editors.types.listview.draganddrop.DNDListComponent)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)7 HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)6 HTMLInputElement (elemental2.dom.HTMLInputElement)6 DataObject (org.kie.workbench.common.dmn.api.editors.types.DataObject)6