qmathe@club-internet.fr)Handling of Mutations on Layout Item Tree, Model Graph and Source.
- Declared in:
- ETLayoutItemGroup+Mutation.h
All model mutations are triggered by implicit or explicit remove/insert/add in the layout item tree. Implicit mutations are done by the framework unlike explicit ones which are located in your code. These implicit mutations are triggered by a first explicit mutation, the only one that needs to be propagated to the model side.
The only case of implicit mutation is presently
add/insert that may trigger a remove. If a
layout item is moved to a new parent item on insert
or add, and this new parent that differs from the
existing parent, the new parent will require that
the item to be inserted removes itself from its
existing parent, before truly inserting it.
See -[ETLayoutItemGroup handleAttachItem:],
-[ETLayoutItemGroup handleDetachItem:]
and
-isCoalescingModelMutation
. Take note, you can induce implicit mutations in your
code if you write a subclass for ETLayoutItem (or
other related subclasses) and you call methods like
-addItem
, removeItem:,
-insertItem:atIndex:
etc.
Signals model mutations must be discarded until -endCoalescingModelMutation gets called.
@taskunit Autoboxing
Returns the object boxed into a layout item if needed.
If the object is a valid item, no boxing occurs and the item object is returned as is, otherwise the returned item uses the object as a represented object.
When boxingForced is YES,
the boxing occurs in all cases, if the
object is an item, it is used as a
represented object bound to the
returned item.
Returns the object boxed into a layout item if needed.
If the object is a valid item, no boxing occurs and the item object is returned as is, otherwise the returned item uses the object as a represented object.
When boxingForced is YES,
the boxing occurs in all cases, if the
object is an item, it is used as a
represented object bound to the
returned item.
Signals model mutations must be handled normally by creating a model mutation for each layout item mutation.
@taskunit Mutation Actions
@taskunit Mutation Coordination
Returns whether children have been removed, added or inserted since the last layout update.
For example, returns YES when the
receiver has been reloaded but the layout hasn't
yet been updated.
Also returns
YES when autolayout is disabled and
the UI needs to be refreshed by calling
-updateLayout
.
Returns whether children have been removed, added or inserted since the last layout update.
For example, returns YES when the
receiver has been reloaded but the layout hasn't
yet been updated.
Also returns
YES when autolayout is disabled and
the UI needs to be refreshed by calling
-updateLayout
.
Returns whether no model mutations should happen on all represented objects bound to layout items. This is valid for represented objects at every levels in the layout item tree, in other words model mutations aren't just suspended for the receiver.
If the return value is YES, the mutation
handler method
-handleInsertItem:atIndex:
will skip calling
-mutateRepresentedObjectForInsertedItem:
until -endCoalescingModelMutation
has been called. This means a node added, removed or inserted into the layout item tree won't result in a collection change on the model side, for example a move into another collection for the represented object bound the node.
That's commonly used for preventing the propagation of the implicit removal from the existing parent item that occurs when a layout item is inserted/added to a new parent.
Returns whether an item is being inserted or removed among the receiver items (descendant items not being taken in account).
If -representedObjectDidUpdate is called back, the receiver must not be reloaded. To do so, -canReload checks -isMutating .
@taskunit Controller Coordination
Creates a new ETLayoutItem or ETLayoutItemGroup
object based on whether
object return NO or
YES to
-isCollection
. If isValue is equal to YES,
the given object is set as the value
rather than a represented object on the
item. See -[ETLayoutItem setValue:].
We delegate the item creation to the right template looked up in the receiver controller or the base item controller (no receiver controller). As a last resort (no base item controller), we use +[ETController basicTemplateProvider]. See -[ETItemTemplate newItemWithRepresentedObject:options:].
The returned object is autoreleased.
Creates a new ETLayoutItem or ETLayoutItemGroup
object based on whether
object return NO or
YES to
-isCollection
. If isValue is equal to YES,
the given object is set as the value
rather than a represented object on the
item. See -[ETLayoutItem setValue:].
We delegate the item creation to the right template looked up in the receiver controller or the base item controller (no receiver controller). As a last resort (no base item controller), we use +[ETController basicTemplateProvider]. See -[ETItemTemplate newItemWithRepresentedObject:options:].
The returned object is autoreleased.
@taskunit Model Mutation
Sets whether children have been removed, added or inserted since the last layout update.
Also invalidates any item-related caches (e.g. -arrangedItems).
-reload calls this method to indicate the layout needs to be updated, otherwise the UI won't reflect the latest receiver content.
Note: The receiver registers itself as an observer on the source object in -setSource: .
See also ETSourceDidUpdateNotification.