Page History
...
Jira server Magnolia - Issue tracker columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 500b06a6-e204-3125-b989-2d75b973d05f key MGNLUI-2542
...
Mikaël Geljić publishes the AccessControlFieldUI sandbox
...
Mikaël Geljić files JIRA tickets for each standalone PoC
For examples of standalone prototype Vaadin applications, see:
- Vaadin + Magnolia sandbox, based on 5.5
- contains only the ACL fields & validation sample UI
- on branch v2: https://git.magnolia-cms.com/users/mgeljic/repos/vaadin-sandbox/commits?until=refs%2Fheads%2Fv2
- use this as a skeleton for the PoCs
- Pure Vaadin Sandbox (without Magnolia)
- contains many samples for various vaadin components & fields (grid, selects, theming, fieldgroups)
- on Mika's github repo: https://github.com/mkgl/vaadin-sandbox
1. Use cases
We need to support such dynamic forms in a much easier way. Collecting some commons requirements:
- populating select options based on the value of another field
- validating a field depending on the value of another field (including within a composite field itself)
- enabling/disabling fields conditionally
- potentially custom handling of any field, via plain Vaadin code
- updating form buttons (enabling/disabling/relabeling)
...
2. General directions & goals
- Exposing hooks on form-level
- currently only possible on field-level via
FieldFactories
- fields & factories are only aware about themselves, in isolation. They're not aware about other fields and this is harder to do than it should.
- currently only possible on field-level via
- Use more of Vaadin out of the box
- less customizations
- get rid of legacy Vaadin 6.x or client-side code
- Open up APIs to offer more possibilities (data-binding, or dynamic/ cross-field behaviors)
- Reduce technical debt
3. PoC phase
3. PoC phase
Goals
Validate several assumptions from Mika
- If all goes well, put it all together at the end, through an Integration phase
Process
- To be carried out by the VN Core Team
- Try to work in pairs (can still switch afterwards), or alternate between group phases and individual work/thinking
- Keep each PoC standalone until the end of the PoC phase
- Target date:
PoC #1: New FormPresenter
The PoC phase was conducted in September–October 2016. Refer to child-page Dynamic forms - PoC phase for details and outcome.
4. Productization phase
Based on the PoC results, we first collected the following tasks, in order to bring new forms on par with the current Magnolia forms.
F1. Formalize new Form APIs & Assess Configuration changes
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
|
Validate a high-level architecture with clear component responsibilities
- expose 1. field creation, 2. data-binding, 3. layouting
- produce architecture diagrams
Assess definition changes to support new ways of configuring forms
- especially moving towards a separation between bindings and layout
- Envision repackaging
- Draft eventual backward compatibility
- Iterate from Sang's PoC
- Keep in mind / draft check if form is dirty or not
- ideally move away from Items, in favor of domain types, e.g. CompositeField<Contact>
- Challenging with JCR adapters in particular
- MultivalueFields would in turn be typed with Collection types (List, Set, ordered/unordered, etc.)
- Adapt new default CompositeField & MultivalueField
F3. [TOFILE] Reimplement Tabsheet customizations, ideally as Vaadin extension
- Focus first field
- Show all tabs
- Port the styling—quickly estimate effort against restart from Valo
F4. [TOFILE] Reimplement i18n support within new Form
- Generalize "variation" switching
- aka item datasource decoration somehow
- so we can support p13n variant-switching similarly
F5. [TOFILE] Refine support for backward compatibility
- a. binding strategies would cater to backward compatibility with transformers?
- b. high-level switch to use fully old dialogs / transformers / FormBuilder.... vs. new APIs
F6. [TOFILE] Reimplement the Dialog integration and/or DetailSubApp
- Reuse and style Vaadin Windows instead?
- How about dynamic resizing of dialog height?
F7. [TOFILE]Validation bubbles as JavaScriptExtension
- sort out the problem with marking component visible / invisible
- use plain Vaadin validation state ( state.errorMessage && state.hideErrors )
F8. [TOFILE] Reimplement the error count banner at the top of the form
- again, maybe as Form component extension?)
- + jump to next error
Reading definitions and building tabs and fields
- 1 Vaadin
FieldGroup
+FormLayout
for each tab (merge bits fromFormBuilder
) - Result: a simple Vaadin application (w/ ui-framework on the classpath)
- Mika might prepare the skeleton on a branch
FormPresenter
invokingFieldFactories
- for the PoC, you can instantiate factories manually
- either refactor existing ones, or reimplement a simple TextFieldFactory with less Magnolia dependencies
- maybe API like
public Field<T> createField(D definition)
- so we can reuse a single
FieldFactory
to produce multiple instances of a field
- maybe API like
FieldFactories
no longer doing property data-binding (#setPropertyDataSource
)FormPresenter
doing the databinding instead =>fieldGroup#setItemDataSource
- -
- Enable or validate one field from the value of another one
- Not needed for the PoC:
- locale and i18n handling
- complex fields (only text fields, selects)
- visual appearance, no MagnoliaTabSheet needed, just a plain
VerticalLayout
with one-to-manyFormLayouts
- -
PoC #2: Validation bubbles below field
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
Validation as a Vaadin JS Extension, see the few links below:
- Integrating JavaScript Components and Extensions (Vaadin docs)
- class
com.vaadin.server.AbstractJavaScriptExtension
- Component Extensions & Component and UI Extensions (the GWT way, Vaadin docs)
- see also
TextAreaStretcher
,Bidi
(GWT way) orJCrop
,RowScroller
(JS way) for more extension examples
Default Vaadin validation is as follows:
- warning icon
- tooltip when hovering the field
Extension should primarily add the bubble below
- Same styles as now
- see
- bubble width is the same as field width with border
- arrow tip should be around 30–40px from the left
- Result: small Vaadin application
- Apply to a TextField (e.g. using standard Vaadin email validator)
- If using the Magnolia theme, then field border should become red too
- Currently tooltip is hidden via CSS in Magnolia
- we can still do this the same way, maybe as well for the warning icon
PoC #3: Complex Fields refactoring
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Goals:
- Get rid of Magnolia-specific components within field implementations
- Get rid of AbstractCustomMultiField abstraction
The following three may be done independently:
—without Magnolia component/definition inside field implementations
Pure Vaadin CompositeField
- close to
AccessControlField
- Except fields are not hard-coded
- pass sub-fields into constructor?
- maybe as map with field-names as keys?
- would help us keeping FieldFactories outside of field implementations
- i.e. get rid of infamous
AbstractCustomMultiField#createLocalField
- i.e. get rid of infamous
- pass sub-fields into constructor?
- also bind fields internally via
FieldGroup
? - reuse
#setValidationVisible
and handling of valueChange on sub-fields - Result: simple Vaadin application
- operating over a
PropertysetItem
orBeanItem
- part 1. using a CompositeField for First name and Last name
- laid out horizontally
- has an API to set direction (minimum requirement)
- part2. also API to set an arbitrary layout
- if feasible, but not a must-have
- or maybe using a Vaadin declarative layout?
- check out Sasha's talk from mconf16
- Designing UIs declaratively (Vaadin docs)
- icing on top of the cake really
- operating over a
Pure Vaadin MultiValueField
- close to
AccessControlListField
- reuse some form of
EntryFieldFactory
(maybe also NewEntryHandler if applicable) - Result: simple Vaadin application
- operating over a
PropertysetItem
orBeanItem
- i.e.
extends CustomField<I extends Item>
- or
extends CustomField<C extends Collection>
(maybe more in line with Vaadin 8?)
- i.e.
- with a property of type Collection or List, then one entry per entry in the collection
- field needs to create Vaadin properties for each entry in the list, and bind it internally to sub-fields
- also bind fields internally via
FieldGroup
? - reuse validation and valueChange logic from
AccessControlListField
- steps:
- a MultiField of TextFields (can be hard-coded)
- a MultiField of a CustomField type (First name + Last name)
- a MultiField with the pluggable NewEntryHandler (closer to use cases in Magnolia where subfields are configured)
- operating over a
Pure Vaadin LinkField
- Inspired from
AccessControlField$PathChooserHandler
- Result: small Vaadin application
- see
info.magnolia.dev.acls.AccessControlFieldUI
in Mika's sandbox - opens a Vaadin Window
- field inside the window shares property data-source with text field
- see
4. Integration phase
- To be determined
...
- e.g. still as a small Vaadin application, but combining configured forms, complex fields, sub-field validation and a dynamic behavior
|
- Think page objects
- Can only be done once the basic stones are in place
- Prove form-level agility (binding upon field(s) constructed)
F12. [TOFILE] Proof-test new APIs against Vaadin 8
- Ideally, only the data-binding "part" should be affected, not field creation nor layouting
TODO:
- File in JIRA / MGNLUI
- Estimate
- Flesh out, break out into even smaller tasks
- Add relative task dependencies
Then reevaluate progress after 2–3w.
Unprocessed ideas
- binding strategies: default, transformerDelegate...
- expose layouting (default from fieldDef + tabs, declarative, or other new mechanism?, responsive forms?)
- save actions bundled in Form itself by default, can be delegated to configured action(s)
- does validate ootb
- extensibility: generate wrapper implementations for component interfaces
Related wishful improvements
- Valo-based theme switch
- Generate concrete FieldDefinitions (& builders) from our interfaces
- Plain Java Decorators (add/remove field by user-based form decorator)
- supplanting blossom
- Documentation generation (via pegdown)
...