From eb371160e9a89307be547de2dbc6b0433652a27c Mon Sep 17 00:00:00 2001 From: tpylak <tpylak> Date: Tue, 29 Mar 2011 09:06:13 +0000 Subject: [PATCH] LMS-2153 do not allow to export all columns in embedded mode SVN: 20522 --- .../ui/grid/BrowserGridPagingToolBar.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java index b90242b8d90..8344ac5abac 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java @@ -43,6 +43,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericCon import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; +import ch.systemsx.cisd.openbis.generic.shared.basic.ViewMode; /** * {@link PagingToolBar} extension with overwritten behavior of the <i>Refresh</i> button and @@ -307,10 +308,30 @@ public final class BrowserGridPagingToolBar extends PagingToolBar } /** creates a new export button, the caller has to add it to a parent container */ - public static Button createExportButton(IMessageProvider messageProvider, + public static Button createExportButton(IViewContext<?> viewContext, final IBrowserGridActionInvoker invoker) { - final Button button = new ExportButtonMenu(messageProvider, invoker); + if (viewContext.getModel().getViewMode() == ViewMode.EMBEDDED) + { + return createVisibleColumnsExportButton(viewContext, invoker); + } else + { + return new ExportButtonMenu(viewContext, invoker); + } + } + + private static Button createVisibleColumnsExportButton(IMessageProvider messageProvider, + final IBrowserGridActionInvoker invoker) + { + Button button = new Button(messageProvider.getMessage(Dict.BUTTON_EXPORT_TABLE)); + button.addSelectionListener(new SelectionListener<ButtonEvent>() + { + @Override + public void componentSelected(ButtonEvent ce) + { + invoker.export(false); + } + }); return button; } -- GitLab