Skip to content
Snippets Groups Projects
Commit 96b8368b authored by buczekp's avatar buczekp
Browse files

[LMS-2367] introduced trash button in top menu (instead of option in Administration menu)

SVN: 22186
parent 04210d8e
No related branches found
No related tags found
No related merge requests found
Showing
with 55 additions and 5 deletions
...@@ -539,6 +539,10 @@ public abstract class Dict ...@@ -539,6 +539,10 @@ public abstract class Dict
public static final String PERMANENT_DELETIONS_CONFIRMATION_MSG = public static final String PERMANENT_DELETIONS_CONFIRMATION_MSG =
"permanent_deletions_confirmation_msg"; "permanent_deletions_confirmation_msg";
public static final String USE_TRASH_BROWSER = "use_trash_browser";
public static final String TRASH_BUTTON_TOOLTIP = "trash_button_tooltip";
public static final String EMPTY_TRASH_CONFIRMATION_TITLE = "empty_trash_confirmation_title"; public static final String EMPTY_TRASH_CONFIRMATION_TITLE = "empty_trash_confirmation_title";
public static final String EMPTY_TRASH_CONFIRMATION_MSG = "empty_trash_confirmation_msg"; public static final String EMPTY_TRASH_CONFIRMATION_MSG = "empty_trash_confirmation_msg";
......
...@@ -62,4 +62,7 @@ public interface IGenericImageBundle extends ClientBundle ...@@ -62,4 +62,7 @@ public interface IGenericImageBundle extends ClientBundle
@Source("cancel.gif") @Source("cancel.gif")
public ImageResource getCancelIcon(); public ImageResource getCancelIcon();
@Source("trash.gif")
public ImageResource getTrashIcon();
} }
...@@ -55,7 +55,7 @@ public class TopMenu extends LayoutContainer ...@@ -55,7 +55,7 @@ public class TopMenu extends LayoutContainer
AUTHORIZATION_MENU_USERS, AUTHORIZATION_MENU_ROLES, AUTHORIZATION_MENU_USERS, AUTHORIZATION_MENU_ROLES,
AUTHORIZATION_MENU_AUTHORIZATION_GROUPS, AUTHORIZATION_MENU_AUTHORIZATION_GROUPS,
TRASH, LOGGING_CONSOLE, LOGGING_CONSOLE,
DATA_SET_MENU_SEARCH, DATA_SET_MENU_TYPES, DATA_SET_MENU_FILE_FORMATS, DATA_SET_MENU_SEARCH, DATA_SET_MENU_TYPES, DATA_SET_MENU_FILE_FORMATS,
DATA_SET_MENU_UPLOAD, DATA_SET_MENU_UPLOAD_CLIENT, DATA_SET_MENU_MASS_UPDATE, DATA_SET_MENU_UPLOAD, DATA_SET_MENU_UPLOAD_CLIENT, DATA_SET_MENU_MASS_UPDATE,
...@@ -124,6 +124,7 @@ public class TopMenu extends LayoutContainer ...@@ -124,6 +124,7 @@ public class TopMenu extends LayoutContainer
toolBar.add(new SearchWidget(viewContext)); toolBar.add(new SearchWidget(viewContext));
toolBar.add(new SeparatorToolItem()); toolBar.add(new SeparatorToolItem());
toolBar.add(new InfoButton(viewContext)); toolBar.add(new InfoButton(viewContext));
toolBar.add(new TrashButton(viewContext, componentProvider));
toolBar.add(new LoggedUserMenu(viewContext, componentProvider)); toolBar.add(new LoggedUserMenu(viewContext, componentProvider));
} }
......
package ch.systemsx.cisd.openbis.generic.client.web.client.application.menu;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ComponentProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DispatcherHelper;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils;
/** {@link Button} opening trash browser */
public class TrashButton extends Button
{
public TrashButton(final IViewContext<ICommonClientServiceAsync> viewContext,
final ComponentProvider componentProvider)
{
setIcon(AbstractImagePrototype.create(viewContext.getImageBundle().getTrashIcon()));
GWTUtils.setToolTip(this, viewContext.getMessage(Dict.TRASH_BUTTON_TOOLTIP));
addSelectionListener(new SelectionListener<ButtonEvent>()
{
@Override
public void componentSelected(ButtonEvent ce)
{
DispatcherHelper.dispatchNaviEvent(componentProvider.getDeletionBrowser());
}
});
setWidth(24);
}
}
\ No newline at end of file
...@@ -51,8 +51,6 @@ public class AdministrationMenu extends TopMenuItem ...@@ -51,8 +51,6 @@ public class AdministrationMenu extends TopMenuItem
submenu.add(new AuthorizationMenu(messageProvider, componentProvider)); submenu.add(new AuthorizationMenu(messageProvider, componentProvider));
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.DATA_SET_MENU_FILE_FORMATS, submenu.add(new ActionMenu(TopMenu.ActionMenuKind.DATA_SET_MENU_FILE_FORMATS,
messageProvider, componentProvider.getFileFormatTypeBrowser())); messageProvider, componentProvider.getFileFormatTypeBrowser()));
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.TRASH, messageProvider, componentProvider
.getDeletionBrowser()));
if (viewContext.isLoggingEnabled()) if (viewContext.isLoggingEnabled())
{ {
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.LOGGING_CONSOLE, messageProvider, submenu.add(new ActionMenu(TopMenu.ActionMenuKind.LOGGING_CONSOLE, messageProvider,
......
...@@ -317,7 +317,15 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends ...@@ -317,7 +317,15 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends
protected final AbstractAsyncCallback<Void> createDeletionCallback() protected final AbstractAsyncCallback<Void> createDeletionCallback()
{ {
return new RefreshViewerCallback(viewContext); return new RefreshViewerCallback(viewContext)
{
@Override
protected void process(Void result)
{
super.process(result);
GWTUtils.displayInfo(viewContext.getMessage(Dict.USE_TRASH_BROWSER));
}
};
} }
protected final AbstractAsyncCallback<Void> createRevertDeletionCallback() protected final AbstractAsyncCallback<Void> createRevertDeletionCallback()
...@@ -339,7 +347,7 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends ...@@ -339,7 +347,7 @@ public abstract class AbstractViewer<D extends IEntityInformationHolder> extends
} }
} }
private final class RefreshViewerCallback extends AbstractAsyncCallback<Void> private class RefreshViewerCallback extends AbstractAsyncCallback<Void>
{ {
public RefreshViewerCallback(IViewContext<?> viewContext) public RefreshViewerCallback(IViewContext<?> viewContext)
{ {
......
...@@ -85,6 +85,8 @@ var common = { ...@@ -85,6 +85,8 @@ var common = {
revert_deletions_confirmation_msg: "Are you sure you want to revert {0} selected deletion(s)?", revert_deletions_confirmation_msg: "Are you sure you want to revert {0} selected deletion(s)?",
permanent_deletions_confirmation_title: "Confirm Permanent Deletion", permanent_deletions_confirmation_title: "Confirm Permanent Deletion",
permanent_deletions_confirmation_msg: "Are you sure you want to <b>permanently</b> delete all entities that were moved to trash in selected {0} deletion(s)?</br></br>You can't undo this action.", permanent_deletions_confirmation_msg: "Are you sure you want to <b>permanently</b> delete all entities that were moved to trash in selected {0} deletion(s)?</br></br>You can't undo this action.",
use_trash_browser: "Use trash browser (click on the trash button in top menu) to delete entities permanently.",
trash_button_tooltip: "Displays browser of deletions, allows to revert them or confirm (delete permanently).",
empty_trash_confirmation_title: "Confirm Empty Trash", empty_trash_confirmation_title: "Confirm Empty Trash",
empty_trash_confirmation_msg: "Are you sure you want to <b>permanently</b> delete all entities that were moved to trash?</br></br>You can't undo this action.", empty_trash_confirmation_msg: "Are you sure you want to <b>permanently</b> delete all entities that were moved to trash?</br></br>You can't undo this action.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment