Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#523 closed (fixed)

Trashcan updated with separate item class views and links in menus

Reported by: olle Owned by: olle
Milestone: Proteios SE 2.7 Keywords:
Cc:

Description

Trashcan management updates:

  • Thrashcan views should be updated to show one form for each item class supported in the trashcan, in order to avoid problems with several (possibly large) tables in one form, and to simplify addition of more supported item classes in the trashcan.
  • To simplify selection of what item class one wants the trash view to show, a new "Trash" cascade menu item should be added to the "View" menu, which makes it accessible from all forms, without the need to first go to the Home view. This menu will replace the current "View Trash" tool bar button for the "Trash" form in the latter.
  • The menu item for each item class supported in the trashcan should also display the current number of items of the specific class in the trashcan.
  • A new "Empty Trash" menu item will be added to the "Edit" menu.

The separate trashcan views for each supported item class should fix the problem described in Ticket #382 (Viewing trashcan is broken).

Change History (15)

comment:1 Changed 15 years ago by olle

Status: newassigned

Ticket accepted.

comment:2 Changed 15 years ago by olle

In order for a menu item label to contain a dynamically created number, localization of the label text cannot be performed automatically by class/file gui/web/GUIConverter.java in client/servlet/. One solution is to perform localization of the key part of the menu label in the MainMenu class, which requires access to the Localizer object. The update below by by gregory 2009-02-20 12:16:04 to Ticket #527 (MainMenu requires access to the Localizer) fixes this:

  • (In [3127]) Refs #527. LayoutFactory propagates localizer to MainMenu.

comment:3 Changed 15 years ago by olle

(In [3130]) Refs #523. Refs #382. Trashcan updated with separate item class views and links in menus:

  1. Class/file gui/MainMenu.java in client/servlet/ updated:
  2. Private method Node createViewNode() updated with new cascade

menu for viewing trash content, created by calling new private method Node createViewTrashNode().

  1. New private method Node createViewTrashNode() added.

It creates a menu item node for selecting to view trash items of specific classes by calling new private method Node createViewTrashItemNode(String tableName, Class itemClass).

  1. New private method

Node createViewTrashItemNode(String tableName, Class itemClass) added. It creates a menu item node for selecting to view trash items of a specific class. The number of deleted item of the class specific class is displayed in the menu label, after having been obtained by calling new private method int getNumberOfTrashItems(Class itemClass).

  1. New private method int getNumberOfTrashItems(Class itemClass)

added. It gets the number of items of a specific class in the trash can by performing a database query.

  1. Private method Node createEditNode() updated with new menu item

for emptying the trashcan. It is created by calling new private method Node createEmptyTrashNode().

  1. New private method Node createEmptyTrashNode() added.

It creates a menu item node to empty trash can. The number of items in the trash is displayed in the menu label. The menu item is disabled if the trash can does not contain any items.

  1. Class/file action/read/ListTrash.java in client/servlet updated:
  2. Public method void runMe() updated by obtaining the table and

class names from values of valid parameters by calling new private method String fetchVStringValue(VString vStr), after which the names are stored as session attributes. A table showing the trashcan contents for the specific item class is then displayed. The names stored as session attributes allow the table to be recreated e.g. for showing a new page of table data.

  1. New private method String fetchVStringValue(VString vStr) added.

It fetches value stored in valid parameter either as valid parameter to HTTP request or as session attribute.

  1. Class/file action/read/ViewHome.java in cleint/servlet/ updated

by removing the tool bar button for viewing the trash can.

comment:4 Changed 15 years ago by olle

severity: 162

Severity set to 2, since the design could be copied from existing classes/methods.

comment:5 Changed 15 years ago by olle

Resolution: fixed
Status: assignedclosed

Ticket closed as the desired functionality has been added.

comment:6 Changed 15 years ago by olle

Resolution: fixed
Status: closedreopened

