Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1695

Handling of multiple onActivate methods could be improved.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 5.0.5
    • None
    • tapestry-core
    • None

    Description

      The summary is vague because the docs don't yet cover this situation.
      It seems reasonable to have need for something like:

      Object onActivate()

      { ... }

      void onActivate(int itemId) { ... }

      The current event handling calls both these activate methods (the 0 parameters method first, then others).
      I see only two ways of dealing with this:

      (1) Factor out common code and use a flag to avoid executing that code twice
      (2) Replace the two activate methods with:

      Object onActivate(Object[] parameters)

      { ... }

      Both options impose some fiddly responsibilities onto the developer.
      Perhaps a resolution is already planned but here are some ideas:

      • call only one event handler
      • allow event handlers to short-circuit (return boolean/Boolean?)
      • swallow coercion exceptions so other event handlers can be tried

      Cheers,
      Nick.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            sicklittlemonkey Nick Westgate
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: