Major
Nice to have
Bugfix
Major
A CommandHandler operates in the context of a component and refers to a subject object:
#!java CommandHandler.handleCommand(DisplayContext, LayoutComponent, Object model, Map<String, Object>).
The model object is extracted from the component. For this, the CommandHandler implementation can fill in a hook so far:
#!java CommandHandler.getTargetModel(LayoutComponent)
However, the 1-to-1 connection of the command implementation and the specification of the target object for the command limits the usability of the command. For example, the same command cannot be used for the object currently displayed in a form or the selected row in a table.
Improvement
The target object relative to the context component of the command can be configured. The same syntax is used for this as for the model definition of a component(model="selection(other-component)"). The syntax is slightly extended so that one can also refer to one's own component: target="selection(self())".
Application
Configuration of the target object for a command relative to the component where the command is configured:
#!xml <button id="delete" class="MyDeleteHandler" ... target="selection(self())" />
Test
- Refactoring: previous overrides of getTargetModel() have been changed to the configuration option. No additional test.