isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Huber <ahu...@apache.org>
Subject Re: Warning a user based on input on action invocation
Date Fri, 23 Nov 2018 20:43:06 GMT
You can solve this by adding a boolean parameter to the action, not as pretty as a yellobackground
advise, but at least works with what we already have:

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.Mixin;
import org.apache.isis.applib.annotation.ParameterLayout;

import lombok.RequiredArgsConstructor;

@Mixin @RequiredArgsConstructor
public class SimpleObject_advice {

    private final SimpleObject holder;
    
    @Action
    public SimpleObject $$(
            @ParameterLayout(named="input") String input, 
            @ParameterLayout(named="do it anyway") boolean doItAnyway) {

        // some action here
        return holder;
    }
    
    public String validate$$(String input, boolean doItAnyway) {
        if(doItAnyway) {
            return null;
        }
        return "not good, here's my advice to you ...";
    }
}

Cheers, Andi

On 2018/11/23 15:46:26, Sander Ginn <sander@ginn.it> wrote: 
> Hi,
> 
> We’ve had a number of support requests relating to new users of our application that
are not yet fully familiar with their business process. 
> We do not wish to invalidate input as many business rules are not clearly defined in
a ‘correct/incorrect’ fashion, with many exceptions and special cases.
> 
> As a middle ground, I would like to propose an extension of the metamodel with a support
method similar to validateXxx(), which renders the familiar dialog and warning message underneath
the input field with another colour (yellow, probably) but does not block the user from completing
the action.
> 
> Does anyone else consider this to be a useful addition, and if so, what would be a good
method prefix? My first thought was warnXxx(), but that does not make a lot of sense syntactically;
after all, we aren’t warning the action in question (as opposed to validate/hide/disableXxx())
but the user instead.
> 
> Best
> Sander Ginn

Mime
View raw message