Changeset 3953
- Timestamp:
- Nov 5, 2010, 11:12:46 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/read/ViewHome.java
r3929 r3953 76 76 public static final VInteger VJOBCOUNT = new VInteger("jobCount", 0, true); 77 77 public static final VInteger VSPECTRUMSEARCHCOUNT = new VInteger("spectrumSearchCount", 0, true); 78 public static final VInteger VPROJECTCOUNT = new VInteger("projectCount", 0, true); 78 79 79 80 @Override … … 185 186 int spectrumSearchCount = spectrumSearchQuery.count(dc); 186 187 count += spectrumSearchCount; 188 // Removed Project items 189 ItemQuery<Project> removedProjectQuery = queryFactory.select(Project.class); 190 EmptyTrash.filter(removedProjectQuery); 191 int projectCount = removedProjectQuery.count(dc); 192 count += projectCount; 187 193 188 194 Form form = getTrashCanForm(dirCount, fileCount, 189 jobCount, spectrumSearchCount );195 jobCount, spectrumSearchCount, projectCount); 190 196 Toolbar tb = new Toolbar(); 191 197 ActionLink emptyButton = getActionFactory().getActionLink( … … 208 214 209 215 private Form getTrashCanForm(Integer dirCount, Integer fileCount, 210 Integer jobCount, Integer spectrumSearchCount )216 Integer jobCount, Integer spectrumSearchCount, Integer projectCount) 211 217 { 212 218 Form form = new Form("trashCanForm"); … … 232 238 count += spectrumSearchCount; 233 239 } 240 if (projectCount != null) 241 { 242 count += projectCount; 243 } 234 244 // Add info line(s) on number of items of each class to delete 235 245 if (count == 0) … … 273 283 fs.add(spectrumSearchItemsCount); 274 284 } 285 if (projectCount != null && projectCount > 0) 286 { 287 TextField<Integer> projectItemsCount = new TextField<Integer>(VPROJECTCOUNT); 288 projectItemsCount.setLabel("Projects"); 289 projectItemsCount.setValue(projectCount); 290 projectItemsCount.setDisabled(true); 291 fs.add(projectItemsCount); 292 } 275 293 return form; 276 294 } -
trunk/client/servlet/src/org/proteios/action/write/EmptyTrash.java
r3517 r3953 42 42 import org.proteios.core.Nameable; 43 43 import org.proteios.core.PluginDefinition; 44 import org.proteios.core.Project; 44 45 import org.proteios.core.QueryFactory; 45 46 import org.proteios.core.SpectrumSearch; 46 import org.proteios.gui.form.Form;47 import org.proteios.plugins.EmptyTrashPlugin;48 47 import se.lu.thep.waf.ActionException; 49 48 import se.lu.thep.waf.constraints.InvalidParameterValue; 50 import java.util.List;51 49 52 50 /** … … 106 104 log.debug("dirCount = " + dirCount); 107 105 totalItemCount += dirCount; 106 // 107 int projectCount = getNumberOfTrashItems(dc, Project.class); 108 log.debug("projectCount = " + projectCount); 109 totalItemCount += projectCount; 108 110 // 109 111 log.debug("totalItemCount = " + totalItemCount); … … 192 194 // Try deleting File items 193 195 deletedCount += deleteItemsOfSpecificClass(File.class); 196 // Try deleting Project items (done before trying to delete project directory) 197 deletedCount += deleteItemsOfSpecificClass(Project.class); 194 198 // Try deleting Directory items 195 199 deletedCount += deleteItemsOfSpecificClass(Directory.class); … … 226 230 totalItemCount += getNumberOfTrashItems(dc, File.class); 227 231 totalItemCount += getNumberOfTrashItems(dc, Directory.class); 232 totalItemCount += getNumberOfTrashItems(dc, Project.class); 228 233 return totalItemCount; 229 234 } … … 253 258 * 254 259 * @param itemClass Class The class for items to delete. 255 * @return int The number of selected items.260 * @return int The number of deleted items. 256 261 */ 257 262 private int deleteItemsOfSpecificClass(Class<? extends BasicItem> itemClass) -
trunk/client/servlet/src/org/proteios/gui/MainMenu.java
r3944 r3953 493 493 Node trashSpectrumSearchesN = createViewTrashItemNode( 494 494 "SpectrumSearches", SpectrumSearch.class); 495 Node trashProjectsN = createViewTrashItemNode("Projects", Project.class); 495 496 // 496 497 // Create view trash menu … … 501 502 rootN.add(trashJobsN); 502 503 rootN.add(trashSpectrumSearchesN); 504 rootN.add(trashProjectsN); 503 505 return rootN; 504 506 } … … 599 601 itemCount += getNumberOfTrashItems(Job.class); 600 602 itemCount += getNumberOfTrashItems(SpectrumSearch.class); 603 itemCount += getNumberOfTrashItems(Project.class); 601 604 // Create empty trash menu item 602 605 ActionLink actionLink = actionFactory.getActionLink(EmptyTrash.class, -
trunk/plugin/src/org/proteios/plugins/EmptyTrashPlugin.java
r3517 r3953 39 39 import org.proteios.core.Nameable; 40 40 import org.proteios.core.ProgressReporter; 41 import org.proteios.core.Project; 41 42 import org.proteios.core.QueryFactory; 42 43 import org.proteios.core.SessionControl; … … 50 51 import org.proteios.core.plugin.Response; 51 52 52 //import java.io.IOException;53 import java.util.Arrays;54 import java.util.List;55 56 53 /** 57 54 * This plugin empties the trashcan. … … 157 154 // Try deleting File items 158 155 deletedCount += deleteItemsOfSpecificClass(File.class, progress, deletedCount, totalItemCount); 156 // Try deleting Project items (done before trying to delete project directory) 157 deletedCount += deleteItemsOfSpecificClass(Project.class, progress, deletedCount, totalItemCount); 159 158 // Try deleting Directory items 160 159 deletedCount += deleteItemsOfSpecificClass(Directory.class, progress, deletedCount, totalItemCount); … … 199 198 totalItemCount += getNumberOfTrashItems(dc, File.class); 200 199 totalItemCount += getNumberOfTrashItems(dc, Directory.class); 200 totalItemCount += getNumberOfTrashItems(dc, Project.class); 201 201 return totalItemCount; 202 202 } … … 229 229 * @param startCount int The start count to use for progress report. 230 230 * @param totalCount int The total count to use for progress report. 231 * @return int The number of selected items.231 * @return int The number of deleted items. 232 232 */ 233 233 private int deleteItemsOfSpecificClass(Class<? extends BasicItem> itemClass, ProgressReporter progress, int startCount, int totalCount)
Note: See TracChangeset
for help on using the changeset viewer.