Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5884

Let Links, Buttons and Forms send Click and Submit Events

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Later
    • 6.20.0, 7.0.0
    • None
    • wicket
    • None

    Description

      Links, Buttons

      Having the Link/Button components send click events to child IEventSinks  would allow decoupling their behavior into Behaviors  for reuse.
      This would also make their anonymous subclassing optional.

      add(new Link<>("logout")
      	.add(new LogoutClickBehavior())
      	.add(new ClickLogger("authentication")));
      

      Sending the events to the children probably would suffice, as a custom behavior could easily reroute the events to other destinations.

      add(new Link<>("logout").add(EventPropagator.SESSION));
      

      Forms

      Form onSubmit events would allow Behaviors to contribute to the submission without forcing users to subclass forms for any number of tasks.

      MailingStatelessContactForm.class
      DatabasePersistedContactForm.class
      XSDValidatingJAXBMarshallingAgainstXMLRantingContactForm.class
      

      The decoupled behavior is quite a bit more flexible and reuseable compared to individual classes for every combination of usecases.

      add(new ContactForm<>(id, model)
      	//decoupled behavior, that can be made to work for any form
      	.add(new FormMailBehavior("address@example.org"))
      	.add(new DevFormDumper()));
      

      Using listeners instead of the IEvent mechanism might be a viable alternative with a typesafty-flexibility tradeoff.
      Although there might be a naming conflict with IFormSubmitListener, which seems quite different in nature.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ttf Tim Feurich
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: