AsyncImageTileHolder

Constructors

Link copied to clipboard
constructor(id: String, tile: AsyncImageTileSchema, events: MutableList<EventHolder<*>>, tiles: MutableList<TileHolder<*>>? = null)

Properties

Link copied to clipboard
open override val id: String

Id of this tile — how TilesEditor/TilesEventDispatcher/GetData's Tile data source address it by id, and what an ancestor's getTileHolder/getEventHolder search for.

Functions

Link copied to clipboard
fun addChild(child: TileHolder<*>, where: InsertionPosition = InsertionPosition.End)

Inserts child into this tile's tiles at the position resolved by where — a no-op if this holder has no children list at all (tiles == null, i.e. it's a leaf tile). The mechanism behind AddTiles targeting this tile as groupingTileId. Does not itself mark this holder dirty or trigger a state update — callers (TilesManager.addTile/addTiles) do that explicitly right after.

Link copied to clipboard
fun addChildren(children: List<TileHolder<*>>, where: InsertionPosition = InsertionPosition.End)

Same as addChild, for several children inserted together at the same position, preserving children's own order.

Link copied to clipboard

Returns this tile's current T snapshot — the schema that gets serialized back to the client's UI state and, ultimately, the network. Re-derives via getTileSchema and clears the dirty flag when isDirty is true; otherwise returns the cached tile unchanged, avoiding a full subtree walk on every read.

Link copied to clipboard

Number of direct children currently in tiles — the mechanism behind GetTileChildrenCount.

Link copied to clipboard
open fun getEventHolder(eventId: String): EventHolder<*>?

Searches this tile's own events (then, recursively, tiles' own events) for the EventHolder whose id equals eventId — the lookup behind TriggerEvent/UpdateEvents.

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

Collects every EventSchema in this subtree — this tile's own events first, then every descendant tile's — whose trigger equals eventTrigger. Used by EventManager.triggerEvents by way of TilesEventHolder.getEventsByTrigger, the mechanism behind screen-level triggers like onDisplay() reaching every matching event anywhere in the tree, not just top-level ones.

Link copied to clipboard
open fun getTileHolder(tileId: String, includeEventsOnSearch: Boolean = false): TileHolder<*>?

Searches this holder's own subtree (this tile, then depth-first through tiles) for the TileHolder whose id equals tileId.

Link copied to clipboard

Collects every TileHolder in this subtree (this one, then recursively through tiles) whose handlesGroupEvent returns true for event — the traversal behind TileRenderingScope.dispatchGroupEvent, which is how RadioButton's mutual exclusion reaches every radio button sharing a groupId regardless of where each one sits in the tree.

Link copied to clipboard

Whether this holder should react to event when it's broadcast via TileRenderingScope.dispatchGroupEvent. The default implementation never matches anything — override it (typically with a type check against your own TileGroupEvent subtype, optionally comparing a group-identifying field) on a TileHolder that participates in a group concern.

Link copied to clipboard
fun hasChildren(childrenIds: List<String>): Boolean

Whether every id in childrenIds is currently present among this tile's direct tiles — the mechanism behind CheckIfTileContainsChildren. An empty tiles (or a holder with no children list at all) only satisfies this for an empty childrenIds.

Link copied to clipboard
open fun isDirty(): Boolean

Whether this holder — or any descendant tile or event holder — has been markAsDirty'd since it was last read via get. Dirtiness propagates upward: a change deep in the tree marks every ancestor dirty too, the next time each one is asked.

Link copied to clipboard

Marks this holder as needing its schema re-derived the next time get is called, instead of returning the cached tile as-is. Every mutating operation on a holder (a child added/removed, update applied, onTileEvent/onTileGroupEvent handled) calls this immediately after.

Link copied to clipboard

Applies event to this tile's local, in-memory state — the local half of a stateful tile's interaction, invoked synchronously via TileRenderingScope.dispatchEvent. The default implementation does nothing; override it on a TileHolder whose tile carries local state (checked/selected/text/etc.), pattern-matching on your own TileEvent subtype and mutating tile directly (tile = tile.copy(...)) — see CheckboxTileHolder.onTileEvent for the canonical example. This runs on the UI thread and completes before recomposition, which is why it always visually settles before whatever remote EventTrigger fired alongside it (via TileRenderingScope.triggerEvent) has a chance to run.

Link copied to clipboard

Applies event to this tile's local state as part of a group-wide broadcast — invoked only on holders whose handlesGroupEvent returned true for the same event, via TileRenderingScope.dispatchGroupEvent. The default implementation does nothing; override it alongside handlesGroupEvent on a TileHolder that participates in a mutual-exclusion-style group (the way RadioButton clears every other radio button sharing its groupId).

Link copied to clipboard

Exposes a value this tile currently holds, addressed by key — the mechanism behind the Tile data source (tile(tileId, dataKey) in the server DSL), read by GetData/EvaluateData. The default implementation exposes nothing (null); override it on a TileHolder whose tile has a value worth reading this way (see CheckboxTileHolder, which exposes mapOf(key to tile.checked)key is ignored there since a checkbox only ever has one value to expose, but a tile with several distinct values would branch on it).

Link copied to clipboard

Removes the child in tiles whose id equals id — a no-op if this holder has no children list, or if no child carries that id. The mechanism behind RemoveTiles targeting a single id under this tile as groupingTileId.

Link copied to clipboard

Same as removeChild, for every child whose id is in ids.

Link copied to clipboard
fun UpdateScope.update(updateData: Map<String, Any?>)

Applies updateData as a shallow JSON-patch merge onto this tile's current tile, the mechanism behind UpdateTiles. style is handled as its own nested merge (a patch under the "style" key is merged onto the current style object specifically, rather than replacing it wholesale) — every other top-level key in updateData simply overwrites the matching key on the encoded tile object. The merged JSON is then decoded back into a fresh T instance via the framework's dev.catbit.mosaic.core.serialization.MosaicSerializer, which is why an update that would leave the tile in an undecodable shape (e.g. a required field turned into the wrong JSON type) fails and is logged rather than partially applied.

Link copied to clipboard

Removes every child from tiles — a no-op if this holder has no children list. The mechanism behind WipeTiles, and the first step of ReplaceTiles before the new children are added.