orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
514 stars 220 forks source link

XForms: date, time, dateTime, and boolean inputs in XBL #481

Open ebruchez opened 11 years ago

ebruchez commented 11 years ago

This would solve a number of issues. For example, we would like to use a control layout compatible with Bootstrap to help with CSS styling. We can hardcode, but that's not so nice, and then the JavaScript client must be modified to recreate the inputs. That's changes in two places.

Two implement this, we need:

We already support updating a shadow tree dynamically within xxf:dynamic. This was implemented to update fr:section in Form Builder.

See also #1248.

ebruchez commented 11 years ago

How things work now:

Since the top-level part is shareable, something has to change, and this is probably the hardest part (caching!).

One possible approach:

ebruchez commented 4 years ago

Based on the above, the difficulty seems now to be how to handle the static state for those XBL controls which depend on the datatype.

Since the above was written, ComponentControl has a hasLazyBinding option, which currently only works for nested parts (i.e. Form Builder) which are specifically annotated. See #3477.

How hard would it be to change this condition to add this?

|| (part.isTopLevel && hasTypeBinding)

In addition, AbstractBinding is still not lazy, and it should be. Further, it shouldn't be stored in the part, as discussed above, since the part is shared.

In short, not only ConcreteBinding but also AbstractBinding cannot be determined during static analysis, and they cannot be stored directly into ComponentControl. We still need an indirection there.

ebruchez commented 2 years ago

Reviewing the above, that makes sense. Right now we associate an AbstractBinding directly in XFormsAnnotator as an IndexableBinding. When we build the component tree, we create a ComponentControl based on that.

The indirection we need here is something that says "here is an element whose actual binding may depend on a type that we don't yet know". For example xf:input might have it's plain, string implementation (which would also need to be done in XBL, which would be fine probably), or its fr:date, fr:number, etc. implementation.

So instead of storing a IndexableBinding, maybe an ADT with EagerIndexableBinding | LazyIndexableBinding.

At some point, either statically (case of bind which is known before static analysis is complete) or dynamically (case where things are more dynamic), we can resolve the binding to a concrete AbstractBinding. As a first step, we could only address the static approach. This is easier as it means that at the end of the static analysis, we have a resolved binding and that can stay in the shared PartAnalysis.

As a second step, we can do the dynamic part.