From 219c63d7541d34112a8a3e721408439dfdc75505 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 25 Mar 2014 10:15:58 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@93502 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/template/TemplateApplyPanel.java | 48 ++++++++++--------- .../client/template/TemplateDeletePanel.java | 13 +++-- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java index 49490fd..69690cc 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateApplyPanel.java @@ -211,24 +211,22 @@ public class TemplateApplyPanel extends FramedPanel { } - /*protected void setMenu() { - Menu contextMenu = new Menu(); - - MenuItem deleteTemplateItem = new MenuItem("Delete"); - deleteTemplateItem.setId("DeleteTemplate"); - deleteTemplateItem.setIcon(ResourceBundle.INSTANCE.removeTemplate()); - deleteTemplateItem.addSelectionHandler(new SelectionHandler() { - - @Override - public void onSelection(SelectionEvent event) { - Log.debug("Delete Template"); - TemplateData templateDesc = getSelectedItem(); - - } - }); - - grid.setContextMenu(contextMenu); - }*/ + /* + * protected void setMenu() { Menu contextMenu = new Menu(); + * + * MenuItem deleteTemplateItem = new MenuItem("Delete"); + * deleteTemplateItem.setId("DeleteTemplate"); + * deleteTemplateItem.setIcon(ResourceBundle.INSTANCE.removeTemplate()); + * deleteTemplateItem.addSelectionHandler(new SelectionHandler() { + * + * @Override public void onSelection(SelectionEvent event) { + * Log.debug("Delete Template"); TemplateData templateDesc = + * getSelectedItem(); + * + * } }); + * + * grid.setContextMenu(contextMenu); } + */ protected TemplateData getSelectedItem() { return grid.getSelectionModel().getSelectedItem(); @@ -236,11 +234,15 @@ public class TemplateApplyPanel extends FramedPanel { protected void apply() { templateApplySession = new TemplateApplySession(); - templateApplySession.setTemplateData(getSelectedItem()); - templateApplySession.setTrId(trId); - Log.debug("applyTemplateSession: " + templateApplySession); - parent.applyTemplate(templateApplySession); - + TemplateData template = getSelectedItem(); + if (template == null) { + UtilsGXT3.info("Attention", "Select the template to apply"); + } else { + templateApplySession.setTemplateData(getSelectedItem()); + templateApplySession.setTrId(trId); + Log.debug("applyTemplateSession: " + templateApplySession); + parent.applyTemplate(templateApplySession); + } } protected void close() { diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateDeletePanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateDeletePanel.java index f649cac..ce49243 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateDeletePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/template/TemplateDeletePanel.java @@ -237,10 +237,17 @@ public class TemplateDeletePanel extends FramedPanel { protected void delete() { templateDeleteSession = new TemplateDeleteSession(); - templateDeleteSession.setTemplates(getSelectedItem()); - Log.debug("templateDeleteSession: " + templateDeleteSession); - parent.templatesDelete(templateDeleteSession); + ArrayList templates=getSelectedItem(); + if(templates==null|| templates.size()==0){ + UtilsGXT3.info("Attention", + "Select the template to be deleted"); + } else { + templateDeleteSession.setTemplates(getSelectedItem()); + Log.debug("templateDeleteSession: " + templateDeleteSession); + parent.templatesDelete(templateDeleteSession); + } + } protected void close() {