Ticket reopened since emptying the trash can has the side effect of changing to the "Home" page, which is not desired when the "Empty Trash" command is selected in the "Edit" menu, which is accessible from any page (previously you could only select to empty the trash can from the "Home" page).

comment:7 Changed 15 years ago by olle

Analysis of possible solution to problem by removing command "setForwardTo(ViewHome.class)" at the end of protected method void runMe() in class/file action/write/EmptyTrash.java in client/servlet/:

  • The current page is being redisplayed after the trash can has been emptied, which is an improvement, and in many cases an adequate solution.
  • However, if a table managed by TableFactory or TableFactory2 was showing a view of data using specific filter settings and/or a table page other than the first for multi-page table data, the table state is reset when the table is redisplayed (filters are set at default values, and the first page of multi-page table data is shown). The latter problem is not easily solved.

comment:8 Changed 15 years ago by olle

(In [3150]) Refs #523. Class/file action/write/EmptyTrash.java in client/servlet/ updated to not change to the "Home" page after emptying the trash can, since this is not desired when the command to empty the trash is selected from menu item "Edit -> Empty Trash", which is accessible from all pages.

Emptying the trash can by clicking on tool bar button "Empty Trash" in the "Trash" pane on the "Home" page will work as previously after the fix, while the current page will be re-displayed when selecting "Empty Trash" in the "Edit" menu. However, if a table managed by TableFactory or TableFactory2 was showing a view of data using specific filter settings and/or a table page other than the first for multi-page table data, the table state is reset when the table is re-displayed (filters are set at default values, and the first page of multi-page table data is shown).

  1. Protected method void runMe() updated to by removing command

"setForwardTo(ViewHome.class)" at the end of the method.

comment:9 Changed 15 years ago by olle

Test regarding backwards compatibility of update in changeset [3150] added 2009-03-02 08:29:25 by olle. The test specifically concerns whether the "Trash" pane on the "Home" page will show the correct number of items remaining in the trash can after the latter has been emptied in different ways:

  • The "Trash" pane on the "Home" page showed the correct number of items remaining in the trash can after the latter had been emptied by clicking on tool bar button "Empty Trash" in the "Trash" pane on the "Home" page. This is the same behavior as previously.
  • The "Trash" pane on the "Home" page showed the correct number of items remaining in the trash can after the latter had been emptied by selecting "Empty Trash" in the "Edit" menu. This option was introduced with this ticket, and it is desired that the behavior is identical to that resulting from clicking on tool bar button "Empty Trash" in the "Trash" pane on the "Home" page, which was also the case.

The test were therefore successful and produced the desired results.

comment:10 Changed 15 years ago by olle

Resolution: fixed
Status: reopenedclosed

Ticket closed as the current page is now redisplayed after emptying the trash can. The problem with tables managed by TableFactory or TableFactory2 having the table state reset when redisplayed is not handled here, since it is not related to backwards compatibility of the update.

comment:11 Changed 14 years ago by olle

(In [3449]) Refs #620. Refs #523. Class/file action/write/EmptyTrash.java in client/servlet/ refactored to to facilitate future addition of trash can support for more item classes:

  1. New private instance variable String errorMessage with

public accessor methods added. This replaces the previous local variable with the same name in protected method void runMe().

  1. Protected method void runMe() updated to call new private

method int deleteItemsOfSpecificClass(Class itemClass) to try to delete items of a specific class.

  1. New private method int deleteItemsOfSpecificClass(Class itemClass)

added. It tries to delete items of a specific class, and returns the number of deleted items. If some item cannot be deleted, the error message is updated.

comment:12 Changed 14 years ago by olle

(In [3450]) Refs #620. Refs #523. Class/file action/write/EmptyTrash.java in client/servlet/ updated to facilitate future optional creation of job to empty trash can:

  1. Protected method void runMe() updated by moving commands

for deleting items to new private method void emptyTrashCan().

  1. New private method void emptyTrashCan() added.

