Skip to content

Engine API: expand and improve select write semantics (also anticipating future types) #97

@eyelidlessness

Description

@eyelidlessness

While the current SelectNode.select and SelectNode.deselect methods are sufficient, their ergonomics leave something to be desired for a variety of use cases that are now becoming reality (making them easier to discuss than when the interface was initially designed).

  • As discussed in feature #59: select controls for ui-vue #89, it would be helpful to have APIs to toggle individual SelectItems (allowing clients to toggle their selected state without redundantly checking their selected-ness, simplifying a per-checkbox toggle action). A proposed name of toggle was introduced. We may also consider prior art in APIs with toggle semantics, some of which include a "force" option (although we should consider it carefully, as that particular example tends to confuse).
  • Also discussed in feature #59: select controls for ui-vue #89, it would be helpful to atomically set the full selected state of multiple SelectItems at once. While a proposed name of setValue was suggested, I'd caution that it may be wise to reserve that name for other use cases (see next point).
  • A consistent need for various flexibilities around writing values has been an overarching concern while porting JavaRosa tests (Port JavaRosa tests, ignore ones that fail #25). This includes some flexibility to specify only the selected values (rather than the SelectItem object interface introduced in Refactor: engine <-> client interface implementation #67), as well as a much broader concern around the Scenario client's utilization of a highly polymorphic value assignment interface. That porting effort will include copious notes, including many on the topic of casting of value types. While I have some concerns about making the engine's APIs overly flexible, in general I think it would be a good idea for select-specific APIs to be mindful of the possibility that a shared setValue interface (across all value-bearing node types) might come to be.
  • Resurfacing thoughts from discussion prior to feature #59: select controls for ui-vue #89 (also Refactor: engine <-> client interface implementation #67 if I recall), I cautioned that a variadic method could be confusing without clearly distinguishing between partial and full value change semantics. I think something akin to the notion proposed in feature #59: select controls for ui-vue #89 to set all selected values is definitely easier to reason about than any partial-but-multiple selection change logic could be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    xforms-engineTasks for Web Forms xforms-engine package

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions