edvin
10/07/2018, 9:27 PMamanda.hinchman-dominguez
10/07/2018, 9:27 PMScopes provide a way to make a View or Controller unique to a smaller subset of instances in your application.
mattmoore
10/07/2018, 9:27 PMamanda.hinchman-dominguez
10/07/2018, 9:27 PMmattmoore
10/07/2018, 9:27 PMedvin
10/07/2018, 9:28 PMmattmoore
10/07/2018, 9:28 PMval chicagoansScope = people.filter { it.city == 'Chicago' }
edvin
10/07/2018, 9:29 PMCustomerList
displays customers. You double click a Customer in the TableView and wrap a CustomerModel
around the selected customer and put it into a new scope. Then you open a CustomerEditor
in the context of that new scope with find<CustomerEditor>(Scope(customerModel))
and now the CustomerEditor
can access the customer model using val customer: CustomerModel by inject()
.edvin
10/07/2018, 9:30 PMCustomerEditors
as you want, and as long as you create a new scope for each, they will only see the data you put into their scope, so that data is effectively local to them.edvin
10/07/2018, 9:31 PMCustomerEditor
is built up of for example five smaller UI elements, for example CustomerAddressEditor
, CustomerContactsList
etc.amanda.hinchman-dominguez
10/07/2018, 9:31 PMedvin
10/07/2018, 9:31 PMedvin
10/07/2018, 9:31 PMamanda.hinchman-dominguez
10/07/2018, 9:32 PMamanda.hinchman-dominguez
10/07/2018, 9:32 PMmattmoore
10/07/2018, 9:32 PMamanda.hinchman-dominguez
10/07/2018, 9:32 PMmattmoore
10/07/2018, 9:32 PMedvin
10/07/2018, 9:32 PMmattmoore
10/07/2018, 9:32 PMamanda.hinchman-dominguez
10/07/2018, 9:33 PMedvin
10/07/2018, 9:33 PMComponent
, like View
, Fragment
and Controller
, inherit whatever scope they were looked up in, so you normally don't need to mention the scope after looking up the "root" of your tree of elements.edvin
10/07/2018, 9:34 PMmattmoore
10/07/2018, 9:34 PMedvin
10/07/2018, 9:34 PMamanda.hinchman-dominguez
10/07/2018, 9:35 PMamanda.hinchman-dominguez
10/07/2018, 9:35 PMedvin
10/07/2018, 9:36 PMmattmoore
10/07/2018, 9:36 PMamanda.hinchman-dominguez
10/07/2018, 9:37 PM