It calls method int deleteItemsOfSpecificClass(Class itemClass) to try to delete items of a specific class. Order in which items are deleted changed to Jobs, Spectrum Searches, Files, and Directories.

  1. Unused imports and code removed.

comment:13 Changed 14 years ago by olle

(In [3451]) Refs #620. Refs #523. Action to empty trash can now creates a job if any SpectrumSearch item or or more than 10 other items should be removed:

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

updated:

  1. Protected method void runMe() updated to call new private

method <D extends BasicItem> int getNumberOfTrashItems(DbControl dc, Class<D> itemClass) to obtain the number of items to remove of a specific class. If any SpectrumSearch item or or more than 10 other items should be removed, new private method void createEmptyTrashCanJob() is called to create a job, otherwise private method void emptyTrashCan() is called.

  1. New private method void createEmptyTrashCanJob() added.

It creates a job using new plug-in class EmptyTrashPlugin.

  1. Private method void emptyTrashCan() updated to prefix any

error part of the delete message with "ERROR: ".

  1. New private method int getTotalNumberOfTrashItems(DbControl dc)

added. It obtains the total number of items in the trash can by calling new private method <D extends BasicItem> int getNumberOfTrashItems(DbControl dc, Class<D> itemClass).

  1. New private method

<D extends BasicItem> int getNumberOfTrashItems(DbControl dc, Class<D> itemClass) added. It obtains the number of items of a specific class in the trash can.

  1. New class/file plugins/EmptyTrashPlugin.java in plugin/ added.
  2. Public method

void run(Request request, Response response, ProgressReporter progress) calls public method void execute(Request request, Response response, ProgressReporter progress) to empty the trash can.

  1. Public method

void execute(Request request, Response response, ProgressReporter progress) calls private method int deleteItemsOfSpecificClass(Class itemClass, ProgressReporter progress, int startCount, int totalCount) to remove items of a specific class.

  1. Private method

int deleteItemsOfSpecificClass(Class itemClass, ProgressReporter progress, int startCount, int totalCount) tries to delete items of a specific class, and returns the number of deleted items. If some item cannot be deleted, the error message is updated. The progress reporter is updated after each processed item.

  1. Private method int getTotalNumberOfTrashItems(DbControl dc)

obtains the total number of items in the trash can by calling private method <D extends BasicItem> int getNumberOfTrashItems(DbControl dc, Class<D> itemClass).

  1. Private method

<D extends BasicItem> int getNumberOfTrashItems(DbControl dc, Class<D> itemClass) obtains the number of items of a specific class in the trash can.

comment:14 Changed 13 years ago by olle

(In [3953]) 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.

comment:15 Changed 13 years ago by olle

(In [3956]) Refs #704. Refs #523. Refs #620. Routines for permanently removing items in the trash updated to repeat attempts to empty the trash can, as long as some item is removed in each attempt, and more items to remove remain:

  1. Class/file action/write/EmptyTrash.java in client/servlet/ updated:
  2. Private method void emptyTrashCan() updated with new argument

int totalItemCount and calling new private method int emptyTrashCanAttempt() as long as some item is removed in each attempt, and more items to remove remain.

  1. New private method int emptyTrashCanAttempt() added.

It attempts to permanently remove items, using code previously in private method void emptyTrashCan().

  1. Class/file plugins/EmptyTrashPlugin.java in plugin/ updated:
  2. Public method void execute(Request request, Response response, ProgressReporter progress)

updated to call new private method int emptyTrashCanAttempt(Request request, Response response, ProgressReporter progress, int accDeletedCount, int totalItemCount) as long as some item is removed in each attempt, and more items to remove remain.

  1. New private method

int emptyTrashCanAttempt(Request request, Response response, ProgressReporter progress, int accDeletedCount, int totalItemCount) added. It attempts to permanently remove items, using code previously in public method void execute(Request request, Response response, ProgressReporter progress).

Note: See TracTickets for help on using tickets.