diff --git a/ulyp-ui/src/main/kotlin/com/ulyp/ui/elements/recording/objects/RenderedCollection.kt b/ulyp-ui/src/main/kotlin/com/ulyp/ui/elements/recording/objects/RenderedCollection.kt index fe046c65..3e2e264a 100644 --- a/ulyp-ui/src/main/kotlin/com/ulyp/ui/elements/recording/objects/RenderedCollection.kt +++ b/ulyp-ui/src/main/kotlin/com/ulyp/ui/elements/recording/objects/RenderedCollection.kt @@ -2,6 +2,7 @@ package com.ulyp.ui.elements.recording.objects import com.ulyp.core.recorders.collections.CollectionRecord import com.ulyp.core.recorders.ObjectRecord +import com.ulyp.core.recorders.collections.CollectionType import com.ulyp.ui.RenderSettings import com.ulyp.ui.util.Style import com.ulyp.ui.util.StyledText.of @@ -11,7 +12,7 @@ import java.util.stream.Collectors class RenderedCollection(record: CollectionRecord, renderSettings: RenderSettings) : RenderedObject() { init { - val recordedObjects = record.recordedItems + val recordedObjects = record.elements .stream() .map { record: ObjectRecord -> of(record, renderSettings) } .collect(Collectors.toList()) @@ -23,7 +24,13 @@ class RenderedCollection(record: CollectionRecord, renderSettings: RenderSetting nodes.add(of(": ", Style.CALL_TREE_NODE_SEPARATOR)) } - nodes.add(of("{", Style.CALL_TREE_COLLECTION_BRACKET)) + when (record.collectionType) { + CollectionType.LIST -> nodes.add(of("[", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.SET -> nodes.add(of("{", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.QUEUE -> nodes.add(of("<", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.OTHER -> nodes.add(of("{", Style.CALL_TREE_COLLECTION_BRACKET)) + null -> nodes.add(of("{", Style.CALL_TREE_COLLECTION_BRACKET)) + } for (i in recordedObjects.indices) { @@ -41,7 +48,15 @@ class RenderedCollection(record: CollectionRecord, renderSettings: RenderSetting ) ) } - nodes.add(of("}", Style.CALL_TREE_COLLECTION_BRACKET)) + + when (record.collectionType) { + CollectionType.LIST -> nodes.add(of("]", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.SET -> nodes.add(of("}", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.QUEUE -> nodes.add(of(">", Style.CALL_TREE_COLLECTION_BRACKET)) + CollectionType.OTHER -> nodes.add(of("}", Style.CALL_TREE_COLLECTION_BRACKET)) + null -> nodes.add(of("}", Style.CALL_TREE_COLLECTION_BRACKET)) + } + children.addAll(nodes) } } \ No newline at end of file