Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The issues are briefly summarised in 

Jira
serverMagnolia - Issue tracker
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId500b06a6-e204-3125-b989-2d75b973d05f
keyMGNLUI-3490
. This  and aggregated under
Jira
serverMagnolia - Issue tracker
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId500b06a6-e204-3125-b989-2d75b973d05f
keyMGNLUI-3491
 epic.  This page aims to provide a bit more details and possible ways to improve the situation.

...

  • FormView should become clearable - i.e. all fields should be easily removed.
  • FormBuilder#buildForm() once again.

Support locale

 

What to do (initial thoughts)

Default value/read-only state

...

  • Transformer object could get additional methods on the interface (e.g. get/setReadonly() and get/setDefaultValue())
  • Then transformer could resolve read-only state based on additional info coming from the underlying item (i.e. would still claim it's read-only if the item it is connected to cannot be modified).
  • Transformer would also be capable of setting a default value for any property it creates.

Use authoring locale when generating fields. Since we now track the current authoring locale at least in SubAppContext (would probably make sense to propagate it to whole UIContext) - that is also not hard to implement:

  • Inject SubAppContext/UiContext into FieldFactories, set authoring locale to property transformers and fields themselves. 

Refactor transformers and TransformedProperty. The most sensitive part (esp. with multi/composite transformers):

  • Transfomers should now assume they work with just one locale - no need to be able to track several locales all at once.
  • Simplify i18n support:
    • BasicTransformer#i18NPropertyName becomes unnecessary - we don't need to set it externally, we can inject I18NAuthroingSupport and generate i18n-aware property name via it internally.

    • TransformedProperty's i18n-related methods (hasI18NSupport and fireI18nValueChange) become also redundant since TransformedProperties will be regenerated.

    • For read-only state support: add read-only state setter/getter to Transformer interface and make TransformedProperty delegate to it:

      @Override
      public boolean isReadOnly() {
      return super.isReadOnly() && transformer.isReadOnly();
      }
    • Delegating transformers should adapt to one locale case:

      • i.e. DelegatingMultiValueFieldTransformer#items which tracks separate items for all locales - should be replaced with a single item for the current locale.
      • TBD: research and prove with PoC.

Other consequences:

  • DefaultI18NAuthoringSupport#i18nize() wouldn't be needed any longer - all the ugliness could go away.

  • Default values and read-only states would be much better and logically respected during locale changes since FieldFactories would re-apply those on form re-generation.

Effort source:

https://git.magnolia-cms.com/gitweb/?p=magnolia_ui.git;a=shortlog;h=refs/heads/refactor/MGNLUI-3490

...