View Javadoc

1   package org.votech.ds6.widgets;
2   
3   import java.util.Map;
4   
5   import org.votech.plastic.managers.PlasticApplication;
6   import org.votech.plastic.outgoing.messages.Message;
7   
8   /**
9    * A MessageSource constructs a {@link Message} when the menu item is selected, and
10   * processes any object returned by the message recipient.
11   * @author jdt
12   *
13   */
14  public interface MessageSource {
15  
16      /**
17       * Construct a message to be sent when the menu is activated.
18       * @param destination the destination of the message - could be useful to some MessageSources.  Could be null if the message is to be broadcast.
19       * @return
20       */
21      Message getMessage(PlasticApplication destination);
22      
23      /**
24       * Perform any post-processing on the message response.
25       * @param sender who sent us this
26       * @param result the result!
27       */
28  
29      void processReturnValue(PlasticApplication sender, Object result);
30      /**
31       * Perform any post-processing on the message response if we broadcast to all.
32       * @param result
33       */
34      void processReturnValues(Map<PlasticApplication, Object> result);
35  
36  }