[
https://issues.apache.org/jira/browse/ISIS-674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Keir Haywood reassigned ISIS-674:
----------------------------------------
Fix Version/s: (was: 2.1.2)
2.0.0-M3
Assignee: Daniel Keir Haywood
Summary: [DUPLICATE] Allow action parameters to be defaulted based on
the (change of) value of other parameters. (was: Allow action parameters to be
defaulted based on the (change of) value of other parameters.)
I believe we implemented this, ISIS-2001
> [DUPLICATE] Allow action parameters to be defaulted based on the (change of)
> value of other parameters.
> -------------------------------------------------------------------------------------------------------
>
> Key: ISIS-674
> URL: https://issues.apache.org/jira/browse/ISIS-674
> Project: Isis
> Issue Type: New Feature
> Components: Isis Core, Isis Viewer Wicket
> Affects Versions: viewer-wicket-1.3.1, core-1.3.0
> Reporter: Daniel Keir Haywood
> Assignee: Daniel Keir Haywood
> Priority: Minor
> Fix For: 2.0.0-M3
>
>
> For example:
> public void foo(
> Charge charge,
> BigDecimal amount,
> String description) {
>
> }
> public String default2Foo(Charge charge, BigDecimal amount) {
> return charge != null && amount != null? amount + " "
> charge.getDescription() : null;
> }
> Here, the value of the 'description' parameter is defaulted from that of both
> the preceding 'charge' and 'amount' parameters. Changing either should cause
> the default value for the 'description' to be recomputed.
> This is analogous to the way that choices are recomputed for
> category/subcategory, see ActionParametersFormPanel:
> @Override
> public void onUpdate(AjaxRequestTarget target, ScalarModelProvider
> provider) {
> final ActionModel actionModel = getActionModel();
> final ObjectAdapter[] pendingArguments =
> actionModel.getArgumentsAsArray();
> try {
> final ObjectAction action =
> actionModel.getActionMemento().getAction();
> final int numParams = action.getParameterCount();
> for (int i = 0; i < numParams; i++) {
> final ScalarPanelAbstract paramPanel = paramPanels.get(i);
> if(paramPanel != null) {
> // this could throw a ConcurrencyException as we may
> have to reload the
> // object adapter of the action in order to compute
> the choices
> // (and that object adapter might have changed)
> if(paramPanel.updateChoices(pendingArguments)) {
> <<<<<< THIS LOOKS SIMILAR TO WHAT NEEDS TO BE
> DONE...
> target.add(paramPanel);
> }
> }
> }
> } catch(ConcurrencyException ex) {
--
This message was sent by Atlassian Jira
(v8.3.4#803005)