Change By: Tobias Mattsson (15/Jan/15 10:56 AM)
Description: In methods annotated with @DialogFactory its possible to decide wether to add a tab based on custom logic. You can also do post processing of the dialog as a final step after everything has been added and modify it as you please.

In classes annotated with @DialogFactory and classes for templates, areas and components this is not possible since they only have @TabFactory annotated methods that are called to add tabs. These methods are always called and there's no way to decide that the tab shouldn't be added. There's also no way to do post processing.

A post create callback should be added that allows for adding tabs conditionally, removing tabs added by @TabFactory methods or do arbitrary changes to the dialog.

The annotation used to denote callback methods should be @PostCreate.

The callback should get access to:

* Item that is being used by the UI
* Node that is being edited / created
* DialogCreationContext used by Blossom for this dialog
* DialogBuilder used by Blossom to allow for easy operation on the dialog
* ConfiguredFormDialogDefinition to directly modify the definition
* UiConfig to create new fields etc
* DamConfig to create new DAM fields (only if DAM is present)

Requirements on invocation order:

* A callback declared in a class must be invoked after all @TabFactory methods declared in that class have been invoked.
* To allow for extension and customization of these classes invocations must be performed one class at a time starting with the topmost super class and then down the class hierarchy to the lowest level subclass.
* Multiple callbacks on the same class should work although their order of invocation can not be guaranteed.
* Overriding methods that don't repeat the @PostCreate will not be invoked (and neither will the method it overrides obviously).
* An overriding method should be invoked in place of the overridden method. I.e: a method defined in a base class that overrides a method in a super class should be invoked when the super class is processed.
* Callbacks should be called after @TabFactory methods in the same class and before @TabFactory methods in an inheriting class.

It is an error to use @PostCreate on static methods.
It is an error to use @PostCreate and @TabBuilder on the same method.

Note that this changes the current invocation order of @TabFactory methods, they're currently invoked in class hierarchy bottom-up order.

Additionally, Blossom should prepare the dialog as much as possible before invoking @TabFactory and @PostCreate methods. I.e: setting i18nBasename and label earlier so it can be changed in the callbacks.

How interaction with the @TabOrder
 annotation  and @I18nBasename annotations  should work needs to be decided.  Could be useful to apply them for each class in hierarchy.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to