Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
FilePanel |
|
| 1.0;1 | ||||
FilePanel$FileListViewMode |
|
| 1.0;1 |
1 | // | |
2 | // $Id: FilePanel.java 1721 2015-03-29 17:48:44Z etienne_sf $ | |
3 | // | |
4 | // jupload - A file upload applet. | |
5 | // Copyright 2007 The JUpload Team | |
6 | // | |
7 | // Created: ? | |
8 | // Creator: William JinHua Kwong | |
9 | // Last modified: $Date: 2015-03-29 19:48:44 +0200 (dim., 29 mars 2015) $ | |
10 | // | |
11 | // This program is free software; you can redistribute it and/or modify it under | |
12 | // the terms of the GNU General Public License as published by the Free Software | |
13 | // Foundation; either version 2 of the License, or (at your option) any later | |
14 | // version. This program is distributed in the hope that it will be useful, but | |
15 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
17 | // details. You should have received a copy of the GNU General Public License | |
18 | // along with this program; if not, write to the Free Software Foundation, Inc., | |
19 | // 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | package wjhk.jupload2.gui.filepanel; | |
21 | ||
22 | import java.awt.Color; | |
23 | import java.awt.Component; | |
24 | import java.awt.Font; | |
25 | import java.awt.Point; | |
26 | import java.io.File; | |
27 | import java.util.List; | |
28 | ||
29 | import javax.swing.ActionMap; | |
30 | import javax.swing.JComponent; | |
31 | import javax.swing.TransferHandler; | |
32 | ||
33 | import wjhk.jupload2.filedata.DefaultFileData; | |
34 | import wjhk.jupload2.filedata.FileData; | |
35 | import wjhk.jupload2.gui.JUploadPanel; | |
36 | import wjhk.jupload2.upload.UploadFilePacket; | |
37 | ||
38 | /** | |
39 | * Defines the interface used in the applet, when dealing with the file panel. | |
40 | */ | |
41 | public interface FilePanel { | |
42 | ||
43 | /** This enumeration lists the available display modes, for the file list. */ | |
44 | 925 | static public enum FileListViewMode { |
45 | /** The flat view is the 'historical' one. It displays a table containing all files to upload */ | |
46 | 1 | FLAT, |
47 | /** | |
48 | * The map to File System mode, is when the hierarchy is a part of the local file system. The root of the | |
49 | * hierarchy (visible root) is the common root to to all files and folder. It is actually a <B>hierarchical view | |
50 | * of the FLAT view</B>, using the same data structure. Only the display changes.<BR/> | |
51 | * For instance, if /tmp/f1/f2/file.txt and /tmp/f1/f11/file.txt have been added, /tmp/f1 is the common root. So | |
52 | * this mode displays: f2 and f11 as the first visible hierarchy level. f2 contains file.txt, and f11 also | |
53 | * contains a file.txt file. | |
54 | * | |
55 | * @see DefaultFileData#getRoot(java.util.List) | |
56 | */ | |
57 | 1 | TREE_VIEW, |
58 | /** | |
59 | * In independent tree view mode, each added file/folder is added to the root. This root is the root that will | |
60 | * be sent to the server, during the upload.<BR/> | |
61 | * For instance, if /tmp/f1/f2/file.txt and /tmp/f1/f11/file.txt have been both added, then, two file.txt | |
62 | * (coming from different folders, so they are actually different files with the same name) are attached to the | |
63 | * hierarchical view.<BR/> | |
64 | * If if /tmp/f1 is added, then: f1 is attached to the root. And the hierarchy will contain: f1, f2 as a | |
65 | * subfolder of f1, file.txt as a file in f2. | |
66 | */ | |
67 | 1 | INDEPENDENT_TREE_VIEW |
68 | }; | |
69 | ||
70 | /** | |
71 | * Set the view mode, for the file list. | |
72 | * | |
73 | * @return The current view mode. | |
74 | * @see #fileListViewMode | |
75 | */ | |
76 | public FileListViewMode getFileListMode(); | |
77 | ||
78 | /** | |
79 | * Set the view mode, for the file list. | |
80 | * | |
81 | * @param fileListViewMode The view mode to set. | |
82 | * @see #fileListViewMode | |
83 | */ | |
84 | public void setFileListViewMode(FileListViewMode fileListViewMode); | |
85 | ||
86 | /** | |
87 | * Add multiple files to this panel. | |
88 | * | |
89 | * @param f An array of files to add. | |
90 | */ | |
91 | public void addFiles(File[] f); | |
92 | ||
93 | /** | |
94 | * Retrieve all currently stored files. | |
95 | * | |
96 | * @return an array of files, currently managed by this instance. | |
97 | */ | |
98 | public List<FileData> getFiles(); | |
99 | ||
100 | /** | |
101 | * Retrieve the number of file entries in the JTable. | |
102 | * | |
103 | * @return the current number of files, held by this instance. | |
104 | */ | |
105 | public int getFilesLength(); | |
106 | ||
107 | /** | |
108 | * Removes all currently selected file entries. | |
109 | */ | |
110 | public void removeSelected(); | |
111 | ||
112 | /** | |
113 | * Removes all file entries. | |
114 | */ | |
115 | public void removeAll(); | |
116 | ||
117 | /** | |
118 | * Remove an array of files, typically an {@link UploadFilePacket}. | |
119 | * | |
120 | * @param fileData The files to remove. | |
121 | */ | |
122 | public void remove(FileData[] files); | |
123 | ||
124 | /** | |
125 | * Remove a specified file entry. | |
126 | * | |
127 | * @param fileData The file to be removed. | |
128 | */ | |
129 | public void remove(FileData fileData); | |
130 | ||
131 | /** | |
132 | * Clears the current selection of the JTable. | |
133 | */ | |
134 | public void clearSelection(); | |
135 | ||
136 | /** | |
137 | * Requests focus for the JTable. | |
138 | */ | |
139 | public void focusTable(); | |
140 | ||
141 | /** | |
142 | * Ask for the file contained below the specific point on the screen. | |
143 | * | |
144 | * @param point The point | |
145 | * @return The return instance of File. | |
146 | */ | |
147 | public FileData getFileDataAt(Point point); | |
148 | ||
149 | /** | |
150 | * Return the component on which drop event can occur. Used by {@link JUploadPanel}, when initializing the | |
151 | * DropTarget. | |
152 | * | |
153 | * @return The drop component target | |
154 | */ | |
155 | public Component getDropComponent(); | |
156 | ||
157 | /** | |
158 | * Transfer handler, to manage copy/paste operations. | |
159 | * | |
160 | * @param newHandler | |
161 | * @see JComponent#setTransferHandler(TransferHandler) | |
162 | */ | |
163 | public void setTransferHandler(TransferHandler newHandler); | |
164 | ||
165 | /** | |
166 | * Allows to get standard action map, like paste action. | |
167 | * | |
168 | * @return Get the current actionMap | |
169 | * @see JComponent#getActionMap() | |
170 | */ | |
171 | public ActionMap getActionMap(); | |
172 | ||
173 | /** | |
174 | * Set color of files list grid border. | |
175 | * | |
176 | * @param color awt Color | |
177 | */ | |
178 | public void setGridBorderColor(Color color); | |
179 | ||
180 | /** | |
181 | * Set back color of table header | |
182 | * | |
183 | * @param color awt Color | |
184 | */ | |
185 | public void setTableHeaderBackColor(Color color); | |
186 | ||
187 | /** | |
188 | * Set text color of table header | |
189 | * | |
190 | * @param color awt Color | |
191 | */ | |
192 | public void setTableHeaderTextColor(Color color); | |
193 | ||
194 | /** | |
195 | * Set table header text font | |
196 | * | |
197 | * @param color awt Color | |
198 | */ | |
199 | public void setTableHeaderFont(Font font); | |
200 | ||
201 | /** | |
202 | * Removes all files, which have the uploadFlag set to false. | |
203 | * | |
204 | * @see FileData#getUploadFlag() | |
205 | */ | |
206 | public void removeFileNotToUpload(); | |
207 | ||
208 | /** Removes empty folders in the TreeView hierarchy. This methods also calls the {@link #reload()} method */ | |
209 | public void cleanHierarchy(); | |
210 | ||
211 | /** Force the reloading of the file structure, and the refreshing of the display */ | |
212 | public void reload(); | |
213 | } |