Component:DataFeedItemMapper
More actions

The DataFeedItemMapper allows you to define which data feed items map to which UI templates. It does this via the list Mappings, which take classes that extend DataFeedItem and If they match a mapping in the list it Duplicates that item's template and adds it into the list.
For more info on data feeds, see Data Feeds
Fields
| Name | Type | Description |
|---|---|---|
persistent
|
Bool | Determines whether or not this item will be saved to the server. |
UpdateOrder
|
Int | Controls the order in which this component is updated. |
Enabled
|
Bool | Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't. |
Mappings
|
list of DataFeedItemMapper.ItemMapping | A list of item Mappings to map data feed item types to Feed Templates. |
Sync Delegates
| Method Name | Method type and Arguments. | Is the method hidden? | Description |
|---|---|---|---|
OnSetupTemplate:ButtonEventHandler
|
ButtonEventHandler | ✓ | Set up a basic settup with this component with a bunch of example UIs. |
ItemMapping
| Name | Type | Description |
|---|---|---|
ItemType
|
direct SyncType | The type to map to a template. The type coming from a data feed will extend the abstract class DataFeedItem. |
GenericReplacementTypes
|
list of SyncType | If ItemType is a type that has generic single letter arguments, any components on the template that use generic types specified in this field will have those generic types replaced when the template is instantiated. See the Examples section below for clarification.
|
Template
|
FeedItemInterface | The template to duplicate when matched with this item mapping. |
Usage
This component is to be put into a Component:SingleFeedView or similar so that the component it is specified inside of can use this component to map incoming feed items from the data feed to UI or object templates.
Examples
The settings menu uses GenericReplacementTypes for it's Enum template. The ItemType is DataFeedEnum<E> (a generic definition), and GenericReplacementTypes has a single element with the type dummy. The template uses components with defined generic types (ie. SomeComponent<dummy>). If the DataFeed returns a DataFeedEnum<Chirality> item, the template will get duplicated, and all defined generics of dummy get replaced Chirality (making the aforementioned example become SomeComponent<Chirality>).[1]
For DataFeedItem's with multiple generic parameters, such as DataFeedQuantityField<Q, T>, specify multiple types in GenericReplacementTypes that correspond to the definition parameters in order.