DataReactor Framework

1.Objective

    When editing data, the relationships between controls are usually similar or fixed. For example, in the data edit UI, when a record is selected in the table, the Edit button becomes available, and when no record is selected in the table, the Edit button becomes unavailable.

    Since there are some fixed relationships between controls when processing data, can we find a way to simplify the interface of writing and processing data? The DataReactor framework can solve this problem.

2.Realization principle

    DataReactor is realized by listening to the change of data. For example, when the Edit button listens that data is selected, it becomes available. If no data is selected, it becomes unavailable.

    Currently, you can listen to the following events:

  • Datas added
  • Datas updated
  • Datas removed
  • Datas selected
  • Unselected
  • Datas loaded

3.Event response chain

     An object that can listen for data changes is called a DataReactor. A DataReactor can accept or send events. When the event is sent, it will be passed to the next DataReactors, which can process the event or start a new event, thus forming the event response chain.

4.Example

    The following video is an example of a browser, where urlText is used to enter the address, browser is used to display the web page, and the rule of data response is urlText > browser.

 

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号