1 package net.suberic.pooka.gui; 2 import java.awt.Component ; 3 4 public class MultiValueIcon extends BooleanIcon { 5 boolean seen, recent; 6 String recentAndUnseenFile, justUnseenFile; 7 8 public MultiValueIcon(boolean isSeen, boolean isRecent, String recentAndUnseen, String justUnseen ) { 9 super (isSeen, recentAndUnseen, "MultiValue"); 10 seen = isSeen; 11 recent = isRecent; 12 recentAndUnseenFile = recentAndUnseen; 13 justUnseenFile = justUnseen; 14 } 15 16 public Component getIcon() { 17 if (seen) { 18 return BooleanIcon.blankImage; 19 } else if (recent) { 20 return getIcon(recentAndUnseenFile); 21 } else { 22 return getIcon(justUnseenFile); 23 } 24 } 25 26 private int getIntValue() { 27 if (seen) 28 return 0; 29 else if (!recent) 30 return 1; 31 else 32 return 2; 33 } 34 35 public int compareTo(Object o) { 36 if (o instanceof MultiValueIcon) { 37 int otherValue= ((MultiValueIcon) 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 MultiValueIcon."); 47 } 48 49 public String toString() { 50 return ""; 51 } 52 } 53 | Popular Tags |