1 package net.suberic.pooka.gui; 2 import java.awt.Component ; 3 import javax.mail.Message ; 4 5 12 public class SearchTermIcon implements TableCellIcon { 13 14 SearchTermIconManager manager; 15 MessageProxy message; 16 int value = -1; 17 18 public SearchTermIcon(SearchTermIconManager newManager, MessageProxy newMessage) { 19 manager = newManager; 20 message = newMessage; 21 value = manager.getValue(message.getMessageInfo().getMessage()); 22 } 23 24 28 public Component getIcon() { 29 return manager.getIcon(value); 30 } 31 32 35 public int compareTo(Object o) { 36 if (o instanceof SearchTermIcon) { 37 int otherValue= ((SearchTermIcon) o).getIntValue(); 38 if ( getIntValue() < otherValue) 39 return -1; 40 else if (getIntValue() == otherValue) 41 return 0; 42 else 43 return 1; 44 } 45 46 throw new ClassCastException ("object is not a SearchTermIcon."); 47 } 48 49 52 public boolean equals(Object o) { 53 if (o instanceof SearchTermIcon) { 54 return (this.compareTo(o) == 0); 55 } 56 57 return false; 58 } 59 60 63 public int getIntValue() { 64 return value; 65 } 66 } 67 | Popular Tags |