1 22 23 package org.meshcms.webui; 24 25 import org.meshcms.util.*; 26 27 31 public class FileClipboard { 32 private Path dirPath; 33 private String [] fileNames; 34 private boolean cut; 35 36 39 public FileClipboard() { 40 } 41 42 49 public void setContent(Path dirPath, String names, boolean cut) { 50 this.dirPath = dirPath; 51 fileNames = Utils.tokenize(names, ","); 52 this.cut = cut; 53 } 54 55 60 public Path[] getContent() { 61 if (dirPath == null || fileNames == null || fileNames.length == 0) { 62 return null; 63 } 64 65 Path[] paths = new Path[fileNames.length]; 66 67 for (int i = 0; i < paths.length; i++) { 68 paths[i] = dirPath.add(fileNames[i]); 69 } 70 71 return paths; 72 } 73 74 77 public void clear() { 78 dirPath = null; 79 fileNames = null; 80 cut = false; 81 } 82 83 86 public int countFiles() { 87 return fileNames == null ? 0 : fileNames.length; 88 } 89 90 93 public Path getDirPath() { 94 return dirPath; 95 } 96 97 100 public String [] getFileNames() { 101 return fileNames; 102 } 103 104 107 public boolean isCut() { 108 return cut; 109 } 110 } 111 | Popular Tags |