View Javadoc

1   /**
2    * 
3    */
4   package org.votech.plastic.managers;
5   
6   import java.net.URL;
7   
8   /**
9    * An action associated with a Message.  These are client-defined operations not specified
10   * by the Plastic Spec, and are indicated by the fragment portion of the message URI.
11   * @author jdt
12   *
13   */
14  public class MsgAction {
15      
16      private String rawFragment;
17      private String description="";
18      private URL iconUrl;
19      
20      private String name;
21      
22      public MsgAction(String fragment) {
23          rawFragment = fragment;
24          name = fragment;
25      }
26  
27      public void setHumanReadableFragment(String fragment) {
28          name = fragment; //Well, it's an improvement on the raw fragment.
29          //TODO consider moving the decoding here.
30      }
31      
32      /**
33       * Return a human-friendly name for this action.  Hopefully, this will be something nicely 
34       * phrased and formatted, but if the application doesn't supply such a string through the
35       * Plastic messaging system, then the decoded URI will be returned instead.
36       * @return
37       */
38      public String getName() {
39          return name;
40      }
41      
42      public void setName(String name) {
43          this.name=name;
44      }
45      
46      /**
47       * get the encoded fragment.  Used as a key for other messages.
48       * @return
49       */
50      public String getRawFragment() {
51          return rawFragment;
52      }
53  
54      /**
55       * Get a human-friendly description of this action.
56       * @return Returns the description.
57       */
58      public String getDescription() {
59          return description;
60      }
61  
62      /**
63       * @param description The description to set.
64       */
65      public void setDescription(String description) {
66          this.description = description;
67      }
68  
69      /**
70       * Get a URL to an icon that could be used to describe this action.
71       * Note that it's the receiving application's responsibility to resize it.
72       * @return Returns the iconUrl.
73       */
74      public URL getIconUrl() {
75          return iconUrl;
76      }
77  
78      /**
79       * @param iconUrl The iconUrl to set.
80       */
81      public void setIconUrl(URL iconUrl) {
82          this.iconUrl = iconUrl;
83      }
84  
85  }