1 package net.sourceforge.jsh3modtool.gui.imagetable; 2 3 import java.io.File; 4 import java.io.IOException; 5 6 /*** 7 * A Cell model for a folder on a disk. 8 * 9 * @author erma 10 */ 11 public class FolderCell extends BaseCell 12 { 13 private final File targetFile; 14 private String targetPath; 15 16 /*** 17 * Creates a new instance of FolderCell 18 * @param path the path 19 */ 20 public FolderCell(File path) 21 { 22 super(); 23 targetFile = path; 24 try 25 { 26 targetPath = targetFile.getCanonicalPath(); 27 } 28 catch ( IOException ioe ) 29 { 30 targetPath = targetFile.getAbsolutePath(); 31 } 32 } 33 34 /*** Returns the folders path 35 * @return the complete path to the folder 36 */ 37 public String getTargetPath() 38 { 39 return targetPath; 40 } 41 42 /*** Returns the folders name (short 43 * @return the folders name 44 */ 45 public String getName() 46 { 47 return targetFile.getName(); 48 } 49 50 /*** {@inheritDoc} */ 51 public int hashCode() 52 { 53 return targetFile.hashCode(); 54 } 55 56 /*** {@inheritDoc} */ 57 public boolean equals( Object other ) 58 { 59 return targetFile.equals( other ); 60 } 61 }