Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: plugins/Messenger/entity/Smiley.java


1   /*
2    * Smiley.java
3    *
4    * Created on November 10, 2002, 8:27 PM
5    */
6   
7   package plugins.Messenger.entity;
8   
9   /**
10   *
11   * @author  Christoph Walcher
12   */
13  public class Smiley {
14  
15      private String mnemonic = null;
16      private java.util.List mnemonicsList = null;
17      private javax.swing.ImageIcon icon = null;
18      
19      /** Creates a new instance of Smiley */
20      public Smiley() {
21          mnemonicsList = new java.util.Vector();
22      }
23      
24      /** Getter for property mnemonic.
25       * @return Value of property mnemonic.
26       */
27      public java.lang.String getMnemonic() {
28          return mnemonic;
29      }
30      
31      /** Setter for property mnemonic.
32       * @param mnemonic New value of property mnemonic.
33       */
34      public void setMnemonic(java.lang.String mnemonic) {
35          this.mnemonic = mnemonic;
36      }
37      
38      /** Getter for property mnemonicsList.
39       * @return Value of property mnemonicsList.
40       */
41      public java.util.List getMnemonicsList() {
42          return java.util.Collections.unmodifiableList(mnemonicsList);
43      }
44      
45      /** Setter for property mnemonicsList.
46       * @param mnemonicsList New value of property mnemonicsList.
47       */
48      public void setMnemonicsList(java.util.List mnemonicsList) {
49          this.mnemonicsList = mnemonicsList;
50      }
51      
52      public void addMnemonic(String mnemonic) {
53          if (getMnemonic() == null) {
54              setMnemonic(mnemonic);
55          }
56          mnemonicsList.add(mnemonic);
57      }
58      
59      /** Getter for property icon.
60       * @return Value of property icon.
61       */
62      public javax.swing.ImageIcon getIcon() {
63          return icon;
64      }
65      
66      /** Setter for property icon.
67       * @param icon New value of property icon.
68       */
69      public void setIcon(javax.swing.ImageIcon icon) {
70          this.icon = icon;
71      }
72      
73  
74      public int hashCode() {
75          return getMnemonic().hashCode();
76      }
77      
78      public String toString() {
79          StringBuffer retValue = new StringBuffer("[plugins.Messenger.Smiley]");
80          
81          retValue.append("Mnemonic: ");
82          retValue.append(getMnemonic());
83          retValue.append(" alternatives: ");
84          
85          java.util.Iterator mnemonicIter = mnemonicsList.iterator();
86          
87          while (mnemonicIter.hasNext()) {
88              retValue.append(mnemonicIter.next());
89              if (mnemonicIter.hasNext()) {
90                  retValue.append(",");
91              }
92          }
93          
94          return retValue.toString();
95      }
96      
97  }