After looking at the source code for the LinkSubmit core component, I see a
lot of potential for a more generic component/mixin that could solve lots of
other problems.

What I need right now (and quite often) is a Select component that submits
the form and triggers an event to let the component class know that it was
the source of the submit. The LinkSubmit source code is very close to doing
this, the only difference is that it insists on rendering a link.

My questions is:

Is it possible to encapsulate this in a mixin, named something like
"AnySubmit"? It would only need parameters for "event" and "clientEvent".

I tried, but I don't see how I can use a mixin and still trigger an event on
submit using ComponentAction. See modified code from LinkSubmit below, is
this possible to do in a mixin on any component?

private static class ProcessSubmission implements
ComponentAction<MySubmitMixinClass> {

    private final String clientId;

    public ProcessSubmission(String clientId) {
      this.clientId = clientId;
    }

    public void execute(MySubmitMixinClass component) {
      component.processSubmission(clientId);
    }
  }

Reply via email to