TilesManager

Constructors

Link copied to clipboard
constructor(parent: TilesManager?, tileHolderBuilderManager: TileHolderBuilderManager, eventHolderBuilderManager: EventHolderBuilderManager, serializer: MosaicSerializer, koinScope: Scope)

Functions

Link copied to clipboard
open override fun addBottomSheet(id: String, isCancellable: Boolean, fill: Boolean, allowsPartialExpansion: Boolean, tileSchemas: List<TileSchema>): Result<Unit>

Shows a non-modal bottom sheet built from tileSchemas, registered under id so a later dismissBottomSheet call can target it.

Link copied to clipboard
open override fun addDialog(id: String, isCancellable: Boolean, usePlatformDefaultWidth: Boolean, tileSchemas: List<TileSchema>): Result<Unit>

Shows a dialog built from tileSchemas, registered under id.

Link copied to clipboard
open override fun addModalBottomSheet(id: String, isCancellable: Boolean, fill: Boolean, allowsPartialExpansion: Boolean, tileSchemas: List<TileSchema>): Result<Unit>

Shows a modal bottom sheet built from tileSchemas, registered under id — unlike addBottomSheet, this dims and blocks the content behind it.

Link copied to clipboard
open override fun addTile(tileSchema: TileSchema, where: InsertionPosition): Result<Unit>

Inserts tileSchema as a new top-level child of the screen's own root tile.

open override fun addTile(tileSchema: TileSchema, groupingTileId: String, where: InsertionPosition): Result<Unit>

Inserts tileSchema as a new child of the container tile identified by groupingTileId, wherever that container currently is in the tree.

Link copied to clipboard
open override fun addTiles(tileSchemas: List<TileSchema>, where: InsertionPosition): Result<Unit>

Same as addTile, for several tiles inserted together at the same position, preserving tileSchemas' own order.

open override fun addTiles(tileSchemas: List<TileSchema>, groupingTileId: String, where: InsertionPosition): Result<Unit>

Same as the groupingTileId overload of addTile, for several tiles inserted together.

Link copied to clipboard
open override fun checkIfTileHasChildren(groupingTileId: String, childrenIds: List<String>): Boolean

Whether every id in childrenIds is currently a direct child of the container tile identified by groupingTileId — the mechanism behind CheckIfTileContainsChildren. Unlike the other methods on this interface, this doesn't fail when groupingTileId isn't found; it simply returns false.

Link copied to clipboard
open override fun dismissBottomSheet(id: String): Result<Unit>

Closes the non-modal bottom sheet registered under id, starting its two-phase dismissal animation.

Link copied to clipboard
open override fun dismissDialog(id: String): Result<Unit>

Closes the dialog registered under id. Unlike the bottom sheet variants, this resolves without waiting for an exit animation.

Link copied to clipboard
open override fun dismissModalBottomSheet(id: String): Result<Unit>

Closes the modal bottom sheet registered under id, starting its two-phase dismissal animation.

Link copied to clipboard
Link copied to clipboard
open override fun getEventsByTrigger(eventTrigger: EventTrigger): List<EventSchema>

Every EventSchema currently registered anywhere in this screen's tile tree whose trigger equals eventTrigger.

Link copied to clipboard
open override fun getEventSchema(eventId: String): EventSchema?

Looks up the EventSchema registered under eventId anywhere in the screen's tile tree — the lookup behind TriggerEvent.

Link copied to clipboard
open override fun getTileChildrenCount(groupingTileId: String): Int?

Number of direct children currently under the container tile identified by groupingTileId — the mechanism behind GetTileChildrenCount.

Link copied to clipboard
fun getTileHolderAndOwner(tileId: String, includeEventsOnSearch: Boolean = false): Pair<TileHolder<*>, TilesManager>?
Link copied to clipboard
open override fun getValueWithKey(tileId: String, key: String): Map<String, Any>?

Looks up the TileHolder whose id equals tileId and asks it for the value it exposes under key, via that holder's own produceValueWithKey override.

Link copied to clipboard
open override fun onEvent(tileId: String, event: TileEvent): Result<Unit>

Delivers event to the TileHolder whose id equals tileId, via that holder's own onTileEvent override — the routing behind dev.catbit.mosaic.client.ui.sdui.foundation.tiles.renderer.TileRenderingScope.dispatchEvent.

Link copied to clipboard
open override fun onGroupEvent(event: TileGroupEvent): Result<Unit>

Delivers event to every TileHolder in the whole screen's tree whose handlesGroupEvent returns true for it, via each one's own onTileGroupEvent override — the routing behind dev.catbit.mosaic.client.ui.sdui.foundation.tiles.renderer.TileRenderingScope.dispatchGroupEvent.

Link copied to clipboard
open override fun removeTile(tileId: String): Result<Unit>

Removes the top-level root tile whose id equals tileId.

open override fun removeTile(tileId: String, groupingTileId: String): Result<Unit>

Removes the child whose id equals tileId from the container tile identified by groupingTileId.

Link copied to clipboard
open override fun removeTiles(tileIds: List<String>): Result<Unit>

Removes every top-level root tile whose id is in tileIds.

open override fun removeTiles(tileIds: List<String>, groupingTileId: String): Result<Unit>

Removes every child whose id is in tileIds from the container tile identified by groupingTileId.

Link copied to clipboard
open override fun replaceTiles(tileSchemas: List<TileSchema>): Result<Unit>

Replaces every top-level root tile with tileSchemas — the current root children are wiped first, then tileSchemas is added in full.

open override fun replaceTiles(tileSchemas: List<TileSchema>, groupingTileId: String): Result<Unit>

Replaces every child of the container tile identified by groupingTileId with tileSchemas — that container's current children are wiped first, then tileSchemas is added in full.

Link copied to clipboard
fun setup(tiles: ImmutableList<TileSchema>, navigationDrawerTiles: ImmutableList<TileSchema>? = null, events: ImmutableList<EventSchema>?, onUpdateStateRequest: (TileSchema) -> Unit, state: ScreenTileSchema.State)
Link copied to clipboard
open override fun updateEventHolder(eventId: String, data: Map<String, Any?>): Result<Unit>

Applies data as a shallow JSON-patch merge onto the event registered under eventId — the mechanism behind UpdateEvents, the event-level equivalent of TilesEditor.updateTile.

Link copied to clipboard
open override fun updateState()

Re-reads the current root tile schema (via get() on the screen's holder) and pushes it to the screen's own state — called after every mutating TilesEditor/TilesOverlaysEditor/ TilesEventDispatcher operation succeeds, so its effect actually reaches Compose.

Link copied to clipboard
open override fun updateTile(tileId: String, updateData: Map<String, Any?>): Result<Unit>

Applies updateData as a shallow JSON-patch merge onto the tile identified by tileId — see dev.catbit.mosaic.client.ui.sdui.foundation.tiles.holder.tile.TileHolder.update for exactly how the merge (and the special handling of a "style" patch) works. The lookup also searches inside event holders' own nested tiles, not just the plain tile tree.

Link copied to clipboard
open override fun wipeTiles(groupingTileId: String): Result<Unit>

Removes every child of the container tile identified by groupingTileId, leaving it empty.