Changeset 3953


Ignore:
Timestamp:
Nov 5, 2010, 11:12:46 AM (13 years ago)
Author:
olle
Message:

Refs #704. Refs #523. Refs #620. Routines for listing, restoring or
permanently removing items in the trash should be updated to support
project items:

  1. Class/file gui/MainMenu.java in client/servlet/ updated to add

a menu item for projects in the trash can menu.

  1. Class/file action/read/ViewHome.java in client/servlet/ updated:
  2. New valid parameter VInteger VPROJECTCOUNT added.
  3. Public method void runMe() updated to support project items.
  4. Private method Form getTrashCanForm(...) updated with new

argument Integer projectCount and support for projects in
the form.

  1. Class/file action/write/EmptyTrash.java in client/servlet/

updated to support project items.

  1. Class/file plugins/EmptyTrashPlugin.java in plugin/ updated

to support project items.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/read/ViewHome.java

    r3929 r3953  
    7676    public static final VInteger VJOBCOUNT = new VInteger("jobCount", 0, true);
    7777    public static final VInteger VSPECTRUMSEARCHCOUNT = new VInteger("spectrumSearchCount", 0, true);
     78    public static final VInteger VPROJECTCOUNT = new VInteger("projectCount", 0, true);
    7879       
    7980    @Override
     
    185186        int spectrumSearchCount = spectrumSearchQuery.count(dc);
    186187        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;
    187193       
    188194        Form form = getTrashCanForm(dirCount, fileCount,
    189         jobCount, spectrumSearchCount);
     195        jobCount, spectrumSearchCount, projectCount);
    190196        Toolbar tb = new Toolbar();
    191197        ActionLink emptyButton = getActionFactory().getActionLink(
     
    208214       
    209215    private Form getTrashCanForm(Integer dirCount, Integer fileCount,
    210     Integer jobCount, Integer spectrumSearchCount)
     216    Integer jobCount, Integer spectrumSearchCount, Integer projectCount)
    211217    {
    212218        Form form = new Form("trashCanForm");
     
    232238            count += spectrumSearchCount;
    233239        }
     240        if (projectCount != null)
     241        {
     242          count += projectCount;
     243        }
    234244        // Add info line(s) on number of items of each class to delete
    235245        if (count == 0)
     
    273283            fs.add(spectrumSearchItemsCount);
    274284        }
     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        }
    275293        return form;
    276294    }
  • trunk/client/servlet/src/org/proteios/action/write/EmptyTrash.java

    r3517 r3953  
    4242import org.proteios.core.Nameable;
    4343import org.proteios.core.PluginDefinition;
     44import org.proteios.core.Project;
    4445import org.proteios.core.QueryFactory;
    4546import org.proteios.core.SpectrumSearch;
    46 import org.proteios.gui.form.Form;
    47 import org.proteios.plugins.EmptyTrashPlugin;
    4847import se.lu.thep.waf.ActionException;
    4948import se.lu.thep.waf.constraints.InvalidParameterValue;
    50 import java.util.List;
    5149
    5250/**
     
    106104    log.debug("dirCount = " + dirCount);
    107105    totalItemCount += dirCount;
     106    //
     107    int projectCount = getNumberOfTrashItems(dc, Project.class);
     108    log.debug("projectCount = " + projectCount);
     109    totalItemCount += projectCount;
    108110    //
    109111    log.debug("totalItemCount = " + totalItemCount);
     
    192194    // Try deleting File items
    193195    deletedCount += deleteItemsOfSpecificClass(File.class);
     196    // Try deleting Project items (done before trying to delete project directory)
     197    deletedCount += deleteItemsOfSpecificClass(Project.class);
    194198    // Try deleting Directory items
    195199    deletedCount += deleteItemsOfSpecificClass(Directory.class);
     
    226230    totalItemCount += getNumberOfTrashItems(dc, File.class);
    227231    totalItemCount += getNumberOfTrashItems(dc, Directory.class);
     232    totalItemCount += getNumberOfTrashItems(dc, Project.class);
    228233    return totalItemCount;
    229234  }
     
    253258   *
    254259   * @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.
    256261   */
    257262  private int deleteItemsOfSpecificClass(Class<? extends BasicItem> itemClass)
  • trunk/client/servlet/src/org/proteios/gui/MainMenu.java

    r3944 r3953  
    493493    Node trashSpectrumSearchesN = createViewTrashItemNode(
    494494      "SpectrumSearches", SpectrumSearch.class);
     495    Node trashProjectsN = createViewTrashItemNode("Projects", Project.class);
    495496    //
    496497    // Create view trash menu
     
    501502    rootN.add(trashJobsN);
    502503    rootN.add(trashSpectrumSearchesN);
     504    rootN.add(trashProjectsN);
    503505    return rootN;
    504506  }
     
    599601    itemCount += getNumberOfTrashItems(Job.class);
    600602    itemCount += getNumberOfTrashItems(SpectrumSearch.class);
     603    itemCount += getNumberOfTrashItems(Project.class);
    601604    // Create empty trash menu item
    602605    ActionLink actionLink = actionFactory.getActionLink(EmptyTrash.class,
  • trunk/plugin/src/org/proteios/plugins/EmptyTrashPlugin.java

    r3517 r3953  
    3939import org.proteios.core.Nameable;
    4040import org.proteios.core.ProgressReporter;
     41import org.proteios.core.Project;
    4142import org.proteios.core.QueryFactory;
    4243import org.proteios.core.SessionControl;
     
    5051import org.proteios.core.plugin.Response;
    5152
    52 //import java.io.IOException;
    53 import java.util.Arrays;
    54 import java.util.List;
    55 
    5653/**
    5754 * This plugin empties the trashcan.
     
    157154    // Try deleting File items
    158155    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);
    159158    // Try deleting Directory items
    160159    deletedCount += deleteItemsOfSpecificClass(Directory.class, progress, deletedCount, totalItemCount);
     
    199198    totalItemCount += getNumberOfTrashItems(dc, File.class);
    200199    totalItemCount += getNumberOfTrashItems(dc, Directory.class);
     200    totalItemCount += getNumberOfTrashItems(dc, Project.class);
    201201    return totalItemCount;
    202202  }
     
    229229   * @param startCount int The start count to use for progress report.
    230230   * @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.
    232232   */
    233233  private int deleteItemsOfSpecificClass(Class<? extends BasicItem> itemClass, ProgressReporter progress, int startCount, int totalCount)
Note: See TracChangeset for help on using the changeset viewer.