1 package hoplugins.conv; 2 3 4 5 6 import java.io.File; 7 8 import javax.swing.filechooser.FileFilter; 9 10 11 final class CFilter extends FileFilter { 12 13 private byte type = RSC.TYPE_BUDDY; 14 15 protected CFilter(byte newType){ 16 type = newType; 17 } 18 19 public boolean accept(File f) { 20 if (f.isDirectory()) { 21 return true; 22 } 23 24 if(type == RSC.TYPE_BUDDY && RSC.isBuddyFile(f)) 25 return true; 26 if (type == RSC.TYPE_HAM && RSC.isHAMFile(f)) 27 return true; 28 if (type == RSC.TYPE_HTFOREVER && RSC.isHTForverFile(f)) 29 return true; 30 if (type == RSC.TYPE_HTCOACH && RSC.isHTCoachFile(f)) 31 return true; 32 return false; 33 } 34 35 public String getDescription() { 36 String value = "?"; 37 switch(type){ 38 case RSC.TYPE_BUDDY:value = "Hattrick Buddy"; break; 39 case RSC.TYPE_HAM:value = "Hattrick Assistent Manager"; break; 40 case RSC.TYPE_HTFOREVER:value = "HT Forever"; break; 41 case RSC.TYPE_HTCOACH:value = "HT Coach Professional"; break; 42 } 43 return value; 44 } 45 46 protected byte getType(){ 47 return type; 48 } 49 50